system_values,
inputs,
outputs,
+ context_ptr,
draw_sampler,
&llvm->draw->vs.vertex_shader->info,
NULL);
LLVMBuildStore(builder, lp_build_zero(gallivm, lp_int_type(vs_type)), clipmask_bool_ptr);
/* code generated texture sampling */
- sampler = draw_llvm_sampler_soa_create(
- draw_llvm_variant_key_samplers(key),
- context_ptr);
+ sampler = draw_llvm_sampler_soa_create(draw_llvm_variant_key_samplers(key));
if (elts) {
start = zero;
draw_gs_jit_context_num_constants(variant->gallivm, context_ptr);
/* code generated texture sampling */
- sampler = draw_llvm_sampler_soa_create(variant->key.samplers,
- context_ptr);
+ sampler = draw_llvm_sampler_soa_create(variant->key.samplers);
mask_val = generate_mask_value(variant, gs_type);
lp_build_mask_begin(&mask, gallivm, gs_type, mask_val);
&system_values,
NULL,
outputs,
+ context_ptr,
sampler,
&llvm->draw->gs.geometry_shader->info,
(const struct lp_build_tgsi_gs_iface *)&gs_iface);
draw_gs_llvm_dump_variant_key(struct draw_gs_llvm_variant_key *key);
struct lp_build_sampler_soa *
-draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state,
- LLVMValueRef context_ptr);
+draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state);
void
draw_llvm_set_sampler_state(struct draw_context *draw, unsigned shader_stage);
struct lp_sampler_dynamic_state base;
const struct draw_sampler_static_state *static_state;
-
- LLVMValueRef context_ptr;
};
static LLVMValueRef
draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
unsigned texture_unit,
unsigned member_index,
const char *member_name,
boolean emit_load)
{
LLVMBuilderRef builder = gallivm->builder;
- struct draw_llvm_sampler_dynamic_state *state =
- (struct draw_llvm_sampler_dynamic_state *)base;
LLVMValueRef indices[4];
LLVMValueRef ptr;
LLVMValueRef res;
/* context[0].textures[unit].member */
indices[3] = lp_build_const_int32(gallivm, member_index);
- ptr = LLVMBuildGEP(builder, state->context_ptr, indices, Elements(indices), "");
+ ptr = LLVMBuildGEP(builder, context_ptr, indices, Elements(indices), "");
if (emit_load)
res = LLVMBuildLoad(builder, ptr, "");
static LLVMValueRef
draw_llvm_sampler_member(const struct lp_sampler_dynamic_state *base,
struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
unsigned sampler_unit,
unsigned member_index,
const char *member_name,
boolean emit_load)
{
LLVMBuilderRef builder = gallivm->builder;
- struct draw_llvm_sampler_dynamic_state *state =
- (struct draw_llvm_sampler_dynamic_state *)base;
LLVMValueRef indices[4];
LLVMValueRef ptr;
LLVMValueRef res;
/* context[0].samplers[unit].member */
indices[3] = lp_build_const_int32(gallivm, member_index);
- ptr = LLVMBuildGEP(builder, state->context_ptr, indices, Elements(indices), "");
+ ptr = LLVMBuildGEP(builder, context_ptr, indices, Elements(indices), "");
if (emit_load)
res = LLVMBuildLoad(builder, ptr, "");
static LLVMValueRef \
draw_llvm_texture_##_name( const struct lp_sampler_dynamic_state *base, \
struct gallivm_state *gallivm, \
+ LLVMValueRef context_ptr, \
unsigned texture_unit) \
{ \
- return draw_llvm_texture_member(base, gallivm, texture_unit, _index, #_name, _emit_load ); \
+ return draw_llvm_texture_member(base, gallivm, context_ptr, \
+ texture_unit, _index, #_name, _emit_load ); \
}
static LLVMValueRef \
draw_llvm_sampler_##_name( const struct lp_sampler_dynamic_state *base, \
struct gallivm_state *gallivm, \
+ LLVMValueRef context_ptr, \
unsigned sampler_unit) \
{ \
- return draw_llvm_sampler_member(base, gallivm, sampler_unit, _index, #_name, _emit_load ); \
+ return draw_llvm_sampler_member(base, gallivm, context_ptr, \
+ sampler_unit, _index, #_name, _emit_load ); \
}
boolean is_fetch,
unsigned texture_index,
unsigned sampler_index,
+ LLVMValueRef context_ptr,
const LLVMValueRef *coords,
const LLVMValueRef *offsets,
const struct lp_derivatives *derivs,
is_fetch,
texture_index,
sampler_index,
+ context_ptr,
coords,
offsets,
derivs,
struct lp_type type,
unsigned texture_unit,
unsigned target,
+ LLVMValueRef context_ptr,
boolean is_sviewinfo,
enum lp_sampler_lod_property lod_property,
LLVMValueRef explicit_lod, /* optional */
type,
texture_unit,
target,
+ context_ptr,
is_sviewinfo,
lod_property,
explicit_lod,
}
struct lp_build_sampler_soa *
-draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state,
- LLVMValueRef context_ptr)
+draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state)
{
struct draw_llvm_sampler_soa *sampler;
sampler->dynamic_state.base.lod_bias = draw_llvm_sampler_lod_bias;
sampler->dynamic_state.base.border_color = draw_llvm_sampler_border_color;
sampler->dynamic_state.static_state = static_state;
- sampler->dynamic_state.context_ptr = context_ptr;
return &sampler->base;
}
* 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);
{
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;
* 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);
}
/* 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");
/* 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);
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);
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;
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);
/** 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);
};
LLVMValueRef int_size;
LLVMValueRef border_color_clamped;
+
+ LLVMValueRef context_ptr;
};
boolean is_fetch,
unsigned texture_index,
unsigned sampler_index,
+ LLVMValueRef context_ptr,
const LLVMValueRef *coords,
const LLVMValueRef *offsets,
const struct lp_derivatives *derivs,
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,
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;
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;
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;
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);
boolean is_fetch,
unsigned texture_index,
unsigned sampler_index,
+ LLVMValueRef context_ptr,
const LLVMValueRef *coords,
const LLVMValueRef *offsets,
const struct lp_derivatives *derivs, /* optional */
/* 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;
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 */
}
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), "");
}
}
}
/* 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;
}
}
+
void
lp_build_size_query_soa(struct gallivm_state *gallivm,
const struct lp_static_texture_state *static_state,
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,
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 {
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?
/* 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);
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);
}
boolean is_fetch,
unsigned texture_index,
unsigned sampler_index,
+ LLVMValueRef context_ptr,
const LLVMValueRef *coords,
const LLVMValueRef *offsets,
const struct lp_derivatives *derivs,
struct lp_type type,
unsigned unit,
unsigned target,
+ LLVMValueRef context_ptr,
boolean need_nr_mips,
enum lp_sampler_lod_property,
LLVMValueRef explicit_lod, /* optional */
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);
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;
bld->bld_base.base.type,
FALSE,
unit, unit,
+ bld->context_ptr,
coords,
offsets,
deriv_ptr,
bld->bld_base.base.type,
FALSE,
texture_unit, sampler_unit,
+ bld->context_ptr,
coords,
offsets,
deriv_ptr,
bld->bld_base.base.type,
TRUE,
unit, unit,
+ bld->context_ptr,
coords,
offsets,
NULL,
bld->bld_base.base.gallivm,
bld->bld_base.int_bld.type,
unit, pipe_target,
+ bld->context_ptr,
TRUE,
lod_property,
explicit_lod,
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)
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
lp_build_tgsi_soa(gallivm, tokens, type, &mask,
consts_ptr, num_consts_ptr, &system_values,
interp->inputs,
- outputs, sampler, &shader->info.base, NULL);
+ outputs, context_ptr,
+ sampler, &shader->info.base, NULL);
/* Alpha test */
if (key->alpha.enabled) {
LLVMPositionBuilderAtEnd(builder, block);
/* code generated texture sampling */
- sampler = lp_llvm_sampler_soa_create(key->state, context_ptr);
+ sampler = lp_llvm_sampler_soa_create(key->state);
num_fs = 16 / fs_type.length; /* number of loops per 4x4 stamp */
/* for 1d resources only run "upper half" of stamp */
struct lp_sampler_dynamic_state base;
const struct lp_sampler_static_state *static_state;
-
- LLVMValueRef context_ptr;
};
static LLVMValueRef
lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
unsigned texture_unit,
unsigned member_index,
const char *member_name,
boolean emit_load)
{
- struct llvmpipe_sampler_dynamic_state *state =
- (struct llvmpipe_sampler_dynamic_state *)base;
LLVMBuilderRef builder = gallivm->builder;
LLVMValueRef indices[4];
LLVMValueRef ptr;
/* context[0].textures[unit].member */
indices[3] = lp_build_const_int32(gallivm, member_index);
- ptr = LLVMBuildGEP(builder, state->context_ptr, indices, Elements(indices), "");
+ ptr = LLVMBuildGEP(builder, context_ptr, indices, Elements(indices), "");
if (emit_load)
res = LLVMBuildLoad(builder, ptr, "");
static LLVMValueRef \
lp_llvm_texture_##_name( const struct lp_sampler_dynamic_state *base, \
struct gallivm_state *gallivm, \
+ LLVMValueRef context_ptr, \
unsigned texture_unit) \
{ \
- return lp_llvm_texture_member(base, gallivm, texture_unit, _index, #_name, _emit_load ); \
+ return lp_llvm_texture_member(base, gallivm, context_ptr, \
+ texture_unit, _index, #_name, _emit_load ); \
}
static LLVMValueRef
lp_llvm_sampler_member(const struct lp_sampler_dynamic_state *base,
struct gallivm_state *gallivm,
+ LLVMValueRef context_ptr,
unsigned sampler_unit,
unsigned member_index,
const char *member_name,
boolean emit_load)
{
- struct llvmpipe_sampler_dynamic_state *state =
- (struct llvmpipe_sampler_dynamic_state *)base;
LLVMBuilderRef builder = gallivm->builder;
LLVMValueRef indices[4];
LLVMValueRef ptr;
/* context[0].samplers[unit].member */
indices[3] = lp_build_const_int32(gallivm, member_index);
- ptr = LLVMBuildGEP(builder, state->context_ptr, indices, Elements(indices), "");
+ ptr = LLVMBuildGEP(builder, context_ptr, indices, Elements(indices), "");
if (emit_load)
res = LLVMBuildLoad(builder, ptr, "");
static LLVMValueRef \
lp_llvm_sampler_##_name( const struct lp_sampler_dynamic_state *base, \
struct gallivm_state *gallivm, \
+ LLVMValueRef context_ptr, \
unsigned sampler_unit) \
{ \
- return lp_llvm_sampler_member(base, gallivm, sampler_unit, _index, #_name, _emit_load ); \
+ return lp_llvm_sampler_member(base, gallivm, context_ptr, \
+ sampler_unit, _index, #_name, _emit_load ); \
}
boolean is_fetch,
unsigned texture_index,
unsigned sampler_index,
+ LLVMValueRef context_ptr,
const LLVMValueRef *coords,
const LLVMValueRef *offsets,
const struct lp_derivatives *derivs,
is_fetch,
texture_index,
sampler_index,
+ context_ptr,
coords,
offsets,
derivs,
struct lp_type type,
unsigned texture_unit,
unsigned target,
+ LLVMValueRef context_ptr,
boolean is_sviewinfo,
enum lp_sampler_lod_property lod_property,
LLVMValueRef explicit_lod, /* optional */
type,
texture_unit,
target,
+ context_ptr,
is_sviewinfo,
lod_property,
explicit_lod,
struct lp_build_sampler_soa *
-lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
- LLVMValueRef context_ptr)
+lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state)
{
struct lp_llvm_sampler_soa *sampler;
sampler->dynamic_state.base.border_color = lp_llvm_sampler_border_color;
sampler->dynamic_state.static_state = static_state;
- sampler->dynamic_state.context_ptr = context_ptr;
return &sampler->base;
}
/**
* Pure-LLVM texture sampling code generator.
*
- * @param context_ptr LLVM value with the pointer to the struct lp_jit_context.
*/
struct lp_build_sampler_soa *
-lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *key,
- LLVMValueRef context_ptr);
+lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *key);
#endif /* LP_TEX_SAMPLE_H */