llvmpipe: add support for ssbo to the fragment shader jit.

This just adds the ssbo ptrs to the jit fragment shader api.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
Dave Airlie 2019-06-26 15:42:23 +10:00
parent 69ff738eb0
commit e21007f426
3 changed files with 25 additions and 2 deletions

View File

@ -164,7 +164,10 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp)
PIPE_MAX_SHADER_SAMPLER_VIEWS);
elem_types[LP_JIT_CTX_SAMPLERS] = LLVMArrayType(sampler_type,
PIPE_MAX_SAMPLERS);
elem_types[LP_JIT_CTX_SSBOS] =
LLVMArrayType(LLVMPointerType(LLVMInt32TypeInContext(lc), 0), LP_MAX_TGSI_SHADER_BUFFERS);
elem_types[LP_JIT_CTX_NUM_SSBOS] =
LLVMArrayType(LLVMInt32TypeInContext(lc), LP_MAX_TGSI_SHADER_BUFFERS);
context_type = LLVMStructTypeInContext(lc, elem_types,
ARRAY_SIZE(elem_types), 0);
@ -198,6 +201,12 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp)
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, samplers,
gallivm->target, context_type,
LP_JIT_CTX_SAMPLERS);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, ssbos,
gallivm->target, context_type,
LP_JIT_CTX_SSBOS);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, num_ssbos,
gallivm->target, context_type,
LP_JIT_CTX_NUM_SSBOS);
LP_CHECK_STRUCT_SIZE(struct lp_jit_context,
gallivm->target, context_type);

View File

@ -135,6 +135,9 @@ struct lp_jit_context
struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
struct lp_jit_sampler samplers[PIPE_MAX_SAMPLERS];
const uint32_t *ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
int num_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
};
@ -153,6 +156,8 @@ enum {
LP_JIT_CTX_VIEWPORTS,
LP_JIT_CTX_TEXTURES,
LP_JIT_CTX_SAMPLERS,
LP_JIT_CTX_SSBOS,
LP_JIT_CTX_NUM_SSBOS,
LP_JIT_CTX_COUNT
};
@ -187,6 +192,11 @@ enum {
#define lp_jit_context_samplers(_gallivm, _ptr) \
lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_SAMPLERS, "samplers")
#define lp_jit_context_ssbos(_gallivm, _ptr) \
lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_SSBOS, "ssbos")
#define lp_jit_context_num_ssbos(_gallivm, _ptr) \
lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_NUM_SSBOS, "num_ssbos")
struct lp_jit_thread_data
{

View File

@ -313,6 +313,7 @@ generate_fs_loop(struct gallivm_state *gallivm,
LLVMTypeRef vec_type, int_vec_type;
LLVMValueRef mask_ptr, mask_val;
LLVMValueRef consts_ptr, num_consts_ptr;
LLVMValueRef ssbo_ptr, num_ssbo_ptr;
LLVMValueRef z;
LLVMValueRef z_value, s_value;
LLVMValueRef z_fb, s_fb;
@ -392,6 +393,9 @@ generate_fs_loop(struct gallivm_state *gallivm,
consts_ptr = lp_jit_context_constants(gallivm, context_ptr);
num_consts_ptr = lp_jit_context_num_constants(gallivm, context_ptr);
ssbo_ptr = lp_jit_context_ssbos(gallivm, context_ptr);
num_ssbo_ptr = lp_jit_context_num_ssbos(gallivm, context_ptr);
lp_build_for_loop_begin(&loop_state, gallivm,
lp_build_const_int32(gallivm, 0),
LLVMIntULT,
@ -479,7 +483,7 @@ generate_fs_loop(struct gallivm_state *gallivm,
consts_ptr, num_consts_ptr, &system_values,
interp->inputs,
outputs, context_ptr, thread_data_ptr,
sampler, &shader->info.base, NULL, NULL, NULL);
sampler, &shader->info.base, NULL, ssbo_ptr, num_ssbo_ptr);
/* Alpha test */
if (key->alpha.enabled) {