1 #ifndef LP_STATE_SETUP_H
2 #define LP_STATE_SETUP_H
4 #include "lp_bld_interp.h"
7 struct llvmpipe_context
;
8 struct lp_setup_variant
;
10 struct lp_setup_variant_list_item
12 struct lp_setup_variant
*base
;
13 struct lp_setup_variant_list_item
*next
, *prev
;
17 struct lp_setup_variant_key
{
19 unsigned num_inputs
:8;
25 unsigned flatshade_first
:1;
26 unsigned pixel_center_half
:1;
28 unsigned floating_point_depth
:1;
31 /* TODO: get those floats out of the key and use a jit_context for setup */
32 float pgon_offset_units
;
33 float pgon_offset_scale
;
34 float pgon_offset_clamp
;
35 struct lp_shader_input inputs
[PIPE_MAX_SHADER_INPUTS
];
39 typedef void (*lp_jit_setup_triangle
)( const float (*v0
)[4],
50 /* At this stage, for a given variant key, we create a
51 * draw_vertex_info struct telling the draw module how to format the
52 * vertices, and an llvm-generated function which calculates the
53 * attribute interpolants (a0, dadx, dady) from three of those
56 struct lp_setup_variant
{
57 struct lp_setup_variant_key key
;
59 struct lp_setup_variant_list_item list_item_global
;
61 struct gallivm_state
*gallivm
;
63 /* XXX: this is a pointer to the LLVM IR. Once jit_function is
64 * generated, we never need to use the IR again - need to find a
65 * way to release this data without destroying the generated
68 LLVMValueRef function
;
70 /* The actual generated setup function:
72 lp_jit_setup_triangle jit_function
;
77 void lp_delete_setup_variants(struct llvmpipe_context
*lp
);
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]);