mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-07 12:10:39 +02:00
gallivm/llvmpipe: add opaque pointers support to sampler
This adds explicit context types wiring through the sampler code Reviewed-by: Mihai Preda <mhpreda@gmail.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18947>
This commit is contained in:
parent
3d242c0447
commit
9fe8e5ccf7
12 changed files with 148 additions and 40 deletions
|
|
@ -965,6 +965,7 @@ generate_vs(struct draw_llvm_variant *variant,
|
|||
params.consts_ptr = consts_ptr;
|
||||
params.system_values = system_values;
|
||||
params.inputs = inputs;
|
||||
params.context_type = variant->context_type;
|
||||
params.context_ptr = context_ptr;
|
||||
params.sampler = draw_sampler;
|
||||
params.info = &llvm->draw->vs.vertex_shader->info;
|
||||
|
|
@ -2872,6 +2873,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
|
|||
params.mask = &mask;
|
||||
params.consts_ptr = consts_ptr;
|
||||
params.system_values = &system_values;
|
||||
params.context_type = variant->context_type;
|
||||
params.context_ptr = context_ptr;
|
||||
params.sampler = sampler;
|
||||
params.info = &llvm->draw->gs.geometry_shader->info;
|
||||
|
|
@ -3533,6 +3535,7 @@ draw_tcs_llvm_generate(struct draw_llvm *llvm,
|
|||
params.mask = &mask;
|
||||
params.consts_ptr = consts_ptr;
|
||||
params.system_values = &system_values;
|
||||
params.context_type = variant->context_type;
|
||||
params.context_ptr = context_ptr;
|
||||
params.sampler = sampler;
|
||||
params.info = &llvm->draw->tcs.tess_ctrl_shader->info;
|
||||
|
|
@ -4062,6 +4065,7 @@ draw_tes_llvm_generate(struct draw_llvm *llvm,
|
|||
params.mask = &mask;
|
||||
params.consts_ptr = consts_ptr;
|
||||
params.system_values = &system_values;
|
||||
params.context_type = variant->context_type;
|
||||
params.context_ptr = context_ptr;
|
||||
params.sampler = sampler;
|
||||
params.info = &llvm->draw->tes.tess_eval_shader->info;
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ struct draw_llvm_image_soa
|
|||
*/
|
||||
static LLVMValueRef
|
||||
draw_llvm_texture_member(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned texture_unit,
|
||||
LLVMValueRef texture_unit_offset,
|
||||
|
|
@ -128,7 +129,7 @@ draw_llvm_texture_member(struct gallivm_state *gallivm,
|
|||
/* context[0].textures[unit].member */
|
||||
indices[3] = lp_build_const_int32(gallivm, member_index);
|
||||
|
||||
ptr = LLVMBuildGEP(builder, context_ptr, indices, ARRAY_SIZE(indices), "");
|
||||
ptr = LLVMBuildGEP2(builder, context_type, context_ptr, indices, ARRAY_SIZE(indices), "");
|
||||
|
||||
if (emit_load)
|
||||
res = LLVMBuildLoad(builder, ptr, "");
|
||||
|
|
@ -151,6 +152,7 @@ draw_llvm_texture_member(struct gallivm_state *gallivm,
|
|||
*/
|
||||
static LLVMValueRef
|
||||
draw_llvm_sampler_member(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned sampler_unit,
|
||||
unsigned member_index,
|
||||
|
|
@ -173,7 +175,7 @@ draw_llvm_sampler_member(struct gallivm_state *gallivm,
|
|||
/* context[0].samplers[unit].member */
|
||||
indices[3] = lp_build_const_int32(gallivm, member_index);
|
||||
|
||||
ptr = LLVMBuildGEP(builder, context_ptr, indices, ARRAY_SIZE(indices), "");
|
||||
ptr = LLVMBuildGEP2(builder, context_type, context_ptr, indices, ARRAY_SIZE(indices), "");
|
||||
|
||||
if (emit_load)
|
||||
res = LLVMBuildLoad(builder, ptr, "");
|
||||
|
|
@ -195,6 +197,7 @@ draw_llvm_sampler_member(struct gallivm_state *gallivm,
|
|||
*/
|
||||
static LLVMValueRef
|
||||
draw_llvm_image_member(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned image_unit,
|
||||
LLVMValueRef image_unit_offset,
|
||||
|
|
@ -223,7 +226,7 @@ draw_llvm_image_member(struct gallivm_state *gallivm,
|
|||
/* context[0].textures[unit].member */
|
||||
indices[3] = lp_build_const_int32(gallivm, member_index);
|
||||
|
||||
ptr = LLVMBuildGEP(builder, context_ptr, indices, ARRAY_SIZE(indices), "");
|
||||
ptr = LLVMBuildGEP2(builder, context_type, context_ptr, indices, ARRAY_SIZE(indices), "");
|
||||
|
||||
if (emit_load)
|
||||
res = LLVMBuildLoad(builder, ptr, "");
|
||||
|
|
@ -247,11 +250,12 @@ draw_llvm_image_member(struct gallivm_state *gallivm,
|
|||
#define DRAW_LLVM_TEXTURE_MEMBER(_name, _index, _emit_load) \
|
||||
static LLVMValueRef \
|
||||
draw_llvm_texture_##_name( struct gallivm_state *gallivm, \
|
||||
LLVMTypeRef context_type, \
|
||||
LLVMValueRef context_ptr, \
|
||||
unsigned texture_unit, \
|
||||
LLVMValueRef texture_unit_offset) \
|
||||
{ \
|
||||
return draw_llvm_texture_member(gallivm, context_ptr, \
|
||||
return draw_llvm_texture_member(gallivm, context_type, context_ptr, \
|
||||
texture_unit, texture_unit_offset, \
|
||||
_index, #_name, _emit_load ); \
|
||||
}
|
||||
|
|
@ -272,10 +276,11 @@ DRAW_LLVM_TEXTURE_MEMBER(sample_stride, DRAW_JIT_TEXTURE_SAMPLE_STRIDE, TRUE)
|
|||
#define DRAW_LLVM_SAMPLER_MEMBER(_name, _index, _emit_load) \
|
||||
static LLVMValueRef \
|
||||
draw_llvm_sampler_##_name( struct gallivm_state *gallivm, \
|
||||
LLVMTypeRef context_type, \
|
||||
LLVMValueRef context_ptr, \
|
||||
unsigned sampler_unit) \
|
||||
{ \
|
||||
return draw_llvm_sampler_member(gallivm, context_ptr, \
|
||||
return draw_llvm_sampler_member(gallivm, context_type, context_ptr, \
|
||||
sampler_unit, _index, #_name, _emit_load ); \
|
||||
}
|
||||
|
||||
|
|
@ -289,10 +294,11 @@ DRAW_LLVM_SAMPLER_MEMBER(max_aniso, DRAW_JIT_SAMPLER_MAX_ANISO, TRUE)
|
|||
#define DRAW_LLVM_IMAGE_MEMBER(_name, _index, _emit_load) \
|
||||
static LLVMValueRef \
|
||||
draw_llvm_image_##_name( struct gallivm_state *gallivm, \
|
||||
LLVMTypeRef context_type, \
|
||||
LLVMValueRef context_ptr, \
|
||||
unsigned image_unit, LLVMValueRef image_unit_offset) \
|
||||
{ \
|
||||
return draw_llvm_image_member(gallivm, context_ptr, \
|
||||
return draw_llvm_image_member(gallivm, context_type, context_ptr, \
|
||||
image_unit, image_unit_offset, \
|
||||
_index, #_name, _emit_load ); \
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,7 +246,9 @@ struct lp_build_nir_soa_context
|
|||
LLVMValueRef consts_sizes[LP_MAX_TGSI_CONST_BUFFERS];
|
||||
const LLVMValueRef (*inputs)[TGSI_NUM_CHANNELS];
|
||||
LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS];
|
||||
LLVMTypeRef context_type;
|
||||
LLVMValueRef context_ptr;
|
||||
LLVMTypeRef thread_data_type;
|
||||
LLVMValueRef thread_data_ptr;
|
||||
|
||||
LLVMValueRef ssbo_ptr;
|
||||
|
|
|
|||
|
|
@ -1613,7 +1613,9 @@ static void emit_image_op(struct lp_build_nir_context *bld_base,
|
|||
struct gallivm_state *gallivm = bld_base->base.gallivm;
|
||||
|
||||
params->type = bld_base->base.type;
|
||||
params->context_type = bld->context_type;
|
||||
params->context_ptr = bld->context_ptr;
|
||||
params->thread_data_type = bld->thread_data_type;
|
||||
params->thread_data_ptr = bld->thread_data_ptr;
|
||||
params->exec_mask = mask_vec(bld_base);
|
||||
|
||||
|
|
@ -1634,6 +1636,7 @@ static void emit_image_size(struct lp_build_nir_context *bld_base,
|
|||
struct gallivm_state *gallivm = bld_base->base.gallivm;
|
||||
|
||||
params->int_type = bld_base->int_bld.type;
|
||||
params->context_type = bld->context_type;
|
||||
params->context_ptr = bld->context_ptr;
|
||||
|
||||
if (params->texture_unit_offset)
|
||||
|
|
@ -1691,7 +1694,9 @@ static void emit_tex(struct lp_build_nir_context *bld_base,
|
|||
LLVMBuilderRef builder = bld_base->base.gallivm->builder;
|
||||
|
||||
params->type = bld_base->base.type;
|
||||
params->context_type = bld->context_type;
|
||||
params->context_ptr = bld->context_ptr;
|
||||
params->thread_data_type = bld->thread_data_type;
|
||||
params->thread_data_ptr = bld->thread_data_ptr;
|
||||
|
||||
if (params->texture_index_offset && bld_base->shader->info.stage != MESA_SHADER_FRAGMENT) {
|
||||
|
|
@ -1774,6 +1779,7 @@ static void emit_tex_size(struct lp_build_nir_context *bld_base,
|
|||
struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base;
|
||||
|
||||
params->int_type = bld_base->int_bld.type;
|
||||
params->context_type = bld->context_type;
|
||||
params->context_ptr = bld->context_ptr;
|
||||
|
||||
if (params->texture_unit_offset)
|
||||
|
|
@ -2847,7 +2853,9 @@ void lp_build_nir_soa(struct gallivm_state *gallivm,
|
|||
bld.sampler = params->sampler;
|
||||
// bld.bld_base.info = params->info;
|
||||
|
||||
bld.context_type = params->context_type;
|
||||
bld.context_ptr = params->context_ptr;
|
||||
bld.thread_data_type = params->thread_data_type;
|
||||
bld.thread_data_ptr = params->thread_data_ptr;
|
||||
bld.bld_base.aniso_filter_table = params->aniso_filter_table;
|
||||
bld.image = params->image;
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ lp_build_pmin(struct lp_build_sample_context *bld,
|
|||
boolean pmin_per_quad = pmin_bld->type.length != length;
|
||||
unsigned i;
|
||||
|
||||
first_level = bld->dynamic_state->first_level(bld->gallivm,
|
||||
first_level = bld->dynamic_state->first_level(bld->gallivm, bld->context_type,
|
||||
bld->context_ptr, texture_unit, NULL);
|
||||
first_level_vec = lp_build_broadcast_scalar(int_size_bld, first_level);
|
||||
int_size = lp_build_minify(int_size_bld, bld->int_size, first_level_vec, TRUE);
|
||||
|
|
@ -376,7 +376,7 @@ lp_build_rho(struct lp_build_sample_context *bld,
|
|||
* the messy cube maps for now) when requested.
|
||||
*/
|
||||
|
||||
first_level = bld->dynamic_state->first_level(bld->gallivm,
|
||||
first_level = bld->dynamic_state->first_level(bld->gallivm, bld->context_type,
|
||||
bld->context_ptr, texture_unit, NULL);
|
||||
first_level_vec = lp_build_broadcast_scalar(int_size_bld, first_level);
|
||||
int_size = lp_build_minify(int_size_bld, bld->int_size, first_level_vec, TRUE);
|
||||
|
|
@ -854,7 +854,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
|
|||
* This is hit during mipmap generation.
|
||||
*/
|
||||
LLVMValueRef min_lod =
|
||||
dynamic_state->min_lod(bld->gallivm,
|
||||
dynamic_state->min_lod(bld->gallivm, bld->context_type,
|
||||
bld->context_ptr, sampler_unit);
|
||||
|
||||
lod = lp_build_broadcast_scalar(lodf_bld, min_lod);
|
||||
|
|
@ -952,7 +952,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
|
|||
/* add sampler lod bias */
|
||||
if (bld->static_sampler_state->lod_bias_non_zero) {
|
||||
LLVMValueRef sampler_lod_bias =
|
||||
dynamic_state->lod_bias(bld->gallivm,
|
||||
dynamic_state->lod_bias(bld->gallivm, bld->context_type,
|
||||
bld->context_ptr, sampler_unit);
|
||||
sampler_lod_bias = lp_build_broadcast_scalar(lodf_bld,
|
||||
sampler_lod_bias);
|
||||
|
|
@ -966,7 +966,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
|
|||
/* clamp lod */
|
||||
if (bld->static_sampler_state->apply_max_lod) {
|
||||
LLVMValueRef max_lod =
|
||||
dynamic_state->max_lod(bld->gallivm,
|
||||
dynamic_state->max_lod(bld->gallivm, bld->context_type,
|
||||
bld->context_ptr, sampler_unit);
|
||||
max_lod = lp_build_broadcast_scalar(lodf_bld, max_lod);
|
||||
|
||||
|
|
@ -974,7 +974,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
|
|||
}
|
||||
if (bld->static_sampler_state->apply_min_lod) {
|
||||
LLVMValueRef min_lod =
|
||||
dynamic_state->min_lod(bld->gallivm,
|
||||
dynamic_state->min_lod(bld->gallivm, bld->context_type,
|
||||
bld->context_ptr, sampler_unit);
|
||||
min_lod = lp_build_broadcast_scalar(lodf_bld, min_lod);
|
||||
|
||||
|
|
@ -1032,9 +1032,9 @@ lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
|
|||
struct lp_sampler_dynamic_state *dynamic_state = bld->dynamic_state;
|
||||
LLVMValueRef first_level, last_level, level;
|
||||
|
||||
first_level = dynamic_state->first_level(bld->gallivm,
|
||||
first_level = dynamic_state->first_level(bld->gallivm, bld->context_type,
|
||||
bld->context_ptr, texture_unit, NULL);
|
||||
last_level = dynamic_state->last_level(bld->gallivm,
|
||||
last_level = dynamic_state->last_level(bld->gallivm, bld->context_type,
|
||||
bld->context_ptr, texture_unit, NULL);
|
||||
first_level = lp_build_broadcast_scalar(leveli_bld, first_level);
|
||||
last_level = lp_build_broadcast_scalar(leveli_bld, last_level);
|
||||
|
|
@ -1094,9 +1094,9 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
|
|||
|
||||
assert(bld->num_lods == bld->num_mips);
|
||||
|
||||
first_level = dynamic_state->first_level(bld->gallivm,
|
||||
first_level = dynamic_state->first_level(bld->gallivm, bld->context_type,
|
||||
bld->context_ptr, texture_unit, NULL);
|
||||
last_level = dynamic_state->last_level(bld->gallivm,
|
||||
last_level = dynamic_state->last_level(bld->gallivm, bld->context_type,
|
||||
bld->context_ptr, texture_unit, NULL);
|
||||
first_level = lp_build_broadcast_scalar(leveli_bld, first_level);
|
||||
last_level = lp_build_broadcast_scalar(leveli_bld, last_level);
|
||||
|
|
|
|||
|
|
@ -109,7 +109,9 @@ struct lp_sampler_params
|
|||
unsigned sampler_index;
|
||||
LLVMValueRef texture_index_offset;
|
||||
unsigned sample_key;
|
||||
LLVMTypeRef context_type;
|
||||
LLVMValueRef context_ptr;
|
||||
LLVMTypeRef thread_data_type;
|
||||
LLVMValueRef thread_data_ptr;
|
||||
const LLVMValueRef *coords;
|
||||
const LLVMValueRef *offsets;
|
||||
|
|
@ -127,6 +129,7 @@ struct lp_sampler_size_query_params
|
|||
unsigned texture_unit;
|
||||
LLVMValueRef texture_unit_offset;
|
||||
unsigned target;
|
||||
LLVMTypeRef context_type;
|
||||
LLVMValueRef context_ptr;
|
||||
boolean is_sviewinfo;
|
||||
bool samples_only;
|
||||
|
|
@ -149,7 +152,9 @@ struct lp_img_params
|
|||
unsigned target;
|
||||
LLVMAtomicRMWBinOp op;
|
||||
LLVMValueRef exec_mask;
|
||||
LLVMTypeRef context_type;
|
||||
LLVMValueRef context_ptr;
|
||||
LLVMTypeRef thread_data_type;
|
||||
LLVMValueRef thread_data_ptr;
|
||||
const LLVMValueRef *coords;
|
||||
LLVMValueRef ms_index;
|
||||
|
|
@ -230,66 +235,77 @@ struct lp_sampler_dynamic_state
|
|||
/** Obtain the base texture width (or number of elements) (returns int32) */
|
||||
LLVMValueRef
|
||||
(*width)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned texture_unit, LLVMValueRef texture_unit_offset);
|
||||
|
||||
/** Obtain the base texture height (returns int32) */
|
||||
LLVMValueRef
|
||||
(*height)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned texture_unit, LLVMValueRef texture_unit_offset);
|
||||
|
||||
/** Obtain the base texture depth (or array size) (returns int32) */
|
||||
LLVMValueRef
|
||||
(*depth)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned texture_unit, LLVMValueRef texture_unit_offset);
|
||||
|
||||
/** Obtain the first mipmap level (base level) (returns int32) */
|
||||
LLVMValueRef
|
||||
(*first_level)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned texture_unit, LLVMValueRef texture_unit_offset);
|
||||
|
||||
/** Obtain the number of mipmap levels minus one (returns int32) */
|
||||
LLVMValueRef
|
||||
(*last_level)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned texture_unit, LLVMValueRef texture_unit_offset);
|
||||
|
||||
/** Obtain stride in bytes between image rows/blocks (returns int32) */
|
||||
LLVMValueRef
|
||||
(*row_stride)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned texture_unit, LLVMValueRef texture_unit_offset);
|
||||
|
||||
/** Obtain stride in bytes between image slices (returns int32) */
|
||||
LLVMValueRef
|
||||
(*img_stride)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned texture_unit, LLVMValueRef texture_unit_offset);
|
||||
|
||||
/** Obtain pointer to base of texture */
|
||||
LLVMValueRef
|
||||
(*base_ptr)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned texture_unit, LLVMValueRef texture_unit_offset);
|
||||
|
||||
/** Obtain pointer to array of mipmap offsets */
|
||||
LLVMValueRef
|
||||
(*mip_offsets)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned texture_unit, LLVMValueRef texture_unit_offset);
|
||||
|
||||
/** Obtain number of samples (returns int32) */
|
||||
LLVMValueRef
|
||||
(*num_samples)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned texture_unit, LLVMValueRef texture_unit_offset);
|
||||
|
||||
/** Obtain multisample stride (returns int32) */
|
||||
LLVMValueRef
|
||||
(*sample_stride)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned texture_unit, LLVMValueRef texture_unit_offset);
|
||||
|
||||
|
|
@ -298,30 +314,35 @@ struct lp_sampler_dynamic_state
|
|||
/** Obtain texture min lod (returns float) */
|
||||
LLVMValueRef
|
||||
(*min_lod)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned sampler_unit);
|
||||
|
||||
/** Obtain texture max lod (returns float) */
|
||||
LLVMValueRef
|
||||
(*max_lod)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned sampler_unit);
|
||||
|
||||
/** Obtain texture lod bias (returns float) */
|
||||
LLVMValueRef
|
||||
(*lod_bias)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned sampler_unit);
|
||||
|
||||
/** Obtain texture border color (returns ptr to float[4]) */
|
||||
LLVMValueRef
|
||||
(*border_color)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned sampler_unit);
|
||||
|
||||
/** Obtain maximum anisotropy */
|
||||
LLVMValueRef
|
||||
(*max_aniso)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned sampler_unit);
|
||||
|
||||
|
|
@ -332,6 +353,7 @@ struct lp_sampler_dynamic_state
|
|||
*/
|
||||
LLVMValueRef
|
||||
(*cache_ptr)(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef thread_data_type,
|
||||
LLVMValueRef thread_data_ptr,
|
||||
unsigned unit);
|
||||
};
|
||||
|
|
@ -440,6 +462,7 @@ struct lp_build_sample_context
|
|||
|
||||
LLVMValueRef border_color_clamped;
|
||||
|
||||
LLVMTypeRef context_type;
|
||||
LLVMValueRef context_ptr;
|
||||
|
||||
LLVMValueRef aniso_filter_table;
|
||||
|
|
|
|||
|
|
@ -2046,7 +2046,7 @@ lp_build_layer_coord(struct lp_build_sample_context *bld,
|
|||
LLVMValueRef num_layers;
|
||||
struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
|
||||
|
||||
num_layers = bld->dynamic_state->depth(bld->gallivm,
|
||||
num_layers = bld->dynamic_state->depth(bld->gallivm, bld->context_type,
|
||||
bld->context_ptr, texture_unit, NULL);
|
||||
|
||||
if (out_of_bounds) {
|
||||
|
|
@ -2611,6 +2611,7 @@ lp_build_sample_common(struct lp_build_sample_context *bld,
|
|||
|
||||
if (aniso)
|
||||
max_aniso = bld->dynamic_state->max_aniso(bld->gallivm,
|
||||
bld->context_type,
|
||||
bld->context_ptr,
|
||||
sampler_index);
|
||||
|
||||
|
|
@ -2625,9 +2626,11 @@ lp_build_sample_common(struct lp_build_sample_context *bld,
|
|||
if (is_lodq) {
|
||||
LLVMValueRef last_level;
|
||||
last_level = bld->dynamic_state->last_level(bld->gallivm,
|
||||
bld->context_type,
|
||||
bld->context_ptr,
|
||||
texture_index, NULL);
|
||||
first_level = bld->dynamic_state->first_level(bld->gallivm,
|
||||
bld->context_type,
|
||||
bld->context_ptr,
|
||||
texture_index, NULL);
|
||||
last_level = lp_build_sub(&bld->int_bld, last_level, first_level);
|
||||
|
|
@ -2674,7 +2677,9 @@ lp_build_sample_common(struct lp_build_sample_context *bld,
|
|||
unreachable("Bad mip_filter value in lp_build_sample_soa()");
|
||||
case PIPE_TEX_MIPFILTER_NONE:
|
||||
/* always use mip level 0 */
|
||||
first_level = bld->dynamic_state->first_level(bld->gallivm, bld->context_ptr,
|
||||
first_level = bld->dynamic_state->first_level(bld->gallivm,
|
||||
bld->context_type,
|
||||
bld->context_ptr,
|
||||
texture_index, NULL);
|
||||
first_level = lp_build_broadcast_scalar(&bld->leveli_bld, first_level);
|
||||
*ilevel0 = first_level;
|
||||
|
|
@ -2702,6 +2707,7 @@ lp_build_clamp_border_color(struct lp_build_sample_context *bld,
|
|||
LLVMBuilderRef builder = gallivm->builder;
|
||||
LLVMValueRef border_color_ptr =
|
||||
bld->dynamic_state->border_color(gallivm,
|
||||
bld->context_type,
|
||||
bld->context_ptr, sampler_unit);
|
||||
LLVMValueRef border_color;
|
||||
const struct util_format_description *format_desc = bld->format_desc;
|
||||
|
|
@ -3128,6 +3134,7 @@ lp_build_fetch_texel(struct lp_build_sample_context *bld,
|
|||
assert(bld->num_mips == 1);
|
||||
if (bld->static_texture_state->target != PIPE_BUFFER) {
|
||||
ilevel = bld->dynamic_state->first_level(bld->gallivm,
|
||||
bld->context_type,
|
||||
bld->context_ptr, texture_unit, NULL);
|
||||
}
|
||||
else {
|
||||
|
|
@ -3197,6 +3204,7 @@ lp_build_fetch_texel(struct lp_build_sample_context *bld,
|
|||
if (bld->fetch_ms) {
|
||||
LLVMValueRef num_samples;
|
||||
num_samples = bld->dynamic_state->num_samples(bld->gallivm,
|
||||
bld->context_type,
|
||||
bld->context_ptr, texture_unit, NULL);
|
||||
out1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, ms_index, int_coord_bld->zero);
|
||||
out_of_bounds = lp_build_or(int_coord_bld, out_of_bounds, out1);
|
||||
|
|
@ -3295,7 +3303,9 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm,
|
|||
unsigned sample_key,
|
||||
unsigned texture_index,
|
||||
unsigned sampler_index,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
LLVMTypeRef thread_data_type,
|
||||
LLVMValueRef thread_data_ptr,
|
||||
const LLVMValueRef *coords,
|
||||
const LLVMValueRef *offsets,
|
||||
|
|
@ -3376,6 +3386,7 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm,
|
|||
/* Setup our build context */
|
||||
memset(&bld, 0, sizeof bld);
|
||||
bld.gallivm = gallivm;
|
||||
bld.context_type = context_type;
|
||||
bld.context_ptr = context_ptr;
|
||||
bld.aniso_filter_table = aniso_filter_table;
|
||||
bld.static_sampler_state = &derived_sampler_state;
|
||||
|
|
@ -3559,22 +3570,23 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm,
|
|||
lp_build_context_init(&bld.lodi_bld, gallivm, bld.lodi_type);
|
||||
|
||||
/* Get the dynamic state */
|
||||
LLVMValueRef tex_width = dynamic_state->width(gallivm,
|
||||
LLVMValueRef tex_width = dynamic_state->width(gallivm, context_type,
|
||||
context_ptr, texture_index,
|
||||
NULL);
|
||||
bld.row_stride_array = dynamic_state->row_stride(gallivm,
|
||||
bld.row_stride_array = dynamic_state->row_stride(gallivm, context_type,
|
||||
context_ptr, texture_index, NULL);
|
||||
bld.img_stride_array = dynamic_state->img_stride(gallivm,
|
||||
bld.img_stride_array = dynamic_state->img_stride(gallivm, context_type,
|
||||
context_ptr, texture_index, NULL);
|
||||
bld.base_ptr = dynamic_state->base_ptr(gallivm,
|
||||
bld.base_ptr = dynamic_state->base_ptr(gallivm, context_type,
|
||||
context_ptr, texture_index, NULL);
|
||||
bld.mip_offsets = dynamic_state->mip_offsets(gallivm,
|
||||
bld.mip_offsets = dynamic_state->mip_offsets(gallivm, context_type,
|
||||
context_ptr, texture_index, NULL);
|
||||
|
||||
if (fetch_ms) {
|
||||
bld.sample_stride =
|
||||
lp_build_broadcast_scalar(&bld.int_coord_bld,
|
||||
dynamic_state->sample_stride(gallivm,
|
||||
context_type,
|
||||
context_ptr,
|
||||
texture_index,
|
||||
NULL));
|
||||
|
|
@ -3583,7 +3595,7 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm,
|
|||
/* Note that mip_offsets is an array[level] of offsets to texture images */
|
||||
|
||||
if (dynamic_state->cache_ptr && thread_data_ptr) {
|
||||
bld.cache = dynamic_state->cache_ptr(gallivm,
|
||||
bld.cache = dynamic_state->cache_ptr(gallivm, thread_data_type,
|
||||
thread_data_ptr, texture_index);
|
||||
}
|
||||
|
||||
|
|
@ -3620,7 +3632,7 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm,
|
|||
LLVMConstInt(i32t, 0, 0), "");
|
||||
if (dims >= 2) {
|
||||
LLVMValueRef tex_height =
|
||||
dynamic_state->height(gallivm,
|
||||
dynamic_state->height(gallivm, context_type,
|
||||
context_ptr, texture_index, NULL);
|
||||
bld.int_size = LLVMBuildInsertElement(builder, bld.int_size,
|
||||
tex_height,
|
||||
|
|
@ -3636,7 +3648,7 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm,
|
|||
LLVMConstInt(i32t, 1, 0), "");
|
||||
if (dims >= 3) {
|
||||
LLVMValueRef tex_depth =
|
||||
dynamic_state->depth(gallivm, context_ptr,
|
||||
dynamic_state->depth(gallivm, context_type, context_ptr,
|
||||
texture_index, NULL);
|
||||
bld.int_size = LLVMBuildInsertElement(builder, bld.int_size,
|
||||
tex_depth,
|
||||
|
|
@ -3800,6 +3812,7 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm,
|
|||
bld4.no_rho_approx = bld.no_rho_approx;
|
||||
bld4.no_brilinear = bld.no_brilinear;
|
||||
bld4.gallivm = bld.gallivm;
|
||||
bld4.context_type = bld.context_type;
|
||||
bld4.context_ptr = bld.context_ptr;
|
||||
bld4.aniso_filter_table = aniso_filter_table;
|
||||
bld4.static_texture_state = bld.static_texture_state;
|
||||
|
|
@ -4001,6 +4014,8 @@ lp_build_sample_gen_func(struct gallivm_state *gallivm,
|
|||
const struct lp_static_sampler_state *static_sampler_state,
|
||||
struct lp_sampler_dynamic_state *dynamic_state,
|
||||
struct lp_type type,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMTypeRef thread_data_type,
|
||||
unsigned texture_index,
|
||||
unsigned sampler_index,
|
||||
LLVMValueRef function,
|
||||
|
|
@ -4106,7 +4121,9 @@ lp_build_sample_gen_func(struct gallivm_state *gallivm,
|
|||
sample_key,
|
||||
texture_index,
|
||||
sampler_index,
|
||||
context_type,
|
||||
context_ptr,
|
||||
thread_data_type,
|
||||
thread_data_ptr,
|
||||
coords,
|
||||
offsets,
|
||||
|
|
@ -4254,6 +4271,8 @@ lp_build_sample_soa_func(struct gallivm_state *gallivm,
|
|||
static_sampler_state,
|
||||
dynamic_state,
|
||||
params->type,
|
||||
params->context_type,
|
||||
params->thread_data_type,
|
||||
texture_index,
|
||||
sampler_index,
|
||||
function,
|
||||
|
|
@ -4376,7 +4395,9 @@ lp_build_sample_soa(const struct lp_static_texture_state *static_texture_state,
|
|||
params->sample_key,
|
||||
params->texture_index,
|
||||
params->sampler_index,
|
||||
params->context_type,
|
||||
params->context_ptr,
|
||||
params->thread_data_type,
|
||||
params->thread_data_ptr,
|
||||
params->coords,
|
||||
params->offsets,
|
||||
|
|
@ -4397,6 +4418,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
|
|||
{
|
||||
LLVMValueRef first_level = NULL;
|
||||
const unsigned num_lods = 1;
|
||||
LLVMTypeRef context_type = params->context_type;
|
||||
LLVMValueRef context_ptr = params->context_ptr;
|
||||
const unsigned texture_unit = params->texture_unit;
|
||||
const enum pipe_texture_target target = params->target;
|
||||
|
|
@ -4459,6 +4481,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
|
|||
lp_build_broadcast(gallivm,
|
||||
lp_build_vec_type(gallivm, params->int_type),
|
||||
dynamic_state->num_samples(gallivm,
|
||||
context_type,
|
||||
context_ptr,
|
||||
texture_unit,
|
||||
texture_unit_offset));
|
||||
|
|
@ -4471,7 +4494,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
|
|||
/* FIXME: this needs to honor per-element lod */
|
||||
lod = LLVMBuildExtractElement(gallivm->builder, params->explicit_lod,
|
||||
lp_build_const_int32(gallivm, 0), "");
|
||||
first_level = dynamic_state->first_level(gallivm,
|
||||
first_level = dynamic_state->first_level(gallivm, context_type,
|
||||
context_ptr, texture_unit,
|
||||
texture_unit_offset);
|
||||
level = LLVMBuildAdd(gallivm->builder, lod, first_level, "level");
|
||||
|
|
@ -4497,6 +4520,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
|
|||
res_bh = bh = 1;
|
||||
size = LLVMBuildInsertElement(gallivm->builder, size,
|
||||
dynamic_state->width(gallivm,
|
||||
context_type,
|
||||
context_ptr,
|
||||
texture_unit,
|
||||
texture_unit_offset),
|
||||
|
|
@ -4512,7 +4536,9 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
|
|||
lp_build_const_int32(gallivm, 0), "");
|
||||
if (dims >= 2) {
|
||||
size = LLVMBuildInsertElement(gallivm->builder, size,
|
||||
dynamic_state->height(gallivm, context_ptr,
|
||||
dynamic_state->height(gallivm,
|
||||
context_type,
|
||||
context_ptr,
|
||||
texture_unit,
|
||||
texture_unit_offset),
|
||||
lp_build_const_int32(gallivm, 1), "");
|
||||
|
|
@ -4530,6 +4556,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
|
|||
if (dims >= 3) {
|
||||
size = LLVMBuildInsertElement(gallivm->builder, size,
|
||||
dynamic_state->depth(gallivm,
|
||||
context_type,
|
||||
context_ptr,
|
||||
texture_unit,
|
||||
texture_unit_offset),
|
||||
|
|
@ -4550,7 +4577,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
|
|||
tex_blocksize_log2, view_blocksize);
|
||||
|
||||
if (has_array) {
|
||||
LLVMValueRef layers = dynamic_state->depth(gallivm,
|
||||
LLVMValueRef layers = dynamic_state->depth(gallivm, context_type,
|
||||
context_ptr, texture_unit,
|
||||
texture_unit_offset);
|
||||
if (target == PIPE_TEXTURE_CUBE_ARRAY) {
|
||||
|
|
@ -4577,7 +4604,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
|
|||
|
||||
/* everything is scalar for now */
|
||||
lp_build_context_init(&leveli_bld, gallivm, lp_type_int_vec(32, 32));
|
||||
last_level = dynamic_state->last_level(gallivm,
|
||||
last_level = dynamic_state->last_level(gallivm, context_type,
|
||||
context_ptr, texture_unit,
|
||||
texture_unit_offset);
|
||||
|
||||
|
|
@ -4624,7 +4651,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
|
|||
else {
|
||||
LLVMValueRef last_level;
|
||||
|
||||
last_level = dynamic_state->last_level(gallivm,
|
||||
last_level = dynamic_state->last_level(gallivm, context_type,
|
||||
context_ptr, texture_unit,
|
||||
texture_unit_offset);
|
||||
num_levels = lp_build_sub(&bld_int_scalar, last_level, first_level);
|
||||
|
|
@ -4784,31 +4811,39 @@ lp_build_img_op_soa(const struct lp_static_texture_state *static_texture_state,
|
|||
}
|
||||
|
||||
LLVMValueRef row_stride = dynamic_state->row_stride(gallivm,
|
||||
params->context_type,
|
||||
params->context_ptr,
|
||||
params->image_index, NULL);
|
||||
LLVMValueRef img_stride = dynamic_state->img_stride(gallivm,
|
||||
params->context_type,
|
||||
params->context_ptr,
|
||||
params->image_index, NULL);
|
||||
LLVMValueRef base_ptr = dynamic_state->base_ptr(gallivm,
|
||||
params->context_type,
|
||||
params->context_ptr,
|
||||
params->image_index, NULL);
|
||||
LLVMValueRef width = dynamic_state->width(gallivm,
|
||||
params->context_ptr,
|
||||
params->context_type,
|
||||
params->context_ptr,
|
||||
params->image_index, NULL);
|
||||
LLVMValueRef height = dynamic_state->height(gallivm,
|
||||
params->context_type,
|
||||
params->context_ptr,
|
||||
params->image_index, NULL);
|
||||
LLVMValueRef depth = dynamic_state->depth(gallivm,
|
||||
params->context_ptr,
|
||||
params->context_type,
|
||||
params->context_ptr,
|
||||
params->image_index, NULL);
|
||||
LLVMValueRef num_samples = NULL, sample_stride = NULL;
|
||||
|
||||
LLVMValueRef ms_index = params->ms_index;
|
||||
if (ms_index) {
|
||||
num_samples = dynamic_state->num_samples(gallivm,
|
||||
params->context_type,
|
||||
params->context_ptr,
|
||||
params->image_index, NULL);
|
||||
sample_stride = dynamic_state->sample_stride(gallivm,
|
||||
params->context_type,
|
||||
params->context_ptr,
|
||||
params->image_index, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,7 +267,9 @@ struct lp_build_tgsi_params {
|
|||
LLVMValueRef const_sizes_ptr;
|
||||
const struct lp_bld_tgsi_system_values *system_values;
|
||||
const LLVMValueRef (*inputs)[4];
|
||||
LLVMTypeRef context_type;
|
||||
LLVMValueRef context_ptr;
|
||||
LLVMTypeRef thread_data_type;
|
||||
LLVMValueRef thread_data_ptr;
|
||||
const struct lp_build_sampler_soa *sampler;
|
||||
const struct tgsi_shader_info *info;
|
||||
|
|
@ -521,7 +523,9 @@ struct lp_build_tgsi_soa_context
|
|||
LLVMValueRef consts_sizes[LP_MAX_TGSI_CONST_BUFFERS];
|
||||
const LLVMValueRef (*inputs)[TGSI_NUM_CHANNELS];
|
||||
LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS];
|
||||
LLVMTypeRef context_type;
|
||||
LLVMValueRef context_ptr;
|
||||
LLVMTypeRef thread_data_type;
|
||||
LLVMValueRef thread_data_ptr;
|
||||
|
||||
LLVMValueRef ssbo_ptr;
|
||||
|
|
|
|||
|
|
@ -2273,7 +2273,9 @@ emit_tex( struct lp_build_tgsi_soa_context *bld,
|
|||
params.sample_key = sample_key;
|
||||
params.texture_index = unit;
|
||||
params.sampler_index = unit;
|
||||
params.context_type = bld->context_type;
|
||||
params.context_ptr = bld->context_ptr;
|
||||
params.thread_data_type = bld->thread_data_type;
|
||||
params.thread_data_ptr = bld->thread_data_ptr;
|
||||
params.coords = coords;
|
||||
params.offsets = offsets;
|
||||
|
|
@ -2442,7 +2444,9 @@ emit_sample(struct lp_build_tgsi_soa_context *bld,
|
|||
params.sample_key = sample_key;
|
||||
params.texture_index = texture_unit;
|
||||
params.sampler_index = sampler_unit;
|
||||
params.context_type = bld->context_type;
|
||||
params.context_ptr = bld->context_ptr;
|
||||
params.thread_data_type = bld->thread_data_type;
|
||||
params.thread_data_ptr = bld->thread_data_ptr;
|
||||
params.coords = coords;
|
||||
params.offsets = offsets;
|
||||
|
|
@ -2580,7 +2584,9 @@ emit_fetch_texels( struct lp_build_tgsi_soa_context *bld,
|
|||
* can exceed this.
|
||||
*/
|
||||
params.sampler_index = 0;
|
||||
params.context_type = bld->context_type;
|
||||
params.context_ptr = bld->context_ptr;
|
||||
params.thread_data_type = bld->thread_data_type;
|
||||
params.thread_data_ptr = bld->thread_data_ptr;
|
||||
params.coords = coords;
|
||||
params.offsets = offsets;
|
||||
|
|
@ -2665,6 +2671,7 @@ emit_size_query( struct lp_build_tgsi_soa_context *bld,
|
|||
params.texture_unit = unit;
|
||||
params.texture_unit_offset = NULL;
|
||||
params.target = pipe_target;
|
||||
params.context_type = bld->context_type;
|
||||
params.context_ptr = bld->context_ptr;
|
||||
params.is_sviewinfo = TRUE;
|
||||
params.lod_property = lod_property;
|
||||
|
|
@ -3453,7 +3460,9 @@ img_load_emit(
|
|||
memset(¶ms, 0, sizeof(params));
|
||||
|
||||
params.type = bld->bld_base.base.type;
|
||||
params.context_type = bld->context_type;
|
||||
params.context_ptr = bld->context_ptr;
|
||||
params.thread_data_type = bld->thread_data_type;
|
||||
params.thread_data_ptr = bld->thread_data_ptr;
|
||||
params.coords = coords;
|
||||
params.outdata = emit_data->output;
|
||||
|
|
@ -3601,7 +3610,9 @@ img_store_emit(
|
|||
memset(¶ms, 0, sizeof(params));
|
||||
|
||||
params.type = bld->bld_base.base.type;
|
||||
params.context_type = bld->context_type;
|
||||
params.context_ptr = bld->context_ptr;
|
||||
params.thread_data_type = bld->thread_data_type;
|
||||
params.thread_data_ptr = bld->thread_data_ptr;
|
||||
params.coords = coords;
|
||||
params.outdata = NULL;
|
||||
|
|
@ -3710,6 +3721,7 @@ resq_emit(
|
|||
params.int_type = bld->bld_base.int_bld.type;
|
||||
params.texture_unit = buf;
|
||||
params.target = tgsi_to_pipe_tex_target(target);
|
||||
params.context_type = bld->context_type;
|
||||
params.context_ptr = bld->context_ptr;
|
||||
params.sizes_out = emit_data->output;
|
||||
|
||||
|
|
@ -3751,7 +3763,9 @@ img_atomic_emit(
|
|||
memset(¶ms, 0, sizeof(params));
|
||||
|
||||
params.type = bld->bld_base.base.type;
|
||||
params.context_type = bld->context_type;
|
||||
params.context_ptr = bld->context_ptr;
|
||||
params.thread_data_type = bld->thread_data_type;
|
||||
params.thread_data_ptr = bld->thread_data_ptr;
|
||||
params.exec_mask = mask_vec(bld_base);
|
||||
params.image_index = emit_data->inst->Src[0].Register.Index;
|
||||
|
|
@ -4483,7 +4497,9 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
|
|||
bld.sampler = params->sampler;
|
||||
bld.bld_base.info = params->info;
|
||||
bld.indirect_files = params->info->indirect_files;
|
||||
bld.context_type = params->context_type;
|
||||
bld.context_ptr = params->context_ptr;
|
||||
bld.thread_data_type = params->thread_data_type;
|
||||
bld.thread_data_ptr = params->thread_data_ptr;
|
||||
bld.image = params->image;
|
||||
bld.shared_ptr = params->shared_ptr;
|
||||
|
|
|
|||
|
|
@ -447,6 +447,7 @@ generate_compute(struct llvmpipe_context *lp,
|
|||
params.mask = &mask;
|
||||
params.consts_ptr = consts_ptr;
|
||||
params.system_values = &system_values;
|
||||
params.context_type = variant->jit_cs_context_type;
|
||||
params.context_ptr = context_ptr;
|
||||
params.sampler = sampler;
|
||||
params.info = &shader->info.base;
|
||||
|
|
|
|||
|
|
@ -1052,7 +1052,9 @@ generate_fs_loop(struct gallivm_state *gallivm,
|
|||
params.consts_ptr = consts_ptr;
|
||||
params.system_values = &system_values;
|
||||
params.inputs = interp->inputs;
|
||||
params.context_type = context_type;
|
||||
params.context_ptr = context_ptr;
|
||||
params.thread_data_type = thread_data_type;
|
||||
params.thread_data_ptr = thread_data_ptr;
|
||||
params.sampler = sampler;
|
||||
params.info = &shader->info.base;
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ struct lp_llvm_image_soa
|
|||
*/
|
||||
static LLVMValueRef
|
||||
lp_llvm_texture_member(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned texture_unit,
|
||||
LLVMValueRef texture_unit_offset,
|
||||
|
|
@ -144,7 +145,7 @@ lp_llvm_texture_member(struct gallivm_state *gallivm,
|
|||
indices[3] = lp_build_const_int32(gallivm, member_index);
|
||||
|
||||
LLVMValueRef ptr =
|
||||
LLVMBuildGEP(builder, context_ptr, indices, ARRAY_SIZE(indices), "");
|
||||
LLVMBuildGEP2(builder, context_type, context_ptr, indices, ARRAY_SIZE(indices), "");
|
||||
|
||||
LLVMValueRef res = emit_load ? LLVMBuildLoad(builder, ptr, "") : ptr;
|
||||
|
||||
|
|
@ -166,11 +167,12 @@ lp_llvm_texture_member(struct gallivm_state *gallivm,
|
|||
#define LP_LLVM_TEXTURE_MEMBER(_name, _index, _emit_load) \
|
||||
static LLVMValueRef \
|
||||
lp_llvm_texture_##_name(struct gallivm_state *gallivm, \
|
||||
LLVMTypeRef context_type, \
|
||||
LLVMValueRef context_ptr, \
|
||||
unsigned texture_unit, \
|
||||
LLVMValueRef texture_unit_offset) \
|
||||
{ \
|
||||
return lp_llvm_texture_member(gallivm, context_ptr, \
|
||||
return lp_llvm_texture_member(gallivm, context_type, context_ptr, \
|
||||
texture_unit, texture_unit_offset, \
|
||||
_index, #_name, _emit_load ); \
|
||||
}
|
||||
|
|
@ -199,6 +201,7 @@ LP_LLVM_TEXTURE_MEMBER(sample_stride, LP_JIT_TEXTURE_SAMPLE_STRIDE, TRUE)
|
|||
*/
|
||||
static LLVMValueRef
|
||||
lp_llvm_sampler_member(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned sampler_unit,
|
||||
unsigned member_index,
|
||||
|
|
@ -220,7 +223,7 @@ lp_llvm_sampler_member(struct gallivm_state *gallivm,
|
|||
indices[3] = lp_build_const_int32(gallivm, member_index);
|
||||
|
||||
LLVMValueRef ptr =
|
||||
LLVMBuildGEP(builder, context_ptr, indices, ARRAY_SIZE(indices), "");
|
||||
LLVMBuildGEP2(builder, context_type, context_ptr, indices, ARRAY_SIZE(indices), "");
|
||||
|
||||
LLVMValueRef res = emit_load ? LLVMBuildLoad(builder, ptr, "") : ptr;
|
||||
|
||||
|
|
@ -233,10 +236,11 @@ lp_llvm_sampler_member(struct gallivm_state *gallivm,
|
|||
#define LP_LLVM_SAMPLER_MEMBER(_name, _index, _emit_load) \
|
||||
static LLVMValueRef \
|
||||
lp_llvm_sampler_##_name( struct gallivm_state *gallivm, \
|
||||
LLVMTypeRef context_type, \
|
||||
LLVMValueRef context_ptr, \
|
||||
unsigned sampler_unit) \
|
||||
{ \
|
||||
return lp_llvm_sampler_member(gallivm, context_ptr, \
|
||||
return lp_llvm_sampler_member(gallivm, context_type, context_ptr, \
|
||||
sampler_unit, _index, #_name, _emit_load ); \
|
||||
}
|
||||
|
||||
|
|
@ -258,6 +262,7 @@ LP_LLVM_SAMPLER_MEMBER(max_aniso, LP_JIT_SAMPLER_MAX_ANISO, TRUE)
|
|||
*/
|
||||
static LLVMValueRef
|
||||
lp_llvm_image_member(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef context_type,
|
||||
LLVMValueRef context_ptr,
|
||||
unsigned image_unit,
|
||||
LLVMValueRef image_unit_offset,
|
||||
|
|
@ -285,7 +290,7 @@ lp_llvm_image_member(struct gallivm_state *gallivm,
|
|||
indices[3] = lp_build_const_int32(gallivm, member_index);
|
||||
|
||||
LLVMValueRef ptr =
|
||||
LLVMBuildGEP(builder, context_ptr, indices, ARRAY_SIZE(indices), "");
|
||||
LLVMBuildGEP2(builder, context_type, context_ptr, indices, ARRAY_SIZE(indices), "");
|
||||
|
||||
LLVMValueRef res = emit_load ? LLVMBuildLoad(builder, ptr, "") : ptr;
|
||||
|
||||
|
|
@ -307,10 +312,11 @@ lp_llvm_image_member(struct gallivm_state *gallivm,
|
|||
#define LP_LLVM_IMAGE_MEMBER(_name, _index, _emit_load) \
|
||||
static LLVMValueRef \
|
||||
lp_llvm_image_##_name( struct gallivm_state *gallivm, \
|
||||
LLVMTypeRef context_type, \
|
||||
LLVMValueRef context_ptr, \
|
||||
unsigned image_unit, LLVMValueRef image_unit_offset) \
|
||||
{ \
|
||||
return lp_llvm_image_member(gallivm, context_ptr, \
|
||||
return lp_llvm_image_member(gallivm, context_type, context_ptr, \
|
||||
image_unit, image_unit_offset, \
|
||||
_index, #_name, _emit_load ); \
|
||||
}
|
||||
|
|
@ -329,13 +335,14 @@ LP_LLVM_IMAGE_MEMBER(sample_stride, LP_JIT_IMAGE_SAMPLE_STRIDE, TRUE)
|
|||
#if LP_USE_TEXTURE_CACHE
|
||||
static LLVMValueRef
|
||||
lp_llvm_texture_cache_ptr(struct gallivm_state *gallivm,
|
||||
LLVMTypeRef thread_data_type,
|
||||
LLVMValueRef thread_data_ptr,
|
||||
unsigned unit)
|
||||
{
|
||||
/* We use the same cache for all units */
|
||||
(void)unit;
|
||||
|
||||
return lp_jit_thread_data_cache(gallivm, LLVMGetElementType(LLVMTypeOf(thread_data_ptr)), thread_data_ptr);
|
||||
return lp_jit_thread_data_cache(gallivm, thread_data_type, thread_data_ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue