mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-20 19:40:24 +01:00
draw: add support for ssbo ptrs to jit tables.
This adds ssbo/num_ssbo ptrs to the vs/gs jit tables. Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
parent
e84570ba70
commit
69ff738eb0
2 changed files with 49 additions and 3 deletions
|
|
@ -234,6 +234,10 @@ create_jit_context_type(struct gallivm_state *gallivm,
|
|||
PIPE_MAX_SHADER_SAMPLER_VIEWS); /* textures */
|
||||
elem_types[5] = LLVMArrayType(sampler_type,
|
||||
PIPE_MAX_SAMPLERS); /* samplers */
|
||||
elem_types[6] = LLVMArrayType(LLVMPointerType(int_type, 0), /* vs_ssbo */
|
||||
LP_MAX_TGSI_SHADER_BUFFERS);
|
||||
elem_types[7] = LLVMArrayType(int_type, /* num_vs_ssbos */
|
||||
LP_MAX_TGSI_SHADER_BUFFERS);
|
||||
context_type = LLVMStructTypeInContext(gallivm->context, elem_types,
|
||||
ARRAY_SIZE(elem_types), 0);
|
||||
|
||||
|
|
@ -252,6 +256,10 @@ create_jit_context_type(struct gallivm_state *gallivm,
|
|||
LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, samplers,
|
||||
target, context_type,
|
||||
DRAW_JIT_CTX_SAMPLERS);
|
||||
LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, vs_ssbos,
|
||||
target, context_type, DRAW_JIT_CTX_SSBOS);
|
||||
LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, num_vs_ssbos,
|
||||
target, context_type, DRAW_JIT_CTX_NUM_SSBOS);
|
||||
LP_CHECK_STRUCT_SIZE(struct draw_jit_context,
|
||||
target, context_type);
|
||||
|
||||
|
|
@ -293,6 +301,10 @@ create_gs_jit_context_type(struct gallivm_state *gallivm,
|
|||
elem_types[8] = LLVMPointerType(LLVMVectorType(int_type,
|
||||
vector_length), 0);
|
||||
|
||||
elem_types[9] = LLVMArrayType(LLVMPointerType(int_type, 0), /* ssbos */
|
||||
LP_MAX_TGSI_SHADER_BUFFERS);
|
||||
elem_types[10] = LLVMArrayType(int_type, /* num_ssbos */
|
||||
LP_MAX_TGSI_SHADER_BUFFERS);
|
||||
context_type = LLVMStructTypeInContext(gallivm->context, elem_types,
|
||||
ARRAY_SIZE(elem_types), 0);
|
||||
|
||||
|
|
@ -320,6 +332,10 @@ 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, num_ssbos,
|
||||
target, context_type, DRAW_GS_JIT_CTX_NUM_SSBOS);
|
||||
LP_CHECK_STRUCT_SIZE(struct draw_gs_jit_context,
|
||||
target, context_type);
|
||||
|
||||
|
|
@ -616,6 +632,10 @@ generate_vs(struct draw_llvm_variant *variant,
|
|||
draw_jit_context_vs_constants(variant->gallivm, context_ptr);
|
||||
LLVMValueRef num_consts_ptr =
|
||||
draw_jit_context_num_vs_constants(variant->gallivm, context_ptr);
|
||||
LLVMValueRef ssbos_ptr =
|
||||
draw_jit_context_vs_ssbos(variant->gallivm, context_ptr);
|
||||
LLVMValueRef num_ssbos_ptr =
|
||||
draw_jit_context_num_vs_ssbos(variant->gallivm, context_ptr);
|
||||
|
||||
lp_build_tgsi_soa(variant->gallivm,
|
||||
tokens,
|
||||
|
|
@ -630,7 +650,7 @@ generate_vs(struct draw_llvm_variant *variant,
|
|||
NULL,
|
||||
draw_sampler,
|
||||
&llvm->draw->vs.vertex_shader->info,
|
||||
NULL, NULL, NULL);
|
||||
NULL, ssbos_ptr, num_ssbos_ptr);
|
||||
|
||||
{
|
||||
LLVMValueRef out;
|
||||
|
|
@ -2254,6 +2274,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
|
|||
struct draw_gs_llvm_iface gs_iface;
|
||||
const struct tgsi_token *tokens = variant->shader->base.state.tokens;
|
||||
LLVMValueRef consts_ptr, num_consts_ptr;
|
||||
LLVMValueRef ssbos_ptr, num_ssbos_ptr;
|
||||
LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][TGSI_NUM_CHANNELS];
|
||||
struct lp_build_mask_context mask;
|
||||
const struct tgsi_shader_info *gs_info = &variant->shader->base.info;
|
||||
|
|
@ -2335,6 +2356,10 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
|
|||
num_consts_ptr =
|
||||
draw_gs_jit_context_num_constants(variant->gallivm, context_ptr);
|
||||
|
||||
ssbos_ptr = draw_gs_jit_context_ssbos(variant->gallivm, context_ptr);
|
||||
num_ssbos_ptr =
|
||||
draw_gs_jit_context_num_ssbos(variant->gallivm, context_ptr);
|
||||
|
||||
/* code generated texture sampling */
|
||||
sampler = draw_llvm_sampler_soa_create(variant->key.samplers);
|
||||
|
||||
|
|
@ -2363,7 +2388,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
|
|||
NULL,
|
||||
sampler,
|
||||
&llvm->draw->gs.geometry_shader->info,
|
||||
(const struct lp_build_tgsi_gs_iface *)&gs_iface, NULL, NULL);
|
||||
(const struct lp_build_tgsi_gs_iface *)&gs_iface, ssbos_ptr, num_ssbos_ptr);
|
||||
|
||||
sampler->destroy(sampler);
|
||||
|
||||
|
|
|
|||
|
|
@ -128,6 +128,9 @@ struct draw_jit_context
|
|||
|
||||
struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
|
||||
struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
|
||||
|
||||
const uint32_t *vs_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
|
||||
int num_vs_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
@ -137,6 +140,8 @@ enum {
|
|||
DRAW_JIT_CTX_VIEWPORT = 3,
|
||||
DRAW_JIT_CTX_TEXTURES = 4,
|
||||
DRAW_JIT_CTX_SAMPLERS = 5,
|
||||
DRAW_JIT_CTX_SSBOS = 6,
|
||||
DRAW_JIT_CTX_NUM_SSBOS = 7,
|
||||
DRAW_JIT_CTX_NUM_FIELDS
|
||||
};
|
||||
|
||||
|
|
@ -158,6 +163,13 @@ enum {
|
|||
#define draw_jit_context_samplers(_gallivm, _ptr) \
|
||||
lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_SAMPLERS, "samplers")
|
||||
|
||||
#define draw_jit_context_vs_ssbos(_gallivm, _ptr) \
|
||||
lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_SSBOS, "vs_ssbos")
|
||||
|
||||
#define draw_jit_context_num_vs_ssbos(_gallivm, _ptr) \
|
||||
lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_NUM_SSBOS, "num_vs_ssbos")
|
||||
|
||||
|
||||
#define draw_jit_header_id(_gallivm, _ptr) \
|
||||
lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_VERTEX_VERTEX_ID, "id")
|
||||
|
||||
|
|
@ -213,6 +225,9 @@ struct draw_gs_jit_context
|
|||
int **prim_lengths;
|
||||
int *emitted_vertices;
|
||||
int *emitted_prims;
|
||||
const uint32_t *ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
|
||||
int num_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
|
||||
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
@ -229,7 +244,9 @@ enum {
|
|||
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_NUM_FIELDS = 9
|
||||
DRAW_GS_JIT_CTX_SSBOS = 9,
|
||||
DRAW_GS_JIT_CTX_NUM_SSBOS = 10,
|
||||
DRAW_GS_JIT_CTX_NUM_FIELDS = 11
|
||||
};
|
||||
|
||||
#define draw_gs_jit_context_constants(_gallivm, _ptr) \
|
||||
|
|
@ -259,7 +276,11 @@ enum {
|
|||
#define draw_gs_jit_emitted_prims(_gallivm, _ptr) \
|
||||
lp_build_struct_get(_gallivm, _ptr, DRAW_GS_JIT_CTX_EMITTED_PRIMS, "emitted_prims")
|
||||
|
||||
#define draw_gs_jit_context_ssbos(_gallivm, _ptr) \
|
||||
lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_GS_JIT_CTX_SSBOS, "ssbos")
|
||||
|
||||
#define draw_gs_jit_context_num_ssbos(_gallivm, _ptr) \
|
||||
lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_GS_JIT_CTX_NUM_SSBOS, "num_ssbos")
|
||||
|
||||
typedef boolean
|
||||
(*draw_jit_vert_func)(struct draw_jit_context *context,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue