[Mesa-dev] [RFC 05/63] i965/formatquery: Respond queries SAMPLES and NUM_SAMPLE_COUNTS

Eduardo Lima Mitev elima at igalia.com
Tue Jan 19 08:41:45 PST 2016


This effectively disables old QuerySamplesForFormat driver hook, since it is
never called by Mesa anymore.
---
 src/mesa/drivers/dri/i965/brw_context.c     |  1 -
 src/mesa/drivers/dri/i965/brw_context.h     |  2 --
 src/mesa/drivers/dri/i965/brw_formatquery.c | 14 +++++++++++++-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 8186b7d..3a3fcd7 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -308,7 +308,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;
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index e17f99c..0ba642e 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1874,8 +1874,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);
diff --git a/src/mesa/drivers/dri/i965/brw_formatquery.c b/src/mesa/drivers/dri/i965/brw_formatquery.c
index 5ee1d69..1bd212c 100644
--- a/src/mesa/drivers/dri/i965/brw_formatquery.c
+++ b/src/mesa/drivers/dri/i965/brw_formatquery.c
@@ -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,18 @@ 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;
+      num_samples = brw_query_samples_for_format(ctx, target, internalFormat,
+                                                 params);
+      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.
-- 
2.5.3



More information about the mesa-dev mailing list