diff options
author | Roland Scheidegger <[email protected]> | 2013-08-08 17:18:44 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-08-09 20:49:19 +0200 |
commit | 894d4903e7325620fa2344ce1640658346b3e75f (patch) | |
tree | bd53869ca88a3b40cafe64851e55384790c1bf0e /src | |
parent | b0f74250e1496d4872fd731b45049868b3efc883 (diff) |
gallivm: set non-existing values really to zero in size queries for d3d10
My previous attempt at doing so double-failed miserably (minification of
zero still gives one, and even if it would not the value was never written
anyway).
While here also rename the confusingly named int_vec bld as we have int vecs
of different sizes, and rename need_nr_mips (as this also changes out-of-bounds
behavior) to is_sviewinfo too.
Reviewed-by: Zack Rusin <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm_sample.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample.h | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 34 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_tex_sample.c | 4 |
4 files changed, 22 insertions, 22 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c index f10cba3279c..97b025565c3 100644 --- a/src/gallium/auxiliary/draw/draw_llvm_sample.c +++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c @@ -271,7 +271,7 @@ draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, struct lp_type type, unsigned texture_unit, unsigned target, - boolean need_nr_mips, + boolean is_sviewinfo, boolean scalar_lod, LLVMValueRef explicit_lod, /* optional */ LLVMValueRef *sizes_out) @@ -286,7 +286,7 @@ draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, type, texture_unit, target, - need_nr_mips, + is_sviewinfo, scalar_lod, explicit_lod, sizes_out); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index db3ea1df59f..75e8c593f51 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -498,7 +498,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, struct lp_type int_type, unsigned texture_unit, unsigned target, - boolean need_nr_mips, + boolean is_viewinfo, boolean scalar_lod, LLVMValueRef explicit_lod, LLVMValueRef *sizes_out); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index e403ac83c6a..65d6e7b1e49 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -1944,7 +1944,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, struct lp_type int_type, unsigned texture_unit, unsigned target, - boolean need_nr_mips, + boolean is_sviewinfo, boolean scalar_lod, LLVMValueRef explicit_lod, LLVMValueRef *sizes_out) @@ -1954,7 +1954,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, int dims, i; boolean has_array; unsigned num_lods = 1; - struct lp_build_context bld_int_vec; + struct lp_build_context bld_int_vec4; /* * Do some sanity verification about bound texture and shader dcl target. @@ -1997,24 +1997,19 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, assert(!int_type.floating); - lp_build_context_init(&bld_int_vec, gallivm, lp_type_int_vec(32, 128)); + lp_build_context_init(&bld_int_vec4, gallivm, lp_type_int_vec(32, 128)); 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); level = LLVMBuildAdd(gallivm->builder, lod, first_level, "level"); - lod = lp_build_broadcast_scalar(&bld_int_vec, level); + lod = lp_build_broadcast_scalar(&bld_int_vec4, level); } else { - lod = bld_int_vec.zero; + lod = bld_int_vec4.zero; } - if (need_nr_mips) { - size = bld_int_vec.zero; - } - else { - size = bld_int_vec.undef; - } + size = bld_int_vec4.undef; size = LLVMBuildInsertElement(gallivm->builder, size, dynamic_state->width(dynamic_state, gallivm, texture_unit), @@ -2032,7 +2027,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, lp_build_const_int32(gallivm, 2), ""); } - size = lp_build_minify(&bld_int_vec, size, lod); + size = lp_build_minify(&bld_int_vec4, size, lod); if (has_array) size = LLVMBuildInsertElement(gallivm->builder, size, @@ -2044,7 +2039,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, * if level is out of bounds (note this can't cover unbound texture * here, which also requires returning zero). */ - if (explicit_lod && need_nr_mips) { + if (explicit_lod && is_sviewinfo) { LLVMValueRef last_level, out, out1; struct lp_build_context leveli_bld; @@ -2056,25 +2051,30 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, out1 = lp_build_cmp(&leveli_bld, PIPE_FUNC_GREATER, level, last_level); out = lp_build_or(&leveli_bld, out, out1); if (num_lods == 1) { - out = lp_build_broadcast_scalar(&bld_int_vec, out); + out = lp_build_broadcast_scalar(&bld_int_vec4, out); } else { /* TODO */ assert(0); } - size = lp_build_andnot(&bld_int_vec, size, out); + size = lp_build_andnot(&bld_int_vec4, size, out); } for (i = 0; i < dims + (has_array ? 1 : 0); i++) { - sizes_out[i] = lp_build_extract_broadcast(gallivm, bld_int_vec.type, int_type, + sizes_out[i] = lp_build_extract_broadcast(gallivm, bld_int_vec4.type, int_type, size, lp_build_const_int32(gallivm, i)); } + if (is_sviewinfo) { + for (; i < 4; i++) { + sizes_out[i] = lp_build_const_vec(gallivm, int_type, 0.0); + } + } /* * if there's no explicit_lod (buffers, rects) queries requiring nr of * mips would be illegal. */ - if (need_nr_mips && explicit_lod) { + if (is_sviewinfo && explicit_lod) { struct lp_build_context bld_int_scalar; LLVMValueRef num_levels; lp_build_context_init(&bld_int_scalar, gallivm, lp_type_int(32)); diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c index 5402de407d5..68a4be93223 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c @@ -281,7 +281,7 @@ lp_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, struct lp_type type, unsigned texture_unit, unsigned target, - boolean need_nr_mips, + boolean is_sviewinfo, boolean scalar_lod, LLVMValueRef explicit_lod, /* optional */ LLVMValueRef *sizes_out) @@ -296,7 +296,7 @@ lp_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, type, texture_unit, target, - need_nr_mips, + is_sviewinfo, scalar_lod, explicit_lod, sizes_out); |