Merge branch 'lp-offset-twoside'
[mesa.git] / src / gallium / drivers / llvmpipe / lp_state_setup.h
1 #ifndef LP_STATE_SETUP_H
2 #define LP_STATE_SETUP_H
3
4 #include "lp_bld_interp.h"
5
6
7 struct llvmpipe_context;
8 struct lp_setup_variant;
9
10 struct lp_setup_variant_list_item
11 {
12 struct lp_setup_variant *base;
13 struct lp_setup_variant_list_item *next, *prev;
14 };
15
16
17 struct lp_setup_variant_key {
18 unsigned size:16;
19 unsigned num_inputs:8;
20 unsigned color_slot:8;
21
22 unsigned bcolor_slot:8;
23 unsigned spec_slot:8;
24 unsigned bspec_slot:8;
25 unsigned flatshade_first:1;
26 unsigned pixel_center_half:1;
27 unsigned twoside:1;
28 unsigned pad:5;
29
30 float units;
31 float scale;
32 struct lp_shader_input inputs[PIPE_MAX_SHADER_INPUTS];
33 };
34
35
36 typedef void (*lp_jit_setup_triangle)( const float (*v0)[4],
37 const float (*v1)[4],
38 const float (*v2)[4],
39 boolean front_facing,
40 float (*a0)[4],
41 float (*dadx)[4],
42 float (*dady)[4] );
43
44
45
46
47 /* At this stage, for a given variant key, we create a
48 * draw_vertex_info struct telling the draw module how to format the
49 * vertices, and an llvm-generated function which calculates the
50 * attribute interpolants (a0, dadx, dady) from three of those
51 * vertices.
52 */
53 struct lp_setup_variant {
54 struct lp_setup_variant_key key;
55
56 struct lp_setup_variant_list_item list_item_global;
57
58 /* XXX: this is a pointer to the LLVM IR. Once jit_function is
59 * generated, we never need to use the IR again - need to find a
60 * way to release this data without destroying the generated
61 * assembly.
62 */
63 LLVMValueRef function;
64
65 /* The actual generated setup function:
66 */
67 lp_jit_setup_triangle jit_function;
68
69 unsigned no;
70 };
71
72 void lp_setup_tri_fallback( const float (*v0)[4],
73 const float (*v1)[4],
74 const float (*v2)[4],
75 boolean front_facing,
76 float (*a0)[4],
77 float (*dadx)[4],
78 float (*dady)[4],
79 const struct lp_setup_variant_key *key );
80
81 void lp_delete_setup_variants(struct llvmpipe_context *lp);
82
83 void
84 lp_dump_setup_coef( const struct lp_setup_variant_key *key,
85 const float (*sa0)[4],
86 const float (*sdadx)[4],
87 const float (*sdady)[4]);
88
89 #endif