[Mesa-dev] [PATCH 2/2] llvmpipe: fix txq for 1d/2d arrays.

Dave Airlie airlied at gmail.com
Fri Dec 7 22:02:05 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.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 22 +++++++++++++++++-----
 src/gallium/drivers/llvmpipe/lp_setup.c           |  6 +++++-
 2 files changed, 22 insertions(+), 6 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..c0389a8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1680,23 +1680,30 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
 {
    LLVMValueRef lod;
    LLVMValueRef size;
-   int dims, i;
+   int dims, i, num_min;
    struct lp_build_context bld_int_vec;
 
    switch (static_state->target) {
    case PIPE_TEXTURE_1D:
    case PIPE_BUFFER:
-      dims = 1;
+      num_min = dims = 1;
+      break;
+   case PIPE_TEXTURE_1D_ARRAY:
+      num_min = 1;
+      dims = 2;
       break;
    case PIPE_TEXTURE_2D:
    case PIPE_TEXTURE_CUBE:
    case PIPE_TEXTURE_RECT:
-      dims = 2;
+      num_min = dims = 2;
       break;
    case PIPE_TEXTURE_3D:
+      num_min = dims = 3;
+      break;
+   case PIPE_TEXTURE_2D_ARRAY:
+      num_min = 2;
       dims = 3;
       break;
-
    default:
       assert(0);
       return;
@@ -1723,19 +1730,24 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
                                  dynamic_state->width(dynamic_state, gallivm, unit),
                                  lp_build_const_int32(gallivm, 0), "");
 
+   if (num_min == 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 (num_min == 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), "");
    }
 
-   size = lp_build_minify(&bld_int_vec, size, lod);
+   if (num_min == 3)
+      size = lp_build_minify(&bld_int_vec, size, lod);
 
    for (i=0; i < dims; i++) {
       sizes_out[i] = lp_build_extract_broadcast(gallivm, bld_int_vec.type, int_type,
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 7d40d8c..3dfe335 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -678,7 +678,11 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
          struct lp_jit_texture *jit_tex;
          jit_tex = &setup->fs.current.jit_context.textures[i];
          jit_tex->width = tex->width0;
-         jit_tex->height = tex->height0;
+         if (tex->target == PIPE_TEXTURE_1D_ARRAY) {
+            jit_tex->height = tex->array_size;
+         } else {
+            jit_tex->height = tex->height0;
+         }
          jit_tex->first_level = view->u.tex.first_level;
          jit_tex->last_level = tex->last_level;
 
-- 
1.7.11.7



More information about the mesa-dev mailing list