* \param ctx GL context
* \param target Texture target
* \param internalFormat Internal format of the texture image
- * \param dimensions Dimensionality at the caller. This is \b not used
- * in the validation. It is only used when logging
- * error messages.
- * \param caller Base name of the calling function (e.g.,
- * "glTexImage" or "glTexStorage").
*
* \returns true if the combination is legal, false otherwise.
*/
bool
_mesa_legal_texture_base_format_for_target(struct gl_context *ctx,
- GLenum target, GLenum internalFormat,
- unsigned dimensions,
- const char *caller)
+ GLenum target, GLenum internalFormat)
{
if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT
|| _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL
!((target == GL_TEXTURE_CUBE_MAP_ARRAY ||
target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY) &&
ctx->Extensions.ARB_texture_cube_map_array)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "%s%dD(bad target for depth texture)",
- caller, dimensions);
return false;
}
}
}
/* additional checks for depth textures */
- if (!_mesa_legal_texture_base_format_for_target(ctx, target, internalFormat,
- dimensions, "glTexImage"))
+ if (!_mesa_legal_texture_base_format_for_target(ctx, target, internalFormat)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexImage%dD(bad target for texture)", dimensions);
return GL_TRUE;
+ }
/* additional checks for compressed textures */
if (_mesa_is_compressed_format(ctx, internalFormat)) {
}
/* additional checks for depth textures */
- if (!_mesa_legal_texture_base_format_for_target(ctx, target, internalformat,
- dims, dsa ?
- "glTextureStorage" :
- "glTexStorage"))
+ if (!_mesa_legal_texture_base_format_for_target(ctx, target, internalformat)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTex%sStorage%uD(bad target for texture)",
+ suffix, dims);
return GL_TRUE;
+ }
return GL_FALSE;
}