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

Anuj Phogat anuj.phogat at gmail.com
Wed Nov 16 19:56:05 PST 2011


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

Hi,

Here is a patch to allow glTexImage2D and glCopyTexImage2D with depth component cubemap.
It is listed in mesa work queue with a label "CUBE1". I've tested the patch and output looks visually correct. 
Please review the fix and let me know if i'm missing something.

Thanks
Anuj
---
 src/mesa/main/teximage.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index acf7187..81f75c8 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1596,7 +1596,7 @@ 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 are supported, not 3D*/
       if (target != GL_TEXTURE_1D &&
           target != GL_PROXY_TEXTURE_1D &&
           target != GL_TEXTURE_2D &&
@@ -1606,7 +1606,13 @@ 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 &&
+	  target != GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
+	  target != GL_TEXTURE_CUBE_MAP_NEGATIVE_X &&
+	  target != GL_TEXTURE_CUBE_MAP_POSITIVE_Y &&
+          target != GL_TEXTURE_CUBE_MAP_NEGATIVE_Y &&
+	  target != GL_TEXTURE_CUBE_MAP_POSITIVE_Z &&
+	  target != GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) {
          if (!isProxy)
             _mesa_error(ctx, GL_INVALID_ENUM,
                         "glTexImage(target/internalFormat)");
-- 
1.7.7



More information about the mesa-dev mailing list