diff options
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r-- | src/mesa/main/teximage.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 2bc7abdc247..2bdcedc8c13 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -493,6 +493,15 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) } } + if (ctx->Extensions.OES_compressed_ETC1_RGB8_texture) { + switch (internalFormat) { + case GL_ETC1_RGB8_OES: + return GL_RGB; + default: + ; /* fallthrough */ + } + } + if (ctx->API == API_OPENGLES) { switch (internalFormat) { case GL_PALETTE4_RGB8_OES: @@ -1292,6 +1301,20 @@ legal_texture_size(struct gl_context *ctx, gl_format format, } +/** + * Return true if the format is only valid for glCompressedTexImage. + */ +static GLboolean +compressedteximage_only_format(const struct gl_context *ctx, GLenum format) +{ + switch (format) { + case GL_ETC1_RGB8_OES: + return GL_TRUE; + default: + return GL_FALSE; + } +} + /** * Helper function to determine whether a target and specific compression @@ -1639,6 +1662,11 @@ texture_error_check( struct gl_context *ctx, "glTexImage%dD(target)", dimensions); return GL_TRUE; } + if (compressedteximage_only_format(ctx, internalFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage%dD(no compression for format)", dimensions); + return GL_TRUE; + } if (border != 0) { if (!isProxy) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -1793,6 +1821,12 @@ subtexture_error_check2( struct gl_context *ctx, GLuint dimensions, if (_mesa_is_format_compressed(destTex->TexFormat)) { GLuint bw, bh; + if (compressedteximage_only_format(ctx, destTex->InternalFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexSubImage%dD(no compression for format)", dimensions); + return GL_TRUE; + } + /* do tests which depend on compression block size */ _mesa_get_format_block_size(destTex->TexFormat, &bw, &bh); @@ -1922,6 +1956,11 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, "glCopyTexImage%dD(target)", dimensions); return GL_TRUE; } + if (compressedteximage_only_format(ctx, internalFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexImage%dD(no compression for format)", dimensions); + return GL_TRUE; + } if (border != 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexImage%dD(border!=0)", dimensions); @@ -2061,6 +2100,11 @@ copytexsubimage_error_check2( struct gl_context *ctx, GLuint dimensions, } if (_mesa_is_format_compressed(teximage->TexFormat)) { + if (compressedteximage_only_format(ctx, teximage->InternalFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexSubImage%dD(no compression for format)", dimensions); + return GL_TRUE; + } /* offset must be multiple of 4 */ if ((xoffset & 3) || (yoffset & 3)) { _mesa_error(ctx, GL_INVALID_VALUE, @@ -3244,6 +3288,13 @@ compressed_subtexture_error_check2(struct gl_context *ctx, GLuint dims, return GL_TRUE; } + if (compressedteximage_only_format(ctx, format)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCompressedTexSubImage%uD(format=0x%x cannot be updated)" + , dims, format); + return GL_TRUE; + } + if (((width == 1 || width == 2) && width != (GLsizei) texImage->Width) || (width > (GLsizei) texImage->Width)) { |