[Mesa-dev] [RFC 02/63] mesa: Add a default QueryInternalFormat() function for drivers

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


This is a fallback function for drivers not implementing
ARB_internalformat_query2.
---
 src/mesa/drivers/common/driverfuncs.c |  1 +
 src/mesa/main/formatquery.c           | 16 ++++++++++++++++
 src/mesa/main/formatquery.h           |  5 +++++
 3 files changed, 22 insertions(+)

diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 752aaf6..e6334d8 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -91,6 +91,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
    /* Texture functions */
    driver->ChooseTextureFormat = _mesa_choose_tex_format;
    driver->QuerySamplesForFormat = _mesa_query_samples_for_format;
+   driver->QueryInternalFormat = _mesa_query_internal_format_default;
    driver->TexImage = _mesa_store_teximage;
    driver->TexSubImage = _mesa_store_texsubimage;
    driver->GetTexSubImage = _mesa_meta_GetTexSubImage;
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 85f7b6b..4f18b00 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -43,6 +43,22 @@ _mesa_query_samples_for_format(struct gl_context *ctx, GLenum target,
    return 1;
 }
 
+/* default implementation of QueryInternalFormat driverfunc, for
+ * drivers not implementing ARB_internalformat_query2.
+ */
+void
+_mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
+                                    GLenum internalFormat, GLenum pname,
+                                    GLint *params)
+{
+   (void) ctx;
+   (void) target;
+   (void) internalFormat;
+   (void) pname;
+   (void) params;
+
+   /* @TODO */
+}
 
 void GLAPIENTRY
 _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
diff --git a/src/mesa/main/formatquery.h b/src/mesa/main/formatquery.h
index 6034000..b42299e 100644
--- a/src/mesa/main/formatquery.h
+++ b/src/mesa/main/formatquery.h
@@ -32,6 +32,11 @@ size_t
 _mesa_query_samples_for_format(struct gl_context *ctx, GLenum target,
                                GLenum internalFormat, int samples[16]);
 
+void
+_mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
+                                    GLenum internalFormat, GLenum pname,
+                                    GLint *params);
+
 extern void GLAPIENTRY
 _mesa_GetInternalformativ(GLenum target, GLenum internalformat,
                           GLenum pname, GLsizei bufSize, GLint *params);
-- 
2.5.3



More information about the mesa-dev mailing list