diff options
author | Dave Airlie <[email protected]> | 2012-12-08 06:00:30 +0000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2012-12-11 09:38:01 +1000 |
commit | 8000e7b4b6e2866b42de19448cbf3412cce1f26c (patch) | |
tree | 14cfeb2dead413a00e6669fd3baeec0ba3cfb90f | |
parent | 41f4f094c484b3eb040e1a892f0a5c5533ac7321 (diff) |
llvmpipe: fix txq for 1d/2d arrays. (v3)
Noticed would fail, we were doing two things wrong
a) 1d arrays require the layers in height
b) minifying the layers field.
v2: don't change height code, fixup completely inside txq
as suggested by Roland.
v3: just add minify before texture array size
v1: Reviewed-by: Jose Fonseca <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index ba265b237df..8c59119b076 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -1681,6 +1681,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, LLVMValueRef lod; LLVMValueRef size; int dims, i; + boolean has_array = FALSE; struct lp_build_context bld_int_vec; switch (static_state->target) { @@ -1688,6 +1689,10 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, case PIPE_BUFFER: dims = 1; break; + case PIPE_TEXTURE_1D_ARRAY: + dims = 1; + has_array = TRUE; + break; case PIPE_TEXTURE_2D: case PIPE_TEXTURE_CUBE: case PIPE_TEXTURE_RECT: @@ -1696,7 +1701,10 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, case PIPE_TEXTURE_3D: dims = 3; break; - + case PIPE_TEXTURE_2D_ARRAY: + dims = 2; + has_array = TRUE; + break; default: assert(0); return; @@ -1736,8 +1744,13 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, } size = lp_build_minify(&bld_int_vec, size, lod); + + if (has_array) + size = LLVMBuildInsertElement(gallivm->builder, size, + dynamic_state->depth(dynamic_state, gallivm, unit), + lp_build_const_int32(gallivm, dims), ""); - for (i=0; i < dims; i++) { + for (i = 0; i < dims + (has_array ? 1 : 0); i++) { sizes_out[i] = lp_build_extract_broadcast(gallivm, bld_int_vec.type, int_type, size, lp_build_const_int32(gallivm, i)); |