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