[Mesa-dev] [PATCH] Allow glTexImage2D with a depth component cube map

Anuj Phogat anuj.phogat at gmail.com
Wed Nov 23 16:14:43 PST 2011


From: Anuj Phogat <anuj.phogat at gmail.com>

This is an updated patch to allow glTexImage2D with a depth component cube map. Patch
was producing an expected ouput with depth-cube-map test (posted on piglit mailing list).
But i'm getting an incorrect output since i updated my mesa branch with git://anongit.freedesktop.org/mesa/mesa.
Luminance value is not getting copied to green and blue channels. So the color value i'm seeing in fragment
shader is (L,0,0,1). I verified that this issue is only with depth cube maps not with depth 2D textures.
Is this a known issue? I will try to debug it further.

 -Anuj

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 src/mesa/main/teximage.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index c8ea432..7d23741 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1619,7 +1619,8 @@ texture_error_check( struct gl_context *ctx,
 
    /* additional checks for depth textures */
    if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) {
-      /* Only 1D, 2D, rect and array textures supported, not 3D or cubes */
+      /* Only 1D, 2D, rect, array and cube textures supported, not 3D
+       * Cubemaps are only supported for GL version > 3.0 or with EXT_gpu_shader4 */
       if (target != GL_TEXTURE_1D &&
           target != GL_PROXY_TEXTURE_1D &&
           target != GL_TEXTURE_2D &&
@@ -1629,7 +1630,9 @@ texture_error_check( struct gl_context *ctx,
           target != GL_TEXTURE_2D_ARRAY &&
           target != GL_PROXY_TEXTURE_2D_ARRAY &&
           target != GL_TEXTURE_RECTANGLE_ARB &&
-          target != GL_PROXY_TEXTURE_RECTANGLE_ARB) {
+          target != GL_PROXY_TEXTURE_RECTANGLE_ARB &&
+         !((_mesa_is_cube_face(target) || target == GL_PROXY_TEXTURE_CUBE_MAP) &&
+           (ctx->VersionMajor >= 3 || ctx->Extensions.EXT_gpu_shader4))) {
          if (!isProxy)
             _mesa_error(ctx, GL_INVALID_ENUM,
                         "glTexImage(target/internalFormat)");
-- 
1.7.7



More information about the mesa-dev mailing list