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