mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-25 09:20:30 +01:00
llvmpipe: add filter table shader accessor
Reviewed-by: Roland Scheidegger <sroland@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8804>
This commit is contained in:
parent
4366a77dae
commit
a672f9ebf0
5 changed files with 26 additions and 1 deletions
|
|
@ -232,6 +232,7 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp)
|
|||
elem_types[LP_JIT_CTX_U8_BLEND_COLOR] = LLVMPointerType(LLVMInt8TypeInContext(lc), 0);
|
||||
elem_types[LP_JIT_CTX_F_BLEND_COLOR] = LLVMPointerType(LLVMFloatTypeInContext(lc), 0);
|
||||
elem_types[LP_JIT_CTX_VIEWPORTS] = LLVMPointerType(viewport_type, 0);
|
||||
elem_types[LP_JIT_CTX_ANISO_FILTER_TABLE] = LLVMPointerType(LLVMFloatTypeInContext(lc), 0);
|
||||
elem_types[LP_JIT_CTX_SSBOS] =
|
||||
LLVMArrayType(LLVMPointerType(LLVMInt32TypeInContext(lc), 0), LP_MAX_TGSI_SHADER_BUFFERS);
|
||||
elem_types[LP_JIT_CTX_NUM_SSBOS] =
|
||||
|
|
@ -281,6 +282,9 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp)
|
|||
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, sample_mask,
|
||||
gallivm->target, context_type,
|
||||
LP_JIT_CTX_SAMPLE_MASK);
|
||||
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, aniso_filter_table,
|
||||
gallivm->target, context_type,
|
||||
LP_JIT_CTX_ANISO_FILTER_TABLE);
|
||||
LP_CHECK_STRUCT_SIZE(struct lp_jit_context,
|
||||
gallivm->target, context_type);
|
||||
|
||||
|
|
@ -385,6 +389,8 @@ lp_jit_create_cs_types(struct lp_compute_shader_variant *lp)
|
|||
|
||||
elem_types[LP_JIT_CS_CTX_KERNEL_ARGS] = LLVMPointerType(LLVMInt8TypeInContext(lc), 0);
|
||||
|
||||
elem_types[LP_JIT_CS_CTX_ANISO_FILTER_TABLE] = LLVMPointerType(LLVMFloatTypeInContext(lc), 0);
|
||||
|
||||
cs_context_type = LLVMStructTypeInContext(lc, elem_types,
|
||||
ARRAY_SIZE(elem_types), 0);
|
||||
|
||||
|
|
@ -415,6 +421,9 @@ lp_jit_create_cs_types(struct lp_compute_shader_variant *lp)
|
|||
LP_CHECK_MEMBER_OFFSET(struct lp_jit_cs_context, kernel_args,
|
||||
gallivm->target, cs_context_type,
|
||||
LP_JIT_CS_CTX_KERNEL_ARGS);
|
||||
LP_CHECK_MEMBER_OFFSET(struct lp_jit_cs_context, aniso_filter_table,
|
||||
gallivm->target, cs_context_type,
|
||||
LP_JIT_CS_CTX_ANISO_FILTER_TABLE);
|
||||
LP_CHECK_STRUCT_SIZE(struct lp_jit_cs_context,
|
||||
gallivm->target, cs_context_type);
|
||||
|
||||
|
|
|
|||
|
|
@ -168,6 +168,8 @@ struct lp_jit_context
|
|||
int num_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
|
||||
|
||||
uint32_t sample_mask;
|
||||
|
||||
const float *aniso_filter_table;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -190,6 +192,7 @@ enum {
|
|||
LP_JIT_CTX_SSBOS,
|
||||
LP_JIT_CTX_NUM_SSBOS,
|
||||
LP_JIT_CTX_SAMPLE_MASK,
|
||||
LP_JIT_CTX_ANISO_FILTER_TABLE,
|
||||
LP_JIT_CTX_COUNT
|
||||
};
|
||||
|
||||
|
|
@ -236,6 +239,9 @@ enum {
|
|||
#define lp_jit_context_sample_mask(_gallivm, _ptr) \
|
||||
lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_SAMPLE_MASK, "sample_mask")
|
||||
|
||||
#define lp_jit_context_aniso_filter_table(_gallivm, _ptr) \
|
||||
lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_ANISO_FILTER_TABLE, "aniso_filter_table")
|
||||
|
||||
struct lp_jit_thread_data
|
||||
{
|
||||
struct lp_build_format_cache *cache;
|
||||
|
|
@ -350,6 +356,8 @@ struct lp_jit_cs_context
|
|||
void *kernel_args;
|
||||
|
||||
uint32_t shared_size;
|
||||
|
||||
const float *aniso_filter_table;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -366,6 +374,7 @@ enum {
|
|||
LP_JIT_CS_CTX_NUM_SSBOS,
|
||||
LP_JIT_CS_CTX_KERNEL_ARGS,
|
||||
LP_JIT_CS_CTX_SHARED_SIZE,
|
||||
LP_JIT_CS_CTX_ANISO_FILTER_TABLE,
|
||||
LP_JIT_CS_CTX_COUNT
|
||||
};
|
||||
|
||||
|
|
@ -396,6 +405,9 @@ enum {
|
|||
#define lp_jit_cs_context_kernel_args(_gallivm, _ptr) \
|
||||
lp_build_struct_get(_gallivm, _ptr, LP_JIT_CS_CTX_KERNEL_ARGS, "kernel_args")
|
||||
|
||||
#define lp_jit_cs_context_aniso_filter_table(_gallivm, _ptr) \
|
||||
lp_build_struct_get(_gallivm, _ptr, LP_JIT_CS_CTX_ANISO_FILTER_TABLE, "aniso_filter_table")
|
||||
|
||||
|
||||
typedef void
|
||||
(*lp_jit_cs_func)(const struct lp_jit_cs_context *context,
|
||||
|
|
|
|||
|
|
@ -1293,6 +1293,7 @@ try_update_scene_state( struct lp_setup_context *setup )
|
|||
memcpy(&stored->jit_context,
|
||||
&setup->fs.current.jit_context,
|
||||
sizeof setup->fs.current.jit_context);
|
||||
stored->jit_context.aniso_filter_table = lp_build_sample_aniso_filter_table();
|
||||
stored->variant = setup->fs.current.variant;
|
||||
|
||||
if (!lp_scene_add_frag_shader_reference(scene,
|
||||
|
|
|
|||
|
|
@ -404,6 +404,7 @@ generate_compute(struct llvmpipe_context *lp,
|
|||
params.shared_ptr = shared_ptr;
|
||||
params.coro = &coro_info;
|
||||
params.kernel_args = kernel_args_ptr;
|
||||
params.aniso_filter_table = lp_jit_cs_context_aniso_filter_table(gallivm, context_ptr);
|
||||
|
||||
if (shader->base.type == PIPE_SHADER_IR_TGSI)
|
||||
lp_build_tgsi_soa(gallivm, shader->base.tokens, ¶ms, NULL);
|
||||
|
|
@ -1252,8 +1253,9 @@ llvmpipe_cs_update_derived(struct llvmpipe_context *llvmpipe, void *input)
|
|||
ARRAY_SIZE(llvmpipe->images[PIPE_SHADER_COMPUTE]),
|
||||
llvmpipe->images[PIPE_SHADER_COMPUTE]);
|
||||
|
||||
struct lp_cs_context *csctx = llvmpipe->csctx;
|
||||
csctx->cs.current.jit_context.aniso_filter_table = lp_build_sample_aniso_filter_table();
|
||||
if (input) {
|
||||
struct lp_cs_context *csctx = llvmpipe->csctx;
|
||||
csctx->input = input;
|
||||
csctx->cs.current.jit_context.kernel_args = input;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -959,6 +959,7 @@ generate_fs_loop(struct gallivm_state *gallivm,
|
|||
params.ssbo_ptr = ssbo_ptr;
|
||||
params.ssbo_sizes_ptr = num_ssbo_ptr;
|
||||
params.image = image;
|
||||
params.aniso_filter_table = lp_jit_context_aniso_filter_table(gallivm, context_ptr);
|
||||
|
||||
/* Build the actual shader */
|
||||
if (shader->base.type == PIPE_SHADER_IR_TGSI)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue