summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2015-03-25 03:10:10 +0100
committerRoland Scheidegger <[email protected]>2015-03-27 19:25:53 +0100
commit8dad9455ff748c543635b24908566c3b94cb93a9 (patch)
treefadf8b3b7e08a30fe37e53b4c4ea226db29ad55d /src/gallium/auxiliary/gallivm
parent787aa26cb7b48504f7770cacfc321324ecafa29a (diff)
gallivm: pass jit_context pointer through to sampling
The callbacks used for getting the dynamic texture/sampler state were using the jit_context from the generated jit function. This works just fine, however that way it's impossible to generate separate functions for texture sampling, as will be done in the next commit. Hence, pass this pointer through all interfaces so it can be passed to a separate function (technically, it would probably be possible to extract this pointer from the current function instead, but this feels hacky and would probably require some more hacks if we'd use real functions instead of inlining all shader functions at some point). There should be no difference in the generated code for now. Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample.c39
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample.h83
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c74
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi.h4
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c6
5 files changed, 132 insertions, 74 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index 7d18ee592ba..5b220450bf3 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -246,8 +246,8 @@ 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->dynamic_state,
- bld->gallivm, texture_unit);
+ first_level = bld->dynamic_state->first_level(bld->dynamic_state, bld->gallivm,
+ bld->context_ptr, texture_unit);
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);
float_size = lp_build_int_to_float(float_size_bld, int_size);
@@ -714,6 +714,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
{
LLVMBuilderRef builder = bld->gallivm->builder;
+ struct lp_sampler_dynamic_state *dynamic_state = bld->dynamic_state;
struct lp_build_context *lodf_bld = &bld->lodf_bld;
LLVMValueRef lod;
@@ -744,8 +745,8 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
* This is hit during mipmap generation.
*/
LLVMValueRef min_lod =
- bld->dynamic_state->min_lod(bld->dynamic_state,
- bld->gallivm, sampler_unit);
+ dynamic_state->min_lod(dynamic_state, bld->gallivm,
+ bld->context_ptr, sampler_unit);
lod = lp_build_broadcast_scalar(lodf_bld, min_lod);
}
@@ -835,8 +836,8 @@ 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 =
- bld->dynamic_state->lod_bias(bld->dynamic_state,
- bld->gallivm, sampler_unit);
+ dynamic_state->lod_bias(dynamic_state, bld->gallivm,
+ bld->context_ptr, sampler_unit);
sampler_lod_bias = lp_build_broadcast_scalar(lodf_bld,
sampler_lod_bias);
lod = LLVMBuildFAdd(builder, lod, sampler_lod_bias, "sampler_lod_bias");
@@ -845,16 +846,16 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
/* clamp lod */
if (bld->static_sampler_state->apply_max_lod) {
LLVMValueRef max_lod =
- bld->dynamic_state->max_lod(bld->dynamic_state,
- bld->gallivm, sampler_unit);
+ dynamic_state->max_lod(dynamic_state, bld->gallivm,
+ bld->context_ptr, sampler_unit);
max_lod = lp_build_broadcast_scalar(lodf_bld, max_lod);
lod = lp_build_min(lodf_bld, lod, max_lod);
}
if (bld->static_sampler_state->apply_min_lod) {
LLVMValueRef min_lod =
- bld->dynamic_state->min_lod(bld->dynamic_state,
- bld->gallivm, sampler_unit);
+ dynamic_state->min_lod(dynamic_state, bld->gallivm,
+ bld->context_ptr, sampler_unit);
min_lod = lp_build_broadcast_scalar(lodf_bld, min_lod);
lod = lp_build_max(lodf_bld, lod, min_lod);
@@ -901,12 +902,13 @@ lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
LLVMValueRef *out_of_bounds)
{
struct lp_build_context *leveli_bld = &bld->leveli_bld;
+ struct lp_sampler_dynamic_state *dynamic_state = bld->dynamic_state;
LLVMValueRef first_level, last_level, level;
- first_level = bld->dynamic_state->first_level(bld->dynamic_state,
- bld->gallivm, texture_unit);
- last_level = bld->dynamic_state->last_level(bld->dynamic_state,
- bld->gallivm, texture_unit);
+ first_level = dynamic_state->first_level(dynamic_state, bld->gallivm,
+ bld->context_ptr, texture_unit);
+ last_level = dynamic_state->last_level(dynamic_state, bld->gallivm,
+ bld->context_ptr, texture_unit);
first_level = lp_build_broadcast_scalar(leveli_bld, first_level);
last_level = lp_build_broadcast_scalar(leveli_bld, last_level);
@@ -956,6 +958,7 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
LLVMValueRef *level1_out)
{
LLVMBuilderRef builder = bld->gallivm->builder;
+ struct lp_sampler_dynamic_state *dynamic_state = bld->dynamic_state;
struct lp_build_context *leveli_bld = &bld->leveli_bld;
struct lp_build_context *levelf_bld = &bld->levelf_bld;
LLVMValueRef first_level, last_level;
@@ -964,10 +967,10 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
assert(bld->num_lods == bld->num_mips);
- first_level = bld->dynamic_state->first_level(bld->dynamic_state,
- bld->gallivm, texture_unit);
- last_level = bld->dynamic_state->last_level(bld->dynamic_state,
- bld->gallivm, texture_unit);
+ first_level = dynamic_state->first_level(dynamic_state, bld->gallivm,
+ bld->context_ptr, texture_unit);
+ last_level = dynamic_state->last_level(dynamic_state, bld->gallivm,
+ bld->context_ptr, texture_unit);
first_level = lp_build_broadcast_scalar(leveli_bld, first_level);
last_level = lp_build_broadcast_scalar(leveli_bld, last_level);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index be05b136edb..be41ca02ae8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -138,79 +138,96 @@ struct lp_sampler_dynamic_state
/** Obtain the base texture width (or number of elements) (returns int32) */
LLVMValueRef
- (*width)( const struct lp_sampler_dynamic_state *state,
- struct gallivm_state *gallivm,
- unsigned texture_unit);
+ (*width)(const struct lp_sampler_dynamic_state *state,
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned texture_unit);
/** Obtain the base texture height (returns int32) */
LLVMValueRef
- (*height)( const struct lp_sampler_dynamic_state *state,
- struct gallivm_state *gallivm,
- unsigned texture_unit);
+ (*height)(const struct lp_sampler_dynamic_state *state,
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned texture_unit);
/** Obtain the base texture depth (or array size) (returns int32) */
LLVMValueRef
- (*depth)( const struct lp_sampler_dynamic_state *state,
- struct gallivm_state *gallivm,
- unsigned texture_unit);
+ (*depth)(const struct lp_sampler_dynamic_state *state,
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned texture_unit);
/** Obtain the first mipmap level (base level) (returns int32) */
LLVMValueRef
- (*first_level)( const struct lp_sampler_dynamic_state *state,
- struct gallivm_state *gallivm,
- unsigned texture_unit);
+ (*first_level)(const struct lp_sampler_dynamic_state *state,
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned texture_unit);
/** Obtain the number of mipmap levels minus one (returns int32) */
LLVMValueRef
- (*last_level)( const struct lp_sampler_dynamic_state *state,
- struct gallivm_state *gallivm,
- unsigned texture_unit);
+ (*last_level)(const struct lp_sampler_dynamic_state *state,
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned texture_unit);
/** Obtain stride in bytes between image rows/blocks (returns int32) */
LLVMValueRef
- (*row_stride)( const struct lp_sampler_dynamic_state *state,
- struct gallivm_state *gallivm,
- unsigned texture_unit);
+ (*row_stride)(const struct lp_sampler_dynamic_state *state,
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned texture_unit);
/** Obtain stride in bytes between image slices (returns int32) */
LLVMValueRef
- (*img_stride)( const struct lp_sampler_dynamic_state *state,
- struct gallivm_state *gallivm,
- unsigned texture_unit);
+ (*img_stride)(const struct lp_sampler_dynamic_state *state,
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned texture_unit);
/** Obtain pointer to base of texture */
LLVMValueRef
- (*base_ptr)( const struct lp_sampler_dynamic_state *state,
- struct gallivm_state *gallivm,
- unsigned texture_unit);
+ (*base_ptr)(const struct lp_sampler_dynamic_state *state,
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned texture_unit);
/** Obtain pointer to array of mipmap offsets */
LLVMValueRef
- (*mip_offsets)( const struct lp_sampler_dynamic_state *state,
- struct gallivm_state *gallivm,
- unsigned texture_unit);
+ (*mip_offsets)(const struct lp_sampler_dynamic_state *state,
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned texture_unit);
/* These are callbacks for sampler state */
/** Obtain texture min lod (returns float) */
LLVMValueRef
(*min_lod)(const struct lp_sampler_dynamic_state *state,
- struct gallivm_state *gallivm, unsigned sampler_unit);
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned sampler_unit);
/** Obtain texture max lod (returns float) */
LLVMValueRef
(*max_lod)(const struct lp_sampler_dynamic_state *state,
- struct gallivm_state *gallivm, unsigned sampler_unit);
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned sampler_unit);
/** Obtain texture lod bias (returns float) */
LLVMValueRef
(*lod_bias)(const struct lp_sampler_dynamic_state *state,
- struct gallivm_state *gallivm, unsigned sampler_unit);
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned sampler_unit);
/** Obtain texture border color (returns ptr to float[4]) */
LLVMValueRef
(*border_color)(const struct lp_sampler_dynamic_state *state,
- struct gallivm_state *gallivm, unsigned sampler_unit);
+ struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
+ unsigned sampler_unit);
};
@@ -305,6 +322,8 @@ struct lp_build_sample_context
LLVMValueRef int_size;
LLVMValueRef border_color_clamped;
+
+ LLVMValueRef context_ptr;
};
@@ -520,6 +539,7 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
boolean is_fetch,
unsigned texture_index,
unsigned sampler_index,
+ LLVMValueRef context_ptr,
const LLVMValueRef *coords,
const LLVMValueRef *offsets,
const struct lp_derivatives *derivs,
@@ -545,6 +565,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
struct lp_type int_type,
unsigned texture_unit,
unsigned target,
+ LLVMValueRef context_ptr,
boolean is_sviewinfo,
enum lp_sampler_lod_property lod_property,
LLVMValueRef explicit_lod,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 99309fe75bd..a90278ea889 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1678,8 +1678,8 @@ 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->dynamic_state,
- bld->gallivm, texture_unit);
+ num_layers = bld->dynamic_state->depth(bld->dynamic_state, bld->gallivm,
+ bld->context_ptr, texture_unit);
if (out_of_bounds) {
LLVMValueRef out1, out;
@@ -1815,7 +1815,8 @@ lp_build_sample_common(struct lp_build_sample_context *bld,
case PIPE_TEX_MIPFILTER_NONE:
/* always use mip level 0 */
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
- bld->gallivm, texture_index);
+ bld->gallivm, bld->context_ptr,
+ texture_index);
first_level = lp_build_broadcast_scalar(&bld->leveli_bld, first_level);
*ilevel0 = first_level;
break;
@@ -1840,8 +1841,8 @@ lp_build_clamp_border_color(struct lp_build_sample_context *bld,
struct gallivm_state *gallivm = bld->gallivm;
LLVMBuilderRef builder = gallivm->builder;
LLVMValueRef border_color_ptr =
- bld->dynamic_state->border_color(bld->dynamic_state,
- gallivm, sampler_unit);
+ bld->dynamic_state->border_color(bld->dynamic_state, gallivm,
+ bld->context_ptr, sampler_unit);
LLVMValueRef border_color;
const struct util_format_description *format_desc = bld->format_desc;
struct lp_type vec4_type = bld->texel_type;
@@ -2246,8 +2247,8 @@ lp_build_fetch_texel(struct lp_build_sample_context *bld,
else {
assert(bld->num_mips == 1);
if (bld->static_texture_state->target != PIPE_BUFFER) {
- ilevel = bld->dynamic_state->first_level(bld->dynamic_state,
- bld->gallivm, texture_unit);
+ ilevel = bld->dynamic_state->first_level(bld->dynamic_state, bld->gallivm,
+ bld->context_ptr, texture_unit);
}
else {
ilevel = lp_build_const_int32(bld->gallivm, 0);
@@ -2372,6 +2373,7 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
boolean is_fetch,
unsigned texture_index,
unsigned sampler_index,
+ LLVMValueRef context_ptr,
const LLVMValueRef *coords,
const LLVMValueRef *offsets,
const struct lp_derivatives *derivs, /* optional */
@@ -2413,6 +2415,7 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
/* Setup our build context */
memset(&bld, 0, sizeof bld);
bld.gallivm = gallivm;
+ bld.context_ptr = context_ptr;
bld.static_sampler_state = &derived_sampler_state;
bld.static_texture_state = static_texture_state;
bld.dynamic_state = dynamic_state;
@@ -2578,11 +2581,16 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
lp_build_context_init(&bld.lodi_bld, gallivm, bld.lodi_type);
/* Get the dynamic state */
- tex_width = dynamic_state->width(dynamic_state, gallivm, texture_index);
- bld.row_stride_array = dynamic_state->row_stride(dynamic_state, gallivm, texture_index);
- bld.img_stride_array = dynamic_state->img_stride(dynamic_state, gallivm, texture_index);
- bld.base_ptr = dynamic_state->base_ptr(dynamic_state, gallivm, texture_index);
- bld.mip_offsets = dynamic_state->mip_offsets(dynamic_state, gallivm, texture_index);
+ tex_width = dynamic_state->width(dynamic_state, gallivm,
+ context_ptr, texture_index);
+ bld.row_stride_array = dynamic_state->row_stride(dynamic_state, gallivm,
+ context_ptr, texture_index);
+ bld.img_stride_array = dynamic_state->img_stride(dynamic_state, gallivm,
+ context_ptr, texture_index);
+ bld.base_ptr = dynamic_state->base_ptr(dynamic_state, gallivm,
+ context_ptr, texture_index);
+ bld.mip_offsets = dynamic_state->mip_offsets(dynamic_state, gallivm,
+ context_ptr, texture_index);
/* Note that mip_offsets is an array[level] of offsets to texture images */
/* width, height, depth as single int vector */
@@ -2591,17 +2599,22 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
}
else {
bld.int_size = LLVMBuildInsertElement(builder, bld.int_size_in_bld.undef,
- tex_width, LLVMConstInt(i32t, 0, 0), "");
+ tex_width,
+ LLVMConstInt(i32t, 0, 0), "");
if (dims >= 2) {
LLVMValueRef tex_height =
- dynamic_state->height(dynamic_state, gallivm, texture_index);
+ dynamic_state->height(dynamic_state, gallivm,
+ context_ptr, texture_index);
bld.int_size = LLVMBuildInsertElement(builder, bld.int_size,
- tex_height, LLVMConstInt(i32t, 1, 0), "");
+ tex_height,
+ LLVMConstInt(i32t, 1, 0), "");
if (dims >= 3) {
LLVMValueRef tex_depth =
- dynamic_state->depth(dynamic_state, gallivm, texture_index);
+ dynamic_state->depth(dynamic_state, gallivm, context_ptr,
+ texture_index);
bld.int_size = LLVMBuildInsertElement(builder, bld.int_size,
- tex_depth, LLVMConstInt(i32t, 2, 0), "");
+ tex_depth,
+ LLVMConstInt(i32t, 2, 0), "");
}
}
}
@@ -2717,6 +2730,7 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
/* Setup our build context */
memset(&bld4, 0, sizeof bld4);
bld4.gallivm = bld.gallivm;
+ bld4.context_ptr = bld.context_ptr;
bld4.static_texture_state = bld.static_texture_state;
bld4.static_sampler_state = bld.static_sampler_state;
bld4.dynamic_state = bld.dynamic_state;
@@ -2876,6 +2890,7 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
}
}
+
void
lp_build_size_query_soa(struct gallivm_state *gallivm,
const struct lp_static_texture_state *static_state,
@@ -2883,6 +2898,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
struct lp_type int_type,
unsigned texture_unit,
unsigned target,
+ LLVMValueRef context_ptr,
boolean is_sviewinfo,
enum lp_sampler_lod_property lod_property,
LLVMValueRef explicit_lod,
@@ -2954,8 +2970,10 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
if (explicit_lod) {
/* FIXME: this needs to honor per-element lod */
- lod = LLVMBuildExtractElement(gallivm->builder, explicit_lod, lp_build_const_int32(gallivm, 0), "");
- first_level = dynamic_state->first_level(dynamic_state, gallivm, texture_unit);
+ lod = LLVMBuildExtractElement(gallivm->builder, explicit_lod,
+ lp_build_const_int32(gallivm, 0), "");
+ first_level = dynamic_state->first_level(dynamic_state, gallivm,
+ context_ptr, texture_unit);
level = LLVMBuildAdd(gallivm->builder, lod, first_level, "level");
lod = lp_build_broadcast_scalar(&bld_int_vec4, level);
} else {
@@ -2965,25 +2983,29 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
size = bld_int_vec4.undef;
size = LLVMBuildInsertElement(gallivm->builder, size,
- dynamic_state->width(dynamic_state, gallivm, texture_unit),
+ dynamic_state->width(dynamic_state, gallivm,
+ context_ptr, texture_unit),
lp_build_const_int32(gallivm, 0), "");
if (dims >= 2) {
size = LLVMBuildInsertElement(gallivm->builder, size,
- dynamic_state->height(dynamic_state, gallivm, texture_unit),
+ dynamic_state->height(dynamic_state, gallivm,
+ context_ptr, texture_unit),
lp_build_const_int32(gallivm, 1), "");
}
if (dims >= 3) {
size = LLVMBuildInsertElement(gallivm->builder, size,
- dynamic_state->depth(dynamic_state, gallivm, texture_unit),
+ dynamic_state->depth(dynamic_state, gallivm,
+ context_ptr, texture_unit),
lp_build_const_int32(gallivm, 2), "");
}
size = lp_build_minify(&bld_int_vec4, size, lod, TRUE);
if (has_array) {
- LLVMValueRef layers = dynamic_state->depth(dynamic_state, gallivm, texture_unit);
+ LLVMValueRef layers = dynamic_state->depth(dynamic_state, gallivm,
+ context_ptr, texture_unit);
if (target == PIPE_TEXTURE_CUBE_ARRAY) {
/*
* It looks like GL wants number of cubes, d3d10.1 has it undefined?
@@ -3008,7 +3030,8 @@ 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(dynamic_state, gallivm, texture_unit);
+ last_level = dynamic_state->last_level(dynamic_state, gallivm,
+ context_ptr, texture_unit);
out = lp_build_cmp(&leveli_bld, PIPE_FUNC_LESS, level, first_level);
out1 = lp_build_cmp(&leveli_bld, PIPE_FUNC_GREATER, level, last_level);
@@ -3048,7 +3071,8 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
else {
LLVMValueRef last_level;
- last_level = dynamic_state->last_level(dynamic_state, gallivm, texture_unit);
+ last_level = dynamic_state->last_level(dynamic_state, gallivm,
+ context_ptr, texture_unit);
num_levels = lp_build_sub(&bld_int_scalar, last_level, first_level);
num_levels = lp_build_add(&bld_int_scalar, num_levels, bld_int_scalar.one);
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index b411f05674d..8d53607b934 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -188,6 +188,7 @@ struct lp_build_sampler_soa
boolean is_fetch,
unsigned texture_index,
unsigned sampler_index,
+ LLVMValueRef context_ptr,
const LLVMValueRef *coords,
const LLVMValueRef *offsets,
const struct lp_derivatives *derivs,
@@ -202,6 +203,7 @@ struct lp_build_sampler_soa
struct lp_type type,
unsigned unit,
unsigned target,
+ LLVMValueRef context_ptr,
boolean need_nr_mips,
enum lp_sampler_lod_property,
LLVMValueRef explicit_lod, /* optional */
@@ -237,6 +239,7 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
const struct lp_bld_tgsi_system_values *system_values,
const LLVMValueRef (*inputs)[4],
LLVMValueRef (*outputs)[4],
+ LLVMValueRef context_ptr,
struct lp_build_sampler_soa *sampler,
const struct tgsi_shader_info *info,
const struct lp_build_tgsi_gs_iface *gs_iface);
@@ -449,6 +452,7 @@ 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];
+ LLVMValueRef context_ptr;
const struct lp_build_sampler_soa *sampler;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 3b2097f8521..3e82036150b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -2151,6 +2151,7 @@ emit_tex( struct lp_build_tgsi_soa_context *bld,
bld->bld_base.base.type,
FALSE,
unit, unit,
+ bld->context_ptr,
coords,
offsets,
deriv_ptr,
@@ -2314,6 +2315,7 @@ emit_sample(struct lp_build_tgsi_soa_context *bld,
bld->bld_base.base.type,
FALSE,
texture_unit, sampler_unit,
+ bld->context_ptr,
coords,
offsets,
deriv_ptr,
@@ -2424,6 +2426,7 @@ emit_fetch_texels( struct lp_build_tgsi_soa_context *bld,
bld->bld_base.base.type,
TRUE,
unit, unit,
+ bld->context_ptr,
coords,
offsets,
NULL,
@@ -2498,6 +2501,7 @@ emit_size_query( struct lp_build_tgsi_soa_context *bld,
bld->bld_base.base.gallivm,
bld->bld_base.int_bld.type,
unit, pipe_target,
+ bld->context_ptr,
TRUE,
lod_property,
explicit_lod,
@@ -3656,6 +3660,7 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
const struct lp_bld_tgsi_system_values *system_values,
const LLVMValueRef (*inputs)[TGSI_NUM_CHANNELS],
LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS],
+ LLVMValueRef context_ptr,
struct lp_build_sampler_soa *sampler,
const struct tgsi_shader_info *info,
const struct lp_build_tgsi_gs_iface *gs_iface)
@@ -3684,6 +3689,7 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
bld.sampler = sampler;
bld.bld_base.info = info;
bld.indirect_files = info->indirect_files;
+ bld.context_ptr = context_ptr;
/*
* If the number of temporaries is rather large then we just