[Mesa-dev] [PATCH] Allow glTexImage2D with a depth component cube map
anuj.phogat at gmail.com
anuj.phogat at gmail.com
Mon Nov 21 14:45:39 PST 2011
From: Anuj Phogat <anuj.phogat at gmail.com>
Thanks for the review comments. Here is the updated patch to allow depth component cube maps in GL 3.0.
I'll post the piglit testcase for this patch in a separate e-mail.
Anuj
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
src/mesa/main/teximage.c | 27 +++++++++++++++++++++------
1 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index acf7187..f1391be 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, cube and array textures are supported, not 3D*/
if (target != GL_TEXTURE_1D &&
target != GL_PROXY_TEXTURE_1D &&
target != GL_TEXTURE_2D &&
@@ -1607,13 +1607,28 @@ texture_error_check( struct gl_context *ctx,
target != GL_PROXY_TEXTURE_2D_ARRAY &&
target != GL_TEXTURE_RECTANGLE_ARB &&
target != GL_PROXY_TEXTURE_RECTANGLE_ARB) {
- if (!isProxy)
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexImage(target/internalFormat)");
- return GL_TRUE;
+ if (ctx->VersionMajor >= 3 || ctx->Extensions.EXT_gpu_shader4) {
+ /*Cubemaps are only supported for GL version > 3.0 or with EXT_gpu_shader4*/
+ if (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 &&
+ target != GL_PROXY_TEXTURE_CUBE_MAP) {
+ if (!isProxy)
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage(target/internalFormat)");
+ return GL_TRUE;
+ }
+ }
+ else {
+ if (!isProxy)
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage(target/internalFormat)");
+ return GL_TRUE;
+ }
}
}
-
+
/* additional checks for compressed textures */
if (_mesa_is_compressed_format(ctx, internalFormat)) {
if (!target_can_be_compressed(ctx, target, internalFormat)) {
--
1.7.7
More information about the mesa-dev
mailing list