mesa/st: NumLayers is only valid for array textures
authorIlia Mirkin <imirkin@alum.mit.edu>
Wed, 24 Sep 2014 04:58:07 +0000 (00:58 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Fri, 26 Sep 2014 02:15:49 +0000 (22:15 -0400)
For 3d textures, NumLayers is set to 1, which is not what we want. This
fixes the newly added gl-layer-render-storage test (which constructs
immutable 3d textures). Fixes regression introduced in d82bd7eb060.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84145
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_cb_fbo.c
src/mesa/state_tracker/st_texture.c

index ed9a44429b4271d628fabd0d01fc6d66000916e7..19072ae2fe896fa12c4e69c813938e4e19a72e78 100644 (file)
@@ -223,7 +223,7 @@ static unsigned last_level(struct st_texture_object *stObj)
 
 static unsigned last_layer(struct st_texture_object *stObj)
 {
-   if (stObj->base.Immutable)
+   if (stObj->base.Immutable && stObj->pt->array_size > 1)
       return MIN2(stObj->base.MinLayer + stObj->base.NumLayers - 1,
                   stObj->pt->array_size - 1);
    return stObj->pt->array_size - 1;
index 470ab278b4b39cfa2d61e077c3896238dce36cce..7b6a444e6f53d760d5b4c011faf9f37db25dedb5 100644 (file)
@@ -451,7 +451,8 @@ st_update_renderbuffer_surface(struct st_context *st,
    }
 
    /* Adjust for texture views */
-   if (strb->is_rtt) {
+   if (strb->is_rtt && resource->array_size > 1 &&
+       strb->Base.TexImage->TexObject->Immutable) {
       struct gl_texture_object *tex = strb->Base.TexImage->TexObject;
       first_layer += tex->MinLayer;
       if (!strb->rtt_layered)
index c84aa4566b2088a3d22a9d1a4daad9c0d78f0253..2cd95ecdfa4be3218c732323d74f62716fe65834 100644 (file)
@@ -263,7 +263,8 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
    if (stObj->base.Immutable) {
       level += stObj->base.MinLevel;
       z += stObj->base.MinLayer;
-      d = MIN2(d, stObj->base.NumLayers);
+      if (stObj->pt->array_size > 1)
+         d = MIN2(d, stObj->base.NumLayers);
    }
 
    z += stImage->base.Face;