[Mesa-dev] [PATCH] llvmpipe: fix txq for 1d/2d arrays. (v2)
Dave Airlie
airlied at gmail.com
Mon Dec 10 13:36:16 PST 2012
From: Dave Airlie <airlied at redhat.com>
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.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 26 +++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index ba265b2..dbedd01 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;
@@ -1723,21 +1731,31 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
dynamic_state->width(dynamic_state, gallivm, unit),
lp_build_const_int32(gallivm, 0), "");
+ if (dims == 1)
+ size = lp_build_minify(&bld_int_vec, size, lod);
+
if (dims >= 2) {
size = LLVMBuildInsertElement(gallivm->builder, size,
dynamic_state->height(dynamic_state, gallivm, unit),
lp_build_const_int32(gallivm, 1), "");
+ if (dims == 2)
+ size = lp_build_minify(&bld_int_vec, size, lod);
}
if (dims >= 3) {
size = LLVMBuildInsertElement(gallivm->builder, size,
dynamic_state->depth(dynamic_state, gallivm, unit),
lp_build_const_int32(gallivm, 2), "");
+ if (dims == 3)
+ 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), "");
- size = lp_build_minify(&bld_int_vec, size, lod);
-
- 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));
--
1.8.0.1
More information about the mesa-dev
mailing list