diff options
author | Dave Airlie <airlied@redhat.com> | 2022-08-26 17:06:59 +1000 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-05-17 01:19:24 +0000 |
commit | d4b7083ab3c4d98a96de3fa961569712d9c94f6b (patch) | |
tree | 014dd55203df7384e96b816f2121d4f9f8b41cf3 | |
parent | f677f64e80c453f21fbfa81855c88ba97c03b062 (diff) | |
download | mesa-d4b7083ab3c4d98a96de3fa961569712d9c94f6b.tar.gz |
draw: align common members in jit context structs.
this makes all the structs have the same baseline members for
resources and aniso_filter_table.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22788>
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm.c | 78 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm.h | 160 |
2 files changed, 124 insertions, 114 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index cd9c583b41b..351be54637d 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -159,22 +159,21 @@ create_jit_context_type(struct gallivm_state *gallivm, const char *struct_name) LLVMTypeRef elem_types[DRAW_JIT_CTX_NUM_FIELDS]; elem_types[DRAW_JIT_CTX_CONSTANTS] = LLVMArrayType(buffer_type, LP_MAX_TGSI_CONST_BUFFERS); - elem_types[DRAW_JIT_CTX_PLANES] = LLVMPointerType(LLVMArrayType(LLVMArrayType(float_type, 4), DRAW_TOTAL_CLIP_PLANES), 0); - elem_types[DRAW_JIT_CTX_VIEWPORT] = LLVMPointerType(float_type, 0); + elem_types[DRAW_JIT_CTX_SSBOS] = LLVMArrayType(buffer_type, LP_MAX_TGSI_SHADER_BUFFERS); elem_types[DRAW_JIT_CTX_TEXTURES] = LLVMArrayType(texture_type, PIPE_MAX_SHADER_SAMPLER_VIEWS); elem_types[DRAW_JIT_CTX_SAMPLERS] = LLVMArrayType(sampler_type, PIPE_MAX_SAMPLERS); elem_types[DRAW_JIT_CTX_IMAGES] = LLVMArrayType(image_type, PIPE_MAX_SHADER_IMAGES); - elem_types[DRAW_JIT_CTX_SSBOS] = LLVMArrayType(buffer_type, LP_MAX_TGSI_SHADER_BUFFERS); elem_types[DRAW_JIT_CTX_ANISO_FILTER_TABLE] = LLVMPointerType(float_type, 0); + elem_types[DRAW_JIT_CTX_PLANES] = LLVMPointerType(LLVMArrayType(LLVMArrayType(float_type, 4), DRAW_TOTAL_CLIP_PLANES), 0); + elem_types[DRAW_JIT_CTX_VIEWPORT] = LLVMPointerType(float_type, 0); + LLVMTypeRef context_type = LLVMStructTypeInContext(gallivm->context, elem_types, ARRAY_SIZE(elem_types), 0); (void) target; /* silence unused var warning for non-debug build */ LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, constants, target, context_type, DRAW_JIT_CTX_CONSTANTS); - LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, planes, - target, context_type, DRAW_JIT_CTX_PLANES); - LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, viewports, - target, context_type, DRAW_JIT_CTX_VIEWPORT); + LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, ssbos, + target, context_type, DRAW_JIT_CTX_SSBOS); LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, textures, target, context_type, DRAW_JIT_CTX_TEXTURES); @@ -183,10 +182,12 @@ create_jit_context_type(struct gallivm_state *gallivm, const char *struct_name) DRAW_JIT_CTX_SAMPLERS); LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, images, target, context_type, DRAW_JIT_CTX_IMAGES); - LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, ssbos, - target, context_type, DRAW_JIT_CTX_SSBOS); LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, aniso_filter_table, target, context_type, DRAW_JIT_CTX_ANISO_FILTER_TABLE); + LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, planes, + target, context_type, DRAW_JIT_CTX_PLANES); + LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, viewports, + target, context_type, DRAW_JIT_CTX_VIEWPORT); LP_CHECK_STRUCT_SIZE(struct draw_jit_context, target, context_type); @@ -213,42 +214,48 @@ create_gs_jit_context_type(struct gallivm_state *gallivm, elem_types[DRAW_GS_JIT_CTX_CONSTANTS] = LLVMArrayType(buffer_type, /* constants */ LP_MAX_TGSI_CONST_BUFFERS); - elem_types[DRAW_GS_JIT_CTX_PLANES] = LLVMPointerType(LLVMArrayType(LLVMArrayType(float_type, 4), - DRAW_TOTAL_CLIP_PLANES), 0); - elem_types[DRAW_GS_JIT_CTX_VIEWPORT] = LLVMPointerType(float_type, 0); /* viewports */ - + elem_types[DRAW_GS_JIT_CTX_SSBOS] = LLVMArrayType(buffer_type, /* ssbos */ + LP_MAX_TGSI_SHADER_BUFFERS); elem_types[DRAW_GS_JIT_CTX_TEXTURES] = LLVMArrayType(texture_type, PIPE_MAX_SHADER_SAMPLER_VIEWS); /* textures */ elem_types[DRAW_GS_JIT_CTX_SAMPLERS] = LLVMArrayType(sampler_type, PIPE_MAX_SAMPLERS); /* samplers */ elem_types[DRAW_GS_JIT_CTX_IMAGES] = LLVMArrayType(image_type, PIPE_MAX_SHADER_IMAGES); /* images */ + elem_types[DRAW_GS_JIT_CTX_ANISO_FILTER_TABLE] = LLVMPointerType(float_type, 0); /* aniso table */ + elem_types[DRAW_GS_JIT_CTX_PLANES] = LLVMPointerType(LLVMArrayType(LLVMArrayType(float_type, 4), + DRAW_TOTAL_CLIP_PLANES), 0); + elem_types[DRAW_GS_JIT_CTX_VIEWPORT] = LLVMPointerType(float_type, 0); /* viewports */ + + elem_types[DRAW_GS_JIT_CTX_PRIM_LENGTHS] = LLVMPointerType(LLVMPointerType(int_type, 0), 0); elem_types[DRAW_GS_JIT_CTX_EMITTED_VERTICES] = LLVMPointerType(LLVMVectorType(int_type, vector_length), 0); elem_types[DRAW_GS_JIT_CTX_EMITTED_PRIMS] = LLVMPointerType(LLVMVectorType(int_type, vector_length), 0); - elem_types[DRAW_GS_JIT_CTX_SSBOS] = LLVMArrayType(buffer_type, /* ssbos */ - LP_MAX_TGSI_SHADER_BUFFERS); - elem_types[DRAW_GS_JIT_CTX_ANISO_FILTER_TABLE] = LLVMPointerType(float_type, 0); /* aniso table */ - context_type = LLVMStructTypeInContext(gallivm->context, elem_types, ARRAY_SIZE(elem_types), 0); (void) target; /* silence unused var warning for non-debug build */ LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, constants, target, context_type, DRAW_GS_JIT_CTX_CONSTANTS); - LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, planes, - target, context_type, DRAW_GS_JIT_CTX_PLANES); - LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, viewports, - target, context_type, DRAW_GS_JIT_CTX_VIEWPORT); + LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, ssbos, + target, context_type, DRAW_GS_JIT_CTX_SSBOS); LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, textures, target, context_type, DRAW_GS_JIT_CTX_TEXTURES); LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, samplers, target, context_type, DRAW_GS_JIT_CTX_SAMPLERS); + LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, images, + target, context_type, DRAW_GS_JIT_CTX_IMAGES); + LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, aniso_filter_table, + target, context_type, DRAW_GS_JIT_CTX_ANISO_FILTER_TABLE); + LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, planes, + target, context_type, DRAW_GS_JIT_CTX_PLANES); + LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, viewports, + target, context_type, DRAW_GS_JIT_CTX_VIEWPORT); LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, prim_lengths, target, context_type, DRAW_GS_JIT_CTX_PRIM_LENGTHS); @@ -258,15 +265,8 @@ create_gs_jit_context_type(struct gallivm_state *gallivm, LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, emitted_prims, target, context_type, DRAW_GS_JIT_CTX_EMITTED_PRIMS); - LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, ssbos, - target, context_type, DRAW_GS_JIT_CTX_SSBOS); - LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, images, - target, context_type, DRAW_GS_JIT_CTX_IMAGES); - LP_CHECK_MEMBER_OFFSET(struct draw_gs_jit_context, aniso_filter_table, - target, context_type, DRAW_GS_JIT_CTX_ANISO_FILTER_TABLE); LP_CHECK_STRUCT_SIZE(struct draw_gs_jit_context, target, context_type); - return context_type; } @@ -394,9 +394,8 @@ create_tcs_jit_context_type(struct gallivm_state *gallivm, elem_types[DRAW_TCS_JIT_CTX_CONSTANTS] = LLVMArrayType(buffer_type, /* constants */ LP_MAX_TGSI_CONST_BUFFERS); - elem_types[DRAW_TCS_JIT_CTX_DUMMY1] = LLVMInt32TypeInContext(gallivm->context); - elem_types[DRAW_TCS_JIT_CTX_DUMMY2] = LLVMInt32TypeInContext(gallivm->context); - + elem_types[DRAW_TCS_JIT_CTX_SSBOS] = LLVMArrayType(buffer_type, /* ssbos */ + LP_MAX_TGSI_SHADER_BUFFERS); elem_types[DRAW_TCS_JIT_CTX_TEXTURES] = LLVMArrayType(texture_type, PIPE_MAX_SHADER_SAMPLER_VIEWS); /* textures */ elem_types[DRAW_TCS_JIT_CTX_SAMPLERS] = LLVMArrayType(sampler_type, @@ -404,8 +403,6 @@ create_tcs_jit_context_type(struct gallivm_state *gallivm, elem_types[DRAW_TCS_JIT_CTX_IMAGES] = LLVMArrayType(image_type, PIPE_MAX_SHADER_IMAGES); /* images */ - elem_types[DRAW_TCS_JIT_CTX_SSBOS] = LLVMArrayType(buffer_type, /* ssbos */ - LP_MAX_TGSI_SHADER_BUFFERS); elem_types[DRAW_TCS_JIT_CTX_ANISO_FILTER_TABLE] = LLVMPointerType(float_type, 0); /* aniso table */ context_type = LLVMStructTypeInContext(gallivm->context, elem_types, @@ -414,14 +411,14 @@ create_tcs_jit_context_type(struct gallivm_state *gallivm, (void) target; /* silence unused var warning for non-debug build */ LP_CHECK_MEMBER_OFFSET(struct draw_tcs_jit_context, constants, target, context_type, DRAW_TCS_JIT_CTX_CONSTANTS); + LP_CHECK_MEMBER_OFFSET(struct draw_tcs_jit_context, ssbos, + target, context_type, DRAW_TCS_JIT_CTX_SSBOS); LP_CHECK_MEMBER_OFFSET(struct draw_tcs_jit_context, textures, target, context_type, DRAW_TCS_JIT_CTX_TEXTURES); LP_CHECK_MEMBER_OFFSET(struct draw_tcs_jit_context, samplers, target, context_type, DRAW_TCS_JIT_CTX_SAMPLERS); - LP_CHECK_MEMBER_OFFSET(struct draw_tcs_jit_context, ssbos, - target, context_type, DRAW_TCS_JIT_CTX_SSBOS); LP_CHECK_MEMBER_OFFSET(struct draw_tcs_jit_context, images, target, context_type, DRAW_TCS_JIT_CTX_IMAGES); LP_CHECK_MEMBER_OFFSET(struct draw_tcs_jit_context, aniso_filter_table, @@ -502,9 +499,8 @@ create_tes_jit_context_type(struct gallivm_state *gallivm, elem_types[DRAW_TES_JIT_CTX_CONSTANTS] = LLVMArrayType(buffer_type, /* constants */ LP_MAX_TGSI_CONST_BUFFERS); - elem_types[DRAW_TES_JIT_CTX_DUMMY1] = LLVMInt32TypeInContext(gallivm->context); - elem_types[DRAW_TES_JIT_CTX_DUMMY2] = LLVMInt32TypeInContext(gallivm->context); - + elem_types[DRAW_TES_JIT_CTX_SSBOS] = LLVMArrayType(buffer_type, /* ssbos */ + LP_MAX_TGSI_SHADER_BUFFERS); elem_types[DRAW_TES_JIT_CTX_TEXTURES] = LLVMArrayType(texture_type, PIPE_MAX_SHADER_SAMPLER_VIEWS); /* textures */ elem_types[DRAW_TES_JIT_CTX_SAMPLERS] = LLVMArrayType(sampler_type, @@ -512,8 +508,6 @@ create_tes_jit_context_type(struct gallivm_state *gallivm, elem_types[DRAW_TES_JIT_CTX_IMAGES] = LLVMArrayType(image_type, PIPE_MAX_SHADER_IMAGES); /* images */ - elem_types[DRAW_TES_JIT_CTX_SSBOS] = LLVMArrayType(buffer_type, /* ssbos */ - LP_MAX_TGSI_SHADER_BUFFERS); elem_types[DRAW_TES_JIT_CTX_ANISO_FILTER_TABLE] = LLVMPointerType(float_type, 0); /* aniso table */ context_type = LLVMStructTypeInContext(gallivm->context, elem_types, @@ -522,14 +516,14 @@ create_tes_jit_context_type(struct gallivm_state *gallivm, (void) target; /* silence unused var warning for non-debug build */ LP_CHECK_MEMBER_OFFSET(struct draw_tes_jit_context, constants, target, context_type, DRAW_TES_JIT_CTX_CONSTANTS); + LP_CHECK_MEMBER_OFFSET(struct draw_tes_jit_context, ssbos, + target, context_type, DRAW_TES_JIT_CTX_SSBOS); LP_CHECK_MEMBER_OFFSET(struct draw_tes_jit_context, textures, target, context_type, DRAW_TES_JIT_CTX_TEXTURES); LP_CHECK_MEMBER_OFFSET(struct draw_tes_jit_context, samplers, target, context_type, DRAW_TES_JIT_CTX_SAMPLERS); - LP_CHECK_MEMBER_OFFSET(struct draw_tes_jit_context, ssbos, - target, context_type, DRAW_TES_JIT_CTX_SSBOS); LP_CHECK_MEMBER_OFFSET(struct draw_tes_jit_context, images, target, context_type, DRAW_TES_JIT_CTX_IMAGES); LP_CHECK_MEMBER_OFFSET(struct draw_tcs_jit_context, aniso_filter_table, diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h index f1042667f50..2697d9aef34 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.h +++ b/src/gallium/auxiliary/draw/draw_llvm.h @@ -84,45 +84,52 @@ enum { struct draw_jit_context { struct lp_jit_buffer constants[LP_MAX_TGSI_CONST_BUFFERS]; - float (*planes) [DRAW_TOTAL_CLIP_PLANES][4]; - struct pipe_viewport_state *viewports; - + struct lp_jit_buffer ssbos[LP_MAX_TGSI_SHADER_BUFFERS]; struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS]; struct lp_jit_sampler samplers[PIPE_MAX_SAMPLERS]; struct lp_jit_image images[PIPE_MAX_SHADER_IMAGES]; - - struct lp_jit_buffer ssbos[LP_MAX_TGSI_SHADER_BUFFERS]; - const float *aniso_filter_table; + + float (*planes) [DRAW_TOTAL_CLIP_PLANES][4]; + struct pipe_viewport_state *viewports; }; enum { DRAW_JIT_CTX_CONSTANTS = 0, - DRAW_JIT_CTX_PLANES = 1, - DRAW_JIT_CTX_VIEWPORT = 2, - DRAW_JIT_CTX_TEXTURES = 3, - DRAW_JIT_CTX_SAMPLERS = 4, - DRAW_JIT_CTX_IMAGES = 5, - DRAW_JIT_CTX_SSBOS = 6, - DRAW_JIT_CTX_ANISO_FILTER_TABLE = 7, + DRAW_JIT_CTX_SSBOS = 1, + DRAW_JIT_CTX_TEXTURES = 2, + DRAW_JIT_CTX_SAMPLERS = 3, + DRAW_JIT_CTX_IMAGES = 4, + DRAW_JIT_CTX_ANISO_FILTER_TABLE = 5, + DRAW_JIT_CTX_PLANES = 6, + DRAW_JIT_CTX_VIEWPORT = 7, DRAW_JIT_CTX_NUM_FIELDS }; #define draw_jit_context_constants(_variant, _ptr) \ lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_CONSTANTS, "constants") -#define draw_jit_context_planes(_gallivm, _type, _ptr) \ - lp_build_struct_get2(_gallivm, _type, _ptr, DRAW_JIT_CTX_PLANES, "planes") - -#define draw_jit_context_viewports(_variant, _ptr) \ - lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_VIEWPORT, "viewports") - #define draw_jit_context_ssbos(_variant, _ptr) \ lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_SSBOS, "ssbos") +#define draw_jit_context_textures(_variant, _ptr) \ + lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_TEXTURES, "textures") + +#define draw_jit_context_samplers(_variant, _ptr) \ + lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_SAMPLERS, "samplers") + +#define draw_jit_context_images(_variant, _ptr) \ + lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_IMAGES, "images") + #define draw_jit_context_aniso_filter_table(_variant, _ptr) \ lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_ANISO_FILTER_TABLE, "aniso_filter_table") +#define draw_jit_context_planes(_gallivm, _type, _ptr) \ + lp_build_struct_get2(_gallivm, _type, _ptr, DRAW_JIT_CTX_PLANES, "planes") + +#define draw_jit_context_viewports(_variant, _ptr) \ + lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_VIEWPORT, "viewports") + #define draw_jit_header_id(_gallivm, _type, _ptr) \ lp_build_struct_get_ptr2(_gallivm, _type, _ptr, DRAW_JIT_VERTEX_VERTEX_ID, "id") @@ -167,45 +174,59 @@ enum { struct draw_gs_jit_context { struct lp_jit_buffer constants[LP_MAX_TGSI_CONST_BUFFERS]; - float (*planes) [DRAW_TOTAL_CLIP_PLANES][4]; - struct pipe_viewport_state *viewports; - - /* There two need to be exactly at DRAW_JIT_CTX_TEXTURES and - * DRAW_JIT_CTX_SAMPLERS positions in the struct */ + struct lp_jit_buffer ssbos[LP_MAX_TGSI_SHADER_BUFFERS]; struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS]; struct lp_jit_sampler samplers[PIPE_MAX_SAMPLERS]; struct lp_jit_image images[PIPE_MAX_SHADER_IMAGES]; + const float *aniso_filter_table; + + float (*planes) [DRAW_TOTAL_CLIP_PLANES][4]; + struct pipe_viewport_state *viewports; int **prim_lengths; int *emitted_vertices; int *emitted_prims; - struct lp_jit_buffer ssbos[LP_MAX_TGSI_SHADER_BUFFERS]; - - const float *aniso_filter_table; }; enum { - DRAW_GS_JIT_CTX_CONSTANTS = 0, - DRAW_GS_JIT_CTX_PLANES = 1, - DRAW_GS_JIT_CTX_VIEWPORT = 2, - /* Textures and samples are reserved for DRAW_JIT_CTX_TEXTURES - * and DRAW_JIT_CTX_SAMPLERS, because they both need - * to be at exactly the same locations as they are in the - * VS ctx structure for sampling to work. */ + DRAW_GS_JIT_CTX_CONSTANTS = DRAW_JIT_CTX_CONSTANTS, + DRAW_GS_JIT_CTX_SSBOS = DRAW_JIT_CTX_SSBOS, DRAW_GS_JIT_CTX_TEXTURES = DRAW_JIT_CTX_TEXTURES, DRAW_GS_JIT_CTX_SAMPLERS = DRAW_JIT_CTX_SAMPLERS, DRAW_GS_JIT_CTX_IMAGES = DRAW_JIT_CTX_IMAGES, - DRAW_GS_JIT_CTX_PRIM_LENGTHS = 6, - DRAW_GS_JIT_CTX_EMITTED_VERTICES = 7, - DRAW_GS_JIT_CTX_EMITTED_PRIMS = 8, - DRAW_GS_JIT_CTX_SSBOS = 9, - DRAW_GS_JIT_CTX_ANISO_FILTER_TABLE = 10, + DRAW_GS_JIT_CTX_ANISO_FILTER_TABLE = DRAW_JIT_CTX_ANISO_FILTER_TABLE, + DRAW_GS_JIT_CTX_PLANES = 6, + DRAW_GS_JIT_CTX_VIEWPORT = 7, + DRAW_GS_JIT_CTX_PRIM_LENGTHS = 8, + DRAW_GS_JIT_CTX_EMITTED_VERTICES = 9, + DRAW_GS_JIT_CTX_EMITTED_PRIMS = 10, DRAW_GS_JIT_CTX_NUM_FIELDS = 11 }; #define draw_gs_jit_context_constants(_variant, _ptr) \ lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_CONSTANTS, "constants") +#define draw_gs_jit_context_ssbos(_variant, _ptr) \ + lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_SSBOS, "ssbos") + +#define draw_gs_jit_context_textures(_variant, _ptr) \ + lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_TEXTURES, "textures") + +#define draw_gs_jit_context_samplers(_variant, _ptr) \ + lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_SAMPLERS, "samplers") + +#define draw_gs_jit_context_images(_variant, _ptr) \ + lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_IMAGES, "images") + +#define draw_gs_jit_context_aniso_filter_table(_variant, _ptr) \ + lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_ANISO_FILTER_TABLE, "aniso_filter_table") + +#define draw_gs_jit_context_planes(_gallivm, _ptr) \ + lp_build_struct_get(_gallivm, _ptr, DRAW_GS_JIT_CTX_PLANES, "planes") + +#define draw_gs_jit_context_viewports(_gallivm, _ptr) \ + lp_build_struct_get(_gallivm, _ptr, DRAW_GS_JIT_CTX_VIEWPORT, "viewports") + #define draw_gs_jit_prim_lengths(_variant, _ptr) \ lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_PRIM_LENGTHS, "prim_lengths") @@ -215,38 +236,24 @@ enum { #define draw_gs_jit_emitted_prims(_variant, _ptr) \ lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_EMITTED_PRIMS, "emitted_prims") -#define draw_gs_jit_context_ssbos(_variant, _ptr) \ - lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_SSBOS, "ssbos") - -#define draw_gs_jit_context_aniso_filter_table(_variant, _ptr) \ - lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_ANISO_FILTER_TABLE, "aniso_filter_table") struct draw_tcs_jit_context { struct lp_jit_buffer 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 lp_jit_buffer ssbos[LP_MAX_TGSI_SHADER_BUFFERS]; struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS]; struct lp_jit_sampler samplers[PIPE_MAX_SAMPLERS]; struct lp_jit_image images[PIPE_MAX_SHADER_IMAGES]; - - struct lp_jit_buffer ssbos[LP_MAX_TGSI_SHADER_BUFFERS]; - const float *aniso_filter_table; }; enum { - DRAW_TCS_JIT_CTX_CONSTANTS = 0, - DRAW_TCS_JIT_CTX_DUMMY1 = 1, - DRAW_TCS_JIT_CTX_DUMMY2 = 2, + DRAW_TCS_JIT_CTX_CONSTANTS = DRAW_JIT_CTX_CONSTANTS, + DRAW_TCS_JIT_CTX_SSBOS = DRAW_JIT_CTX_SSBOS, 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 = 6, - DRAW_TCS_JIT_CTX_ANISO_FILTER_TABLE = 7, - DRAW_TCS_JIT_CTX_NUM_FIELDS = 8, + DRAW_TCS_JIT_CTX_ANISO_FILTER_TABLE = DRAW_JIT_CTX_ANISO_FILTER_TABLE, + DRAW_TCS_JIT_CTX_NUM_FIELDS = 6, }; #define draw_tcs_jit_context_constants(_variant, _ptr) \ @@ -255,35 +262,35 @@ enum { #define draw_tcs_jit_context_ssbos(_variant, _ptr) \ lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TCS_JIT_CTX_SSBOS, "ssbos") +#define draw_tcs_jit_context_textures(_variant, _ptr) \ + lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TCS_JIT_CTX_TEXTURES, "textures") + +#define draw_tcs_jit_context_samplers(_variant, _ptr) \ + lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TCS_JIT_CTX_SAMPLERS, "samplers") + +#define draw_tcs_jit_context_images(_variant, _ptr) \ + lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TCS_JIT_CTX_IMAGES, "images") + #define draw_tcs_jit_context_aniso_filter_table(_variant, _ptr) \ lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TCS_JIT_CTX_ANISO_FILTER_TABLE, "aniso_filter_table") struct draw_tes_jit_context { struct lp_jit_buffer 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 lp_jit_buffer ssbos[LP_MAX_TGSI_SHADER_BUFFERS]; struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS]; struct lp_jit_sampler samplers[PIPE_MAX_SAMPLERS]; struct lp_jit_image images[PIPE_MAX_SHADER_IMAGES]; - - struct lp_jit_buffer ssbos[LP_MAX_TGSI_SHADER_BUFFERS]; - const float *aniso_filter_table; }; enum { - DRAW_TES_JIT_CTX_CONSTANTS = 0, - DRAW_TES_JIT_CTX_DUMMY1 = 1, - DRAW_TES_JIT_CTX_DUMMY2 = 2, + DRAW_TES_JIT_CTX_CONSTANTS = DRAW_JIT_CTX_CONSTANTS, + DRAW_TES_JIT_CTX_SSBOS = DRAW_JIT_CTX_SSBOS, 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 = 6, - DRAW_TES_JIT_CTX_ANISO_FILTER_TABLE = 7, - DRAW_TES_JIT_CTX_NUM_FIELDS = 8, + DRAW_TES_JIT_CTX_ANISO_FILTER_TABLE = DRAW_JIT_CTX_ANISO_FILTER_TABLE, + DRAW_TES_JIT_CTX_NUM_FIELDS = 6, }; #define draw_tes_jit_context_constants(_variant, _ptr) \ @@ -292,6 +299,15 @@ enum { #define draw_tes_jit_context_ssbos(_variant, _ptr) \ lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TES_JIT_CTX_SSBOS, "ssbos") +#define draw_tes_jit_context_textures(_variant, _ptr) \ + lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TES_JIT_CTX_TEXTURES, "textures") + +#define draw_tes_jit_context_samplers(_variant, _ptr) \ + lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TES_JIT_CTX_SAMPLERS, "samplers") + +#define draw_tes_jit_context_images(_variant, _ptr) \ + lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TES_JIT_CTX_IMAGES, "images") + #define draw_tes_jit_context_aniso_filter_table(_variant, _ptr) \ lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TES_JIT_CTX_ANISO_FILTER_TABLE, "aniso_filter_table") |