mesa/multisample: Check sample count using the new driver hook
authorEduardo Lima Mitev <elima@igalia.com>
Tue, 24 Nov 2015 21:32:00 +0000 (22:32 +0100)
committerEduardo Lima Mitev <elima@igalia.com>
Thu, 3 Mar 2016 14:14:05 +0000 (15:14 +0100)
Use QueryInternalFormat instead of QuerySamplesForFormat to obtain the
highest supported sample. QuerySamplesForFormat is to be removed.

Reviewed-by: Dave Airlie <airlied@redhat.com>
src/mesa/main/multisample.c

index e7783ea537497e3f2cae94174a2a87c50f970f55..77773a20883878d0d07b67c9450dc29b0da91929 100644 (file)
@@ -174,10 +174,15 @@ _mesa_check_sample_count(struct gl_context *ctx, GLenum target,
     * 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;
    }