[Mesa-dev] [PATCH 5/7] mesa: Update TexStorage to support ARB_texture_view

Courtney Goeltzenleuchter courtney at lunarg.com
Tue Nov 5 14:59:47 PST 2013


TexStorage now updates texture object state needed by
ARB_texture_view extension.

Set appropriate TextureView state in texture object.
---
 src/mesa/main/texstorage.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 84b8f82..4da3c91 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -436,8 +436,41 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, GLenum internalformat,
          return;
       }
 
+      /* If the command is successful,
+       * TEXTURE_IMMUTABLE_FORMAT becomes TRUE.
+       * TEXTURE_IMMUTABLE_LEVELS and TEXTURE_VIEW_NUM_LEVELS become levels.
+       * If the texture target is TEXTURE_1D_ARRAY then
+       * TEXTURE_VIEW_NUM_LAYERS becomes height.
+       * If the texture target is TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,
+       * or TEXTURE_2D_MULTISAMPLE_ARRAY then TEXTURE_VIEW_NUM_LAYERS becomes depth.
+       * If the texture target is TEXTURE_CUBE_MAP, then
+       * TEXTURE_VIEW_NUM_LAYERS becomes 6.
+       * For any other texture target, TEXTURE_VIEW_NUM_LAYERS becomes 1.
+       */
+
       texObj->Immutable = GL_TRUE;
       texObj->ImmutableLevels = levels;
+      texObj->MinLevel = 0;
+      texObj->NumLevels = levels;
+      texObj->MinLayer = 0;
+      texObj->NumLayers = 1;
+      switch (target)
+      {
+      case GL_TEXTURE_1D_ARRAY:
+         texObj->NumLayers = height;
+         break;
+
+      case GL_TEXTURE_2D_ARRAY:
+      case GL_TEXTURE_CUBE_MAP_ARRAY:
+      case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+         texObj->NumLayers = depth;
+         break;
+
+      case GL_TEXTURE_CUBE_MAP:
+         texObj->NumLayers = 6;
+         break;
+      }
+
    }
 }
 
-- 
1.8.1.2



More information about the mesa-dev mailing list