{
GET_CURRENT_CONTEXT(ctx);
- if (!ctx->Extensions.ARB_sample_shading || !_mesa_is_desktop_gl(ctx)) {
+ if (!_mesa_has_ARB_sample_shading(ctx) &&
+ !_mesa_has_OES_sample_shading(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glMinSampleShading");
return;
}
_mesa_check_sample_count(struct gl_context *ctx, GLenum target,
GLenum internalFormat, GLsizei samples)
{
- /* Section 2.5 (GL Errors) of OpenGL 3.0 specification, page 16:
- *
- * "If a negative number is provided where an argument of type sizei or
- * sizeiptr is specified, the error INVALID VALUE is generated."
- */
- if (samples < 0) {
- return GL_INVALID_VALUE;
- }
-
/* Section 4.4 (Framebuffer objects), page 198 of the OpenGL ES 3.0.0
* specification says:
*
* "If internalformat is a signed or unsigned integer format and samples
* is greater than zero, then the error INVALID_OPERATION is generated."
+ *
+ * This restriction is relaxed for OpenGL ES 3.1.
*/
- if (_mesa_is_gles3(ctx) && _mesa_is_enum_format_integer(internalFormat)
+ if ((ctx->API == API_OPENGLES2 && ctx->Version == 30) &&
+ _mesa_is_enum_format_integer(internalFormat)
&& samples > 0) {
return GL_INVALID_OPERATION;
}
* for <internalformat> then the error INVALID_OPERATION is generated."
*/
if (ctx->Extensions.ARB_internalformat_query) {
- GLint buffer[16];
- int count = ctx->Driver.QuerySamplesForFormat(ctx, target,
- internalFormat, buffer);
- int limit = count ? buffer[0] : -1;
+ GLint buffer[16] = {-1};
+ GLint limit;
+
+ ctx->Driver.QueryInternalFormat(ctx, target, internalFormat,
+ GL_SAMPLES, buffer);
+ /* since the query returns samples sorted in descending order,
+ * the first element is the greatest supported sample value.
+ */
+ limit = buffer[0];
return samples > limit ? GL_INVALID_OPERATION : GL_NO_ERROR;
}