Expect width and height = 1, not default, for textures with no such dimension.
authorJarkko Pöyry <jpoyry@google.com>
Tue, 3 Mar 2015 20:54:18 +0000 (12:54 -0800)
committerJarkko Pöyry <jpoyry@google.com>
Tue, 3 Mar 2015 20:59:47 +0000 (12:59 -0800)
- Expect DEPTH = 1 for 2D texures. This is consistent with the spec's
  definition of a 2D texel array. (Texture level represents a texel
  array.)
- Expect HEIGHT = 1 for 1D (buffer) textures for consistency.
- Fix texture buffer buffer leak.

Bug: 19578475
Change-Id: Ieea2ebc0f21746fe64c5b8c6668cf92921e7ea88

modules/gles31/functional/es31fTextureLevelStateQueryTests.cpp

index 0b9d0a231333eee9980d4cc1328813066797d3d8..9ffd21cda8b95f25dc58b3a64885227089e3ef5b 100644 (file)
@@ -411,7 +411,7 @@ static void generateColorTextureGenerationGroup (std::vector<TextureGenerationSp
 
                        level.width                             = 16;
                        level.height                    = 16;
-                       level.depth                             = (textureTypeHasDepth(texGen.bindTarget)) ? (6) : (0);
+                       level.depth                             = (textureTypeHasDepth(texGen.bindTarget)) ? (6) : (1);
                        level.level                             = 0;
                        level.internalFormat    = internalFormat;
                        level.compressed                = false;
@@ -432,7 +432,7 @@ static void generateColorTextureGenerationGroup (std::vector<TextureGenerationSp
 
                        level.width                             = 32;
                        level.height                    = 32;
-                       level.depth                             = (textureTypeHasDepth(texGen.bindTarget)) ? (6) : (0);
+                       level.depth                             = (textureTypeHasDepth(texGen.bindTarget)) ? (6) : (1);
                        level.level                             = 0;
                        level.internalFormat    = internalFormat;
                        level.compressed                = false;
@@ -453,7 +453,7 @@ static void generateColorTextureGenerationGroup (std::vector<TextureGenerationSp
 
                        level.width                             = 32;
                        level.height                    = 32;
-                       level.depth                             = (textureTypeHasDepth(texGen.bindTarget)) ? (6) : (0);
+                       level.depth                             = (textureTypeHasDepth(texGen.bindTarget)) ? (6) : (1);
                        level.level                             = 0;
                        level.internalFormat    = internalFormat;
                        level.compressed                = false;
@@ -479,8 +479,8 @@ static void generateColorTextureGenerationGroup (std::vector<TextureGenerationSp
                        texGen.bindWholeArray           = true;
 
                        level.width                             = 32;
-                       level.height                    = 0;
-                       level.depth                             = 0;
+                       level.height                    = 1;
+                       level.depth                             = 1;
                        level.level                             = 0;
                        level.internalFormat    = internalFormat;
                        level.compressed                = false;
@@ -503,8 +503,8 @@ static void generateColorTextureGenerationGroup (std::vector<TextureGenerationSp
                        texGen.bindWholeArray           = false;
 
                        level.width                             = 16;
-                       level.height                    = 0;
-                       level.depth                             = 0;
+                       level.height                    = 1;
+                       level.depth                             = 1;
                        level.level                             = 0;
                        level.internalFormat    = internalFormat;
                        level.compressed                = false;
@@ -527,7 +527,7 @@ static void generateColorTextureGenerationGroup (std::vector<TextureGenerationSp
 
                        level.width                             = 32;
                        level.height                    = 32;
-                       level.depth                             = (textureTypeHasDepth(texGen.bindTarget)) ? (6) : (0);
+                       level.depth                             = (textureTypeHasDepth(texGen.bindTarget)) ? (6) : (1);
                        level.level                             = 0;
                        level.internalFormat    = internalFormat;
                        level.compressed                = false;
@@ -547,7 +547,7 @@ static void generateColorTextureGenerationGroup (std::vector<TextureGenerationSp
 
                        level.width                             = 16;
                        level.height                    = (target == GL_TEXTURE_CUBE_MAP || target == GL_TEXTURE_CUBE_MAP_ARRAY) ? (16) : (64);
-                       level.depth                             = (textureTypeHasDepth(texGen.bindTarget)) ? (6) : (0);
+                       level.depth                             = (textureTypeHasDepth(texGen.bindTarget)) ? (6) : (1);
                        level.level                             = 0;
                        level.internalFormat    = internalFormat;
                        level.compressed                = false;
@@ -567,7 +567,7 @@ static void generateColorTextureGenerationGroup (std::vector<TextureGenerationSp
 
                        level.width                             = 4;
                        level.height                    = (target == GL_TEXTURE_CUBE_MAP || target == GL_TEXTURE_CUBE_MAP_ARRAY) ? (4) : (8);
-                       level.depth                             = (textureTypeHasDepth(texGen.bindTarget)) ? (6) : (0);
+                       level.depth                             = (textureTypeHasDepth(texGen.bindTarget)) ? (6) : (1);
                        level.level                             = 3;
                        level.internalFormat    = internalFormat;
                        level.compressed                = false;
@@ -633,8 +633,8 @@ static void generateInternalFormatTextureGenerationGroup (std::vector<TextureGen
                }
 
                level.width                             = 32;
-               level.height                    = (textureTypeHasHeight(target)) ? (32) : (0);
-               level.depth                             = (textureTypeHasDepth(target)) ? (6) : (0);
+               level.height                    = (textureTypeHasHeight(target)) ? (32) : (1);
+               level.depth                             = (textureTypeHasDepth(target)) ? (6) : (1);
                level.level                             = 0;
                level.internalFormat    = internalFormats[internalFormatNdx];
                level.compressed                = false;
@@ -656,7 +656,7 @@ static void generateInternalFormatTextureGenerationGroup (std::vector<TextureGen
 
                level.width                             = 32;
                level.height                    = 32;
-               level.depth                             = (textureTypeHasDepth(target)) ? (6) : (0);
+               level.depth                             = (textureTypeHasDepth(target)) ? (6) : (1);
                level.level                             = 3;
                level.internalFormat    = GL_RGBA8;
                level.compressed                = false;
@@ -694,7 +694,7 @@ static void generateCompressedTextureGenerationGroup (std::vector<TextureGenerat
 
                level.width                             = 32;
                level.height                    = 32;
-               level.depth                             = (target == GL_TEXTURE_2D_ARRAY) ? (2) : (0);
+               level.depth                             = (target == GL_TEXTURE_2D_ARRAY) ? (2) : (1);
                level.level                             = 0;
                level.internalFormat    = GL_COMPRESSED_RGB8_ETC2;
                level.compressed                = true;
@@ -962,7 +962,7 @@ bool TextureLevelCase::testConfig (const TextureGenerationSpec& spec)
 
        if (m_texBuffer)
        {
-               gl.glDeleteTextures(1, &m_texBuffer);
+               gl.glDeleteBuffers(1, &m_texBuffer);
                m_texture = 0;
        }