diff options
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/draw/draw_llvm.h')
-rw-r--r-- | lib/mesa/src/gallium/auxiliary/draw/draw_llvm.h | 302 |
1 files changed, 3 insertions, 299 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/draw/draw_llvm.h b/lib/mesa/src/gallium/auxiliary/draw/draw_llvm.h index b1c498631..6edc89b63 100644 --- a/lib/mesa/src/gallium/auxiliary/draw/draw_llvm.h +++ b/lib/mesa/src/gallium/auxiliary/draw/draw_llvm.h @@ -32,7 +32,6 @@ #include "draw/draw_vs.h" #include "draw/draw_gs.h" -#include "draw/draw_tess.h" #include "gallivm/lp_bld_sample.h" #include "gallivm/lp_bld_limits.h" @@ -44,8 +43,6 @@ struct draw_llvm; struct llvm_vertex_shader; struct llvm_geometry_shader; -struct llvm_tess_ctrl_shader; -struct llvm_tess_eval_shader; struct draw_jit_texture { @@ -320,103 +317,6 @@ enum { #define draw_gs_jit_context_num_ssbos(_gallivm, _ptr) \ lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_GS_JIT_CTX_NUM_SSBOS, "num_ssbos") - -struct draw_tcs_jit_context { - const float *constants[LP_MAX_TGSI_CONST_BUFFERS]; - int num_constants[LP_MAX_TGSI_CONST_BUFFERS]; - - int dummy1; - int dummy2; - /* There two need to be exactly at DRAW_JIT_CTX_TEXTURES and - * DRAW_JIT_CTX_SAMPLERS positions in the struct */ - struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS]; - struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS]; - struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES]; - - const uint32_t *ssbos[LP_MAX_TGSI_SHADER_BUFFERS]; - int num_ssbos[LP_MAX_TGSI_SHADER_BUFFERS]; -}; - -enum { - DRAW_TCS_JIT_CTX_CONSTANTS = 0, - DRAW_TCS_JIT_CTX_NUM_CONSTANTS = 1, - DRAW_TCS_JIT_CTX_TEXTURES = DRAW_JIT_CTX_TEXTURES, - DRAW_TCS_JIT_CTX_SAMPLERS = DRAW_JIT_CTX_SAMPLERS, - DRAW_TCS_JIT_CTX_IMAGES = DRAW_JIT_CTX_IMAGES, - DRAW_TCS_JIT_CTX_SSBOS = 7, - DRAW_TCS_JIT_CTX_NUM_SSBOS = 8, - DRAW_TCS_JIT_CTX_NUM_FIELDS = 9, -}; - -#define draw_tcs_jit_context_constants(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TCS_JIT_CTX_CONSTANTS, "constants") - -#define draw_tcs_jit_context_num_constants(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TCS_JIT_CTX_NUM_CONSTANTS, "num_constants") - -#define draw_tcs_jit_context_textures(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TCS_JIT_CTX_TEXTURES, "textures") - -#define draw_tcs_jit_context_samplers(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TCS_JIT_CTX_SAMPLERS, "samplers") - -#define draw_tcs_jit_context_images(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TCS_JIT_CTX_IMAGES, "images") - -#define draw_tcs_jit_context_ssbos(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TCS_JIT_CTX_SSBOS, "ssbos") - -#define draw_tcs_jit_context_num_ssbos(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TCS_JIT_CTX_NUM_SSBOS, "num_ssbos") - -struct draw_tes_jit_context { - const float *constants[LP_MAX_TGSI_CONST_BUFFERS]; - int num_constants[LP_MAX_TGSI_CONST_BUFFERS]; - - int dummy1; - int dummy2; - /* There two need to be exactly at DRAW_JIT_CTX_TEXTURES and - * DRAW_JIT_CTX_SAMPLERS positions in the struct */ - struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS]; - struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS]; - struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES]; - - const uint32_t *ssbos[LP_MAX_TGSI_SHADER_BUFFERS]; - int num_ssbos[LP_MAX_TGSI_SHADER_BUFFERS]; -}; - -enum { - DRAW_TES_JIT_CTX_CONSTANTS = 0, - DRAW_TES_JIT_CTX_NUM_CONSTANTS = 1, - DRAW_TES_JIT_CTX_TEXTURES = DRAW_JIT_CTX_TEXTURES, - DRAW_TES_JIT_CTX_SAMPLERS = DRAW_JIT_CTX_SAMPLERS, - DRAW_TES_JIT_CTX_IMAGES = DRAW_JIT_CTX_IMAGES, - DRAW_TES_JIT_CTX_SSBOS = 7, - DRAW_TES_JIT_CTX_NUM_SSBOS = 8, - DRAW_TES_JIT_CTX_NUM_FIELDS = 9, -}; - -#define draw_tes_jit_context_constants(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TES_JIT_CTX_CONSTANTS, "constants") - -#define draw_tes_jit_context_num_constants(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TES_JIT_CTX_NUM_CONSTANTS, "num_constants") - -#define draw_tes_jit_context_textures(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TES_JIT_CTX_TEXTURES, "textures") - -#define draw_tes_jit_context_samplers(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TES_JIT_CTX_SAMPLERS, "samplers") - -#define draw_tes_jit_context_images(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TES_JIT_CTX_IMAGES, "images") - -#define draw_tes_jit_context_ssbos(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TES_JIT_CTX_SSBOS, "ssbos") - -#define draw_tes_jit_context_num_ssbos(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TES_JIT_CTX_NUM_SSBOS, "num_ssbos") - typedef boolean (*draw_jit_vert_func)(struct draw_jit_context *context, struct vertex_header *io, @@ -435,27 +335,12 @@ typedef boolean typedef int (*draw_gs_jit_func)(struct draw_gs_jit_context *context, float inputs[6][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS][TGSI_NUM_CHANNELS], - struct vertex_header **output, + struct vertex_header *output, unsigned num_prims, unsigned instance_id, int *prim_ids, unsigned invocation_id); -typedef int -(*draw_tcs_jit_func)(struct draw_tcs_jit_context *context, - float inputs[32][NUM_TCS_INPUTS][TGSI_NUM_CHANNELS], - float outputs[32][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS], - uint32_t prim_id, uint32_t patch_vertices_in); - -typedef int -(*draw_tes_jit_func)(struct draw_tes_jit_context *context, - float inputs[32][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS], - struct vertex_header *io, - uint32_t prim_id, uint32_t num_tess_coord, - float *tess_coord_x, float *tess_coord_y, float *tess_outer, - float *tess_inner, uint32_t patch_vertices_in); - - struct draw_llvm_variant_key { unsigned nr_vertex_elements:8; @@ -469,7 +354,7 @@ struct draw_llvm_variant_key unsigned clip_halfz:1; unsigned bypass_viewport:1; unsigned need_edgeflags:1; - unsigned has_gs_or_tes:1; + unsigned has_gs:1; unsigned num_outputs:8; unsigned ucp_enable:PIPE_MAX_CLIP_PLANES; /* note padding here - must use memset */ @@ -497,24 +382,6 @@ struct draw_gs_llvm_variant_key /* Followed by variable number of images.*/ }; -struct draw_tcs_llvm_variant_key -{ - unsigned nr_samplers:8; - unsigned nr_sampler_views:8; - unsigned nr_images:8; - struct draw_sampler_static_state samplers[1]; - /* Followed by variable number of images.*/ -}; - -struct draw_tes_llvm_variant_key -{ - unsigned nr_samplers:8; - unsigned nr_sampler_views:8; - unsigned nr_images:8; - struct draw_sampler_static_state samplers[1]; - /* Followed by variable number of images.*/ -}; - #define DRAW_LLVM_MAX_VARIANT_KEY_SIZE \ (sizeof(struct draw_llvm_variant_key) + \ PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state) + \ @@ -526,16 +393,6 @@ struct draw_tes_llvm_variant_key PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \ PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state)) -#define DRAW_TCS_LLVM_MAX_VARIANT_KEY_SIZE \ - (sizeof(struct draw_tcs_llvm_variant_key) + \ - PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \ - PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state)) - -#define DRAW_TES_LLVM_MAX_VARIANT_KEY_SIZE \ - (sizeof(struct draw_tes_llvm_variant_key) + \ - PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \ - PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state)) - static inline size_t draw_llvm_variant_key_size(unsigned nr_vertex_elements, @@ -556,21 +413,6 @@ draw_gs_llvm_variant_key_size(unsigned nr_samplers, unsigned nr_images) (nr_samplers - 1) * sizeof(struct draw_sampler_static_state)); } -static inline size_t -draw_tcs_llvm_variant_key_size(unsigned nr_samplers, unsigned nr_images) -{ - return (sizeof(struct draw_tcs_llvm_variant_key) + - (nr_images) * sizeof(struct draw_sampler_static_state) + - (nr_samplers - 1) * sizeof(struct draw_sampler_static_state)); -} - -static inline size_t -draw_tes_llvm_variant_key_size(unsigned nr_samplers, unsigned nr_images) -{ - return (sizeof(struct draw_tes_llvm_variant_key) + - (nr_images) * sizeof(struct draw_sampler_static_state) + - (nr_samplers - 1) * sizeof(struct draw_sampler_static_state)); -} static inline struct draw_sampler_static_state * draw_llvm_variant_key_samplers(struct draw_llvm_variant_key *key) @@ -595,20 +437,6 @@ draw_gs_llvm_variant_key_images(struct draw_gs_llvm_variant_key *key) &key->samplers[key->nr_samplers]; } -static inline struct draw_image_static_state * -draw_tcs_llvm_variant_key_images(struct draw_tcs_llvm_variant_key *key) -{ - return (struct draw_image_static_state *) - &key->samplers[key->nr_samplers]; -} - -static inline struct draw_image_static_state * -draw_tes_llvm_variant_key_images(struct draw_tes_llvm_variant_key *key) -{ - return (struct draw_image_static_state *) - &key->samplers[key->nr_samplers]; -} - struct draw_llvm_variant_list_item { struct draw_llvm_variant *base; @@ -621,17 +449,6 @@ struct draw_gs_llvm_variant_list_item struct draw_gs_llvm_variant_list_item *next, *prev; }; -struct draw_tcs_llvm_variant_list_item -{ - struct draw_tcs_llvm_variant *base; - struct draw_tcs_llvm_variant_list_item *next, *prev; -}; - -struct draw_tes_llvm_variant_list_item -{ - struct draw_tes_llvm_variant *base; - struct draw_tes_llvm_variant_list_item *next, *prev; -}; struct draw_llvm_variant { @@ -682,57 +499,6 @@ struct draw_gs_llvm_variant struct draw_gs_llvm_variant_key key; }; -struct draw_tcs_llvm_variant -{ - struct gallivm_state *gallivm; - - /* LLVM JIT builder types */ - LLVMTypeRef context_ptr_type; - LLVMTypeRef input_array_type; - LLVMTypeRef output_array_type; - - LLVMValueRef context_ptr; - LLVMValueRef io_ptr; - LLVMValueRef num_prims; - LLVMValueRef function; - draw_tcs_jit_func jit_func; - - struct llvm_tess_ctrl_shader *shader; - - struct draw_llvm *llvm; - struct draw_tcs_llvm_variant_list_item list_item_global; - struct draw_tcs_llvm_variant_list_item list_item_local; - - /* key is variable-sized, must be last */ - struct draw_tcs_llvm_variant_key key; -}; - -struct draw_tes_llvm_variant -{ - struct gallivm_state *gallivm; - - /* LLVM JIT builder types */ - LLVMTypeRef context_ptr_type; - LLVMTypeRef vertex_header_ptr_type; - LLVMTypeRef input_array_type; - LLVMTypeRef patch_input_array_type; - - LLVMValueRef context_ptr; - LLVMValueRef io_ptr; - LLVMValueRef num_prims; - LLVMValueRef function; - draw_tes_jit_func jit_func; - - struct llvm_tess_eval_shader *shader; - - struct draw_llvm *llvm; - struct draw_tes_llvm_variant_list_item list_item_global; - struct draw_tes_llvm_variant_list_item list_item_local; - - /* key is variable-sized, must be last */ - struct draw_tes_llvm_variant_key key; -}; - struct llvm_vertex_shader { struct draw_vertex_shader base; @@ -751,23 +517,6 @@ struct llvm_geometry_shader { unsigned variants_cached; }; -struct llvm_tess_ctrl_shader { - struct draw_tess_ctrl_shader base; - - unsigned variant_key_size; - struct draw_tcs_llvm_variant_list_item variants; - unsigned variants_created; - unsigned variants_cached; -}; - -struct llvm_tess_eval_shader { - struct draw_tess_eval_shader base; - - unsigned variant_key_size; - struct draw_tes_llvm_variant_list_item variants; - unsigned variants_created; - unsigned variants_cached; -}; struct draw_llvm { struct draw_context *draw; @@ -777,20 +526,12 @@ struct draw_llvm { struct draw_jit_context jit_context; struct draw_gs_jit_context gs_jit_context; - struct draw_tcs_jit_context tcs_jit_context; - struct draw_tes_jit_context tes_jit_context; struct draw_llvm_variant_list_item vs_variants_list; int nr_variants; struct draw_gs_llvm_variant_list_item gs_variants_list; int nr_gs_variants; - - struct draw_tcs_llvm_variant_list_item tcs_variants_list; - int nr_tcs_variants; - - struct draw_tes_llvm_variant_list_item tes_variants_list; - int nr_tes_variants; }; @@ -806,17 +547,8 @@ llvm_geometry_shader(struct draw_geometry_shader *gs) return (struct llvm_geometry_shader *)gs; } -static inline struct llvm_tess_ctrl_shader * -llvm_tess_ctrl_shader(struct draw_tess_ctrl_shader *tcs) -{ - return (struct llvm_tess_ctrl_shader *)tcs; -} -static inline struct llvm_tess_eval_shader * -llvm_tess_eval_shader(struct draw_tess_eval_shader *tes) -{ - return (struct llvm_tess_eval_shader *)tes; -} + struct draw_llvm * draw_llvm_create(struct draw_context *draw, LLVMContextRef llvm_context); @@ -853,34 +585,6 @@ draw_gs_llvm_make_variant_key(struct draw_llvm *llvm, char *store); void draw_gs_llvm_dump_variant_key(struct draw_gs_llvm_variant_key *key); -struct draw_tcs_llvm_variant * -draw_tcs_llvm_create_variant(struct draw_llvm *llvm, - unsigned num_vertex_header_attribs, - const struct draw_tcs_llvm_variant_key *key); - -void -draw_tcs_llvm_destroy_variant(struct draw_tcs_llvm_variant *variant); - -struct draw_tcs_llvm_variant_key * -draw_tcs_llvm_make_variant_key(struct draw_llvm *llvm, char *store); - -void -draw_tcs_llvm_dump_variant_key(struct draw_tcs_llvm_variant_key *key); - -struct draw_tes_llvm_variant * -draw_tes_llvm_create_variant(struct draw_llvm *llvm, - unsigned num_vertex_header_attribs, - const struct draw_tes_llvm_variant_key *key); - -void -draw_tes_llvm_destroy_variant(struct draw_tes_llvm_variant *variant); - -struct draw_tes_llvm_variant_key * -draw_tes_llvm_make_variant_key(struct draw_llvm *llvm, char *store); - -void -draw_tes_llvm_dump_variant_key(struct draw_tes_llvm_variant_key *key); - struct lp_build_sampler_soa * draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state); |