X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fmultisample.c;h=5453e38632e3b73f0c90aa3be60d0ebcb77c0a36;hb=34953f8907fddd0d2b27d276580a1d3223047987;hp=0e9207bc16eff91a4b4153add939699a11098c45;hpb=0bfe21e8e0bf6c80d46e82b7b8382e75881f2d64;p=mesa.git diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c index 0e9207bc16e..5453e38632e 100644 --- a/src/mesa/main/multisample.c +++ b/src/mesa/main/multisample.c @@ -43,7 +43,7 @@ _mesa_SampleCoverage(GLclampf value, GLboolean invert) FLUSH_VERTICES(ctx, 0); - ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0); + ctx->Multisample.SampleCoverageValue = CLAMP(value, 0.0f, 1.0f); ctx->Multisample.SampleCoverageInvert = invert; ctx->NewState |= _NEW_MULTISAMPLE; } @@ -127,14 +127,15 @@ _mesa_MinSampleShading(GLclampf value) { 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; } FLUSH_VERTICES(ctx, 0); - ctx->Multisample.MinSampleShadingValue = CLAMP(value, 0.0, 1.0); + ctx->Multisample.MinSampleShadingValue = CLAMP(value, 0.0f, 1.0f); ctx->NewState |= _NEW_MULTISAMPLE; } @@ -155,8 +156,11 @@ _mesa_check_sample_count(struct gl_context *ctx, GLenum target, * * "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; } @@ -171,10 +175,15 @@ _mesa_check_sample_count(struct gl_context *ctx, GLenum target, * for 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; }