_mesa_enum_to_string(pname));
return false;
}
+ break;
+
+ case GL_CLEAR_TEXTURE:
+ if (!_mesa_has_ARB_clear_texture(ctx)) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetInternalformativ(pname=%s)",
+ _mesa_enum_to_string(pname));
+ return false;
+ }
FALLTHROUGH;
case GL_INTERNALFORMAT_SUPPORTED:
case GL_INTERNALFORMAT_PREFERRED:
case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE:
case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE:
case GL_CLEAR_BUFFER:
+ case GL_CLEAR_TEXTURE:
case GL_TEXTURE_VIEW:
case GL_VIEW_COMPATIBILITY_CLASS:
buffer[0] = GL_NONE;
return false;
/* additional checks for depth textures */
- if (!_mesa_legal_texture_base_format_for_target(ctx, target, internalformat))
+ if (!_mesa_legal_texture_base_format_for_target(ctx, target, internalformat) &&
+ !(pname == GL_CLEAR_TEXTURE && _mesa_is_depth_or_stencil_format(internalformat)))
return false;
/* additional checks for compressed textures */
case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE:
case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE:
case GL_CLEAR_BUFFER:
+ case GL_CLEAR_TEXTURE:
case GL_TEXTURE_VIEW:
case GL_TEXTURE_SHADOW:
case GL_TEXTURE_GATHER:
}
}
+static bool
+_is_generic_compressed_format(const struct gl_context *ctx,
+ GLenum intFormat)
+{
+ switch (intFormat) {
+ case GL_COMPRESSED_SRGB:
+ case GL_COMPRESSED_SRGB_ALPHA:
+ case GL_COMPRESSED_SLUMINANCE:
+ case GL_COMPRESSED_SLUMINANCE_ALPHA:
+ return _mesa_has_EXT_texture_sRGB(ctx);
+ case GL_COMPRESSED_RG:
+ case GL_COMPRESSED_RED:
+ return _mesa_is_gles(ctx) ?
+ _mesa_has_EXT_texture_rg(ctx) :
+ _mesa_has_ARB_texture_rg(ctx);
+ case GL_COMPRESSED_RGB:
+ case GL_COMPRESSED_RGBA:
+ return true;
+ default:
+ return false;
+ }
+}
+
/*
* Similar to teximage.c:check_multisample_target, but independent of the
* dimensions.
st_QueryInternalFormat(ctx, target, internalformat, pname,
buffer);
break;
+ case GL_CLEAR_TEXTURE: {
+ if (target == GL_TEXTURE_BUFFER ||
+ target == GL_RENDERBUFFER)
+ goto end;
+
+ if (_mesa_is_compressed_format(ctx, internalformat) ||
+ _is_generic_compressed_format(ctx, internalformat))
+ goto end;
+
+ st_QueryInternalFormat(ctx, target, internalformat, pname,
+ buffer);
+ break;
+ }
case GL_TEXTURE_VIEW:
case GL_VIEW_COMPATIBILITY_CLASS: