X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fauxiliary%2Fdraw%2Fdraw_llvm_sample.c;h=8af34617353dfe1ee69fe04da1ae620ec1a3374e;hb=34a774797c17855043c8e1f701ada7f7aca39701;hp=2613224f75e8c047c26f70a65e1692b840c6915d;hpb=01eebfe1b6de2e36dd3af0952fc8329b7073a100;p=mesa.git diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c index 2613224f75e..8af34617353 100644 --- a/src/gallium/auxiliary/draw/draw_llvm_sample.c +++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c @@ -32,13 +32,13 @@ #include "pipe/p_defines.h" #include "pipe/p_shader_tokens.h" +#include "gallivm/lp_bld_const.h" #include "gallivm/lp_bld_debug.h" #include "gallivm/lp_bld_type.h" #include "gallivm/lp_bld_sample.h" #include "gallivm/lp_bld_tgsi.h" -#include "util/u_cpu_detect.h" #include "util/u_debug.h" #include "util/u_memory.h" #include "util/u_pointer.h" @@ -85,12 +85,13 @@ struct draw_llvm_sampler_soa */ static LLVMValueRef draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base, - LLVMBuilderRef builder, + struct gallivm_state *gallivm, unsigned 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]; @@ -100,13 +101,13 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base, debug_assert(unit < PIPE_MAX_VERTEX_SAMPLERS); /* context[0] */ - indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0); + indices[0] = lp_build_const_int32(gallivm, 0); /* context[0].textures */ - indices[1] = LLVMConstInt(LLVMInt32Type(), DRAW_JIT_CTX_TEXTURES, 0); + indices[1] = lp_build_const_int32(gallivm, DRAW_JIT_CTX_TEXTURES); /* context[0].textures[unit] */ - indices[2] = LLVMConstInt(LLVMInt32Type(), unit, 0); + indices[2] = lp_build_const_int32(gallivm, unit); /* context[0].textures[unit].member */ - indices[3] = LLVMConstInt(LLVMInt32Type(), member_index, 0); + indices[3] = lp_build_const_int32(gallivm, member_index); ptr = LLVMBuildGEP(builder, state->context_ptr, indices, Elements(indices), ""); @@ -133,20 +134,25 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base, #define DRAW_LLVM_TEXTURE_MEMBER(_name, _index, _emit_load) \ static LLVMValueRef \ draw_llvm_texture_##_name( const struct lp_sampler_dynamic_state *base, \ - LLVMBuilderRef builder, \ + struct gallivm_state *gallivm, \ unsigned unit) \ { \ - return draw_llvm_texture_member(base, builder, unit, _index, #_name, _emit_load ); \ + return draw_llvm_texture_member(base, gallivm, unit, _index, #_name, _emit_load ); \ } DRAW_LLVM_TEXTURE_MEMBER(width, DRAW_JIT_TEXTURE_WIDTH, TRUE) DRAW_LLVM_TEXTURE_MEMBER(height, DRAW_JIT_TEXTURE_HEIGHT, TRUE) DRAW_LLVM_TEXTURE_MEMBER(depth, DRAW_JIT_TEXTURE_DEPTH, TRUE) +DRAW_LLVM_TEXTURE_MEMBER(first_level,DRAW_JIT_TEXTURE_FIRST_LEVEL, TRUE) DRAW_LLVM_TEXTURE_MEMBER(last_level, DRAW_JIT_TEXTURE_LAST_LEVEL, TRUE) DRAW_LLVM_TEXTURE_MEMBER(row_stride, DRAW_JIT_TEXTURE_ROW_STRIDE, FALSE) DRAW_LLVM_TEXTURE_MEMBER(img_stride, DRAW_JIT_TEXTURE_IMG_STRIDE, FALSE) DRAW_LLVM_TEXTURE_MEMBER(data_ptr, DRAW_JIT_TEXTURE_DATA, FALSE) +DRAW_LLVM_TEXTURE_MEMBER(min_lod, DRAW_JIT_TEXTURE_MIN_LOD, TRUE) +DRAW_LLVM_TEXTURE_MEMBER(max_lod, DRAW_JIT_TEXTURE_MAX_LOD, TRUE) +DRAW_LLVM_TEXTURE_MEMBER(lod_bias, DRAW_JIT_TEXTURE_LOD_BIAS, TRUE) +DRAW_LLVM_TEXTURE_MEMBER(border_color, DRAW_JIT_TEXTURE_BORDER_COLOR, FALSE) static void @@ -162,7 +168,7 @@ draw_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler) */ static void draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base, - LLVMBuilderRef builder, + struct gallivm_state *gallivm, struct lp_type type, unsigned unit, unsigned num_coords, @@ -177,7 +183,7 @@ draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base, assert(unit < PIPE_MAX_VERTEX_SAMPLERS); - lp_build_sample_soa(builder, + lp_build_sample_soa(gallivm, &sampler->dynamic_state.static_state[unit], &sampler->dynamic_state.base, type, @@ -204,10 +210,15 @@ draw_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state, sampler->dynamic_state.base.width = draw_llvm_texture_width; sampler->dynamic_state.base.height = draw_llvm_texture_height; sampler->dynamic_state.base.depth = draw_llvm_texture_depth; + sampler->dynamic_state.base.first_level = draw_llvm_texture_first_level; sampler->dynamic_state.base.last_level = draw_llvm_texture_last_level; sampler->dynamic_state.base.row_stride = draw_llvm_texture_row_stride; sampler->dynamic_state.base.img_stride = draw_llvm_texture_img_stride; sampler->dynamic_state.base.data_ptr = draw_llvm_texture_data_ptr; + sampler->dynamic_state.base.min_lod = draw_llvm_texture_min_lod; + sampler->dynamic_state.base.max_lod = draw_llvm_texture_max_lod; + sampler->dynamic_state.base.lod_bias = draw_llvm_texture_lod_bias; + sampler->dynamic_state.base.border_color = draw_llvm_texture_border_color; sampler->dynamic_state.static_state = static_state; sampler->dynamic_state.context_ptr = context_ptr;