diff options
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_tex_sample.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_tex_sample.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c index f0a4a34..1828069 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c @@ -65,8 +65,6 @@ struct llvmpipe_sampler_dynamic_state struct lp_sampler_dynamic_state base; const struct lp_sampler_static_state *static_state; - - LLVMValueRef context_ptr; }; @@ -92,13 +90,12 @@ struct lp_llvm_sampler_soa 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; @@ -115,7 +112,7 @@ lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base, /* 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, ""); @@ -141,9 +138,11 @@ lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base, 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 ); \ } @@ -169,13 +168,12 @@ LP_LLVM_TEXTURE_MEMBER(mip_offsets, LP_JIT_TEXTURE_MIP_OFFSETS, FALSE) 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; @@ -192,7 +190,7 @@ lp_llvm_sampler_member(const struct lp_sampler_dynamic_state *base, /* 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, ""); @@ -209,9 +207,11 @@ lp_llvm_sampler_member(const struct lp_sampler_dynamic_state *base, 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 ); \ } @@ -239,6 +239,7 @@ lp_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base, boolean is_fetch, unsigned texture_index, unsigned sampler_index, + LLVMValueRef context_ptr, const LLVMValueRef *coords, const LLVMValueRef *offsets, const struct lp_derivatives *derivs, @@ -265,6 +266,7 @@ lp_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base, is_fetch, texture_index, sampler_index, + context_ptr, coords, offsets, derivs, @@ -281,6 +283,7 @@ lp_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, 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 */ @@ -296,6 +299,7 @@ lp_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, type, texture_unit, target, + context_ptr, is_sviewinfo, lod_property, explicit_lod, @@ -304,8 +308,7 @@ lp_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, 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; @@ -331,7 +334,6 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state, 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; } |