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