mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 07:18:17 +02:00
Additional error checking for glTexImageXD.
Only allow 1D and 2D GL_DEPTH_COMPONENT textures. Make sure internal format and user format are in same catagory.
This commit is contained in:
parent
13ad04719e
commit
601df9c742
1 changed files with 31 additions and 7 deletions
|
|
@ -1294,16 +1294,25 @@ texture_error_check( GLcontext *ctx, GLenum target,
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
if (format == GL_YCBCR_MESA || internalFormat == GL_YCBCR_MESA) {
|
||||
/* make sure internal format and format basically agree */
|
||||
if ((is_color_format(internalFormat) != is_color_format(format)) ||
|
||||
(is_index_format(internalFormat) != is_index_format(format)) ||
|
||||
(is_depth_format(internalFormat) != is_depth_format(format)) ||
|
||||
(is_ycbcr_format(internalFormat) != is_ycbcr_format(format))) {
|
||||
if (!isProxy)
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glTexImage(internalFormat/format)");
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
/* additional checks for ycbcr textures */
|
||||
if (internalFormat == GL_YCBCR_MESA) {
|
||||
ASSERT(ctx->Extensions.MESA_ycbcr_texture);
|
||||
if (format != GL_YCBCR_MESA ||
|
||||
internalFormat != GL_YCBCR_MESA ||
|
||||
(type != GL_UNSIGNED_SHORT_8_8_MESA &&
|
||||
type != GL_UNSIGNED_SHORT_8_8_REV_MESA)) {
|
||||
if (type != GL_UNSIGNED_SHORT_8_8_MESA &&
|
||||
type != GL_UNSIGNED_SHORT_8_8_REV_MESA) {
|
||||
char message[100];
|
||||
_mesa_sprintf(message,
|
||||
"glTexImage%d(format/type/internalFormat YCBCR mismatch",
|
||||
dimensions);
|
||||
"glTexImage%d(format/type YCBCR mismatch", dimensions);
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, message);
|
||||
return GL_TRUE; /* error */
|
||||
}
|
||||
|
|
@ -1327,6 +1336,21 @@ texture_error_check( GLcontext *ctx, GLenum target,
|
|||
}
|
||||
}
|
||||
|
||||
/* additional checks for depth textures */
|
||||
if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) {
|
||||
/* Only 1D and 2D textures supported */
|
||||
if (target != GL_TEXTURE_1D &&
|
||||
target != GL_PROXY_TEXTURE_1D &&
|
||||
target != GL_TEXTURE_2D &&
|
||||
target != GL_PROXY_TEXTURE_2D) {
|
||||
if (!isProxy)
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"glTexImage(target/internalFormat)");
|
||||
return GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* additional checks for compressed textures */
|
||||
if (is_compressed_format(ctx, internalFormat)) {
|
||||
if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) {
|
||||
/* OK */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue