i965/formatquery: Respond queries SAMPLES and NUM_SAMPLE_COUNTS
authorEduardo Lima Mitev <elima@igalia.com>
Tue, 24 Nov 2015 20:43:28 +0000 (21:43 +0100)
committerEduardo Lima Mitev <elima@igalia.com>
Thu, 3 Mar 2016 14:14:05 +0000 (15:14 +0100)
This effectively disables old QuerySamplesForFormat driver hook, since it is
never called by Mesa anymore.

v2: Call brw_query_samples_for_format() with a dummy buffer to calculate num
    samples, to avoid modifying the original buffer.

Reviewed-by: Dave Airlie <airlied@redhat.com>
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_formatquery.c

index c16da0d2291698986353669c2fb332b7aee4210d..378366408ae8e3d52c46683a64642a27d9f858f9 100644 (file)
@@ -341,7 +341,6 @@ brw_init_driver_functions(struct brw_context *brw,
    if (brw->gen >= 7)
       brw_init_conditional_render_functions(functions);
 
-   functions->QuerySamplesForFormat = brw_query_samples_for_format;
    functions->QueryInternalFormat = brw_query_internal_format;
 
    functions->NewTransformFeedback = brw_new_transform_feedback;
index 8fca80b617c6ed05e94d3245887d2ee7e837f1b7..88f0d49a5ffc3e148bd81d3c97828028373af6cb 100644 (file)
@@ -1876,8 +1876,6 @@ void gen7_emit_vs_workaround_flush(struct brw_context *brw);
 void gen7_emit_cs_stall_flush(struct brw_context *brw);
 
 /* brw_queryformat.c */
-size_t brw_query_samples_for_format(struct gl_context *ctx, GLenum target,
-                                    GLenum internalFormat, int samples[16]);
 void brw_query_internal_format(struct gl_context *ctx, GLenum target,
                                GLenum internalFormat, GLenum pname,
                                GLint *params);
index 5ee1d69dae23ff728e16adc2da939366f0a72b5f..576e36fcae31322a8524886bc707f898445a28d7 100644 (file)
@@ -24,7 +24,7 @@
 #include "brw_context.h"
 #include "main/formatquery.h"
 
-size_t
+static size_t
 brw_query_samples_for_format(struct gl_context *ctx, GLenum target,
                              GLenum internalFormat, int samples[16])
 {
@@ -73,6 +73,20 @@ brw_query_internal_format(struct gl_context *ctx, GLenum target,
    assert(params != NULL);
 
    switch (pname) {
+   case GL_SAMPLES:
+      brw_query_samples_for_format(ctx, target, internalFormat, params);
+      break;
+
+   case GL_NUM_SAMPLE_COUNTS: {
+      size_t num_samples;
+      GLint dummy_buffer[16];
+
+      num_samples = brw_query_samples_for_format(ctx, target, internalFormat,
+                                                 dummy_buffer);
+      params[0] = (GLint) num_samples;
+      break;
+   }
+
    default:
       /* By default, we call the driver hook's fallback function from the frontend,
        * which has generic implementation for all pnames.