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

Ian Romanick idr at freedesktop.org
Fri Nov 18 15:11:26 PST 2011


On 11/16/2011 07:56 PM, Anuj Phogat wrote:
> 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) {

The cubemap targets are only valid in OpenGL 3.0 (or later) or when 
GL_EXT_gpu_shader4 is available.  Also, GL_PROXY_TEXTURE_CUBE_MAP is 
missing.

>            if (!isProxy)
>               _mesa_error(ctx, GL_INVALID_ENUM,
>                           "glTexImage(target/internalFormat)");



More information about the mesa-dev mailing list