[Mesa-dev] [PATCH V2] mesa: provide default implementation of QuerySamplesForFormat
Chris Forbes
chrisf at ijw.co.nz
Thu Mar 28 20:28:03 PDT 2013
Previously at least i915 failed to provide an implementation, but
exposed ARB_internalformat_query anyway, leading to crashes when
QueryInternalformativ was called.
Default implementation just returns 1 for everything, so is suitable for
any driver which does not support multisampling.
V2: - Move from intel to core mesa.
Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
src/mesa/drivers/common/driverfuncs.c | 3 ++-
src/mesa/main/formatquery.c | 15 +++++++++++++++
src/mesa/main/formatquery.h | 4 ++++
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 731d466..a98dfc6 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -28,6 +28,7 @@
#include "main/accum.h"
#include "main/arrayobj.h"
#include "main/context.h"
+#include "main/formatquery.h"
#include "main/framebuffer.h"
#include "main/mipmap.h"
#include "main/queryobj.h"
@@ -90,7 +91,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
/* Texture functions */
driver->ChooseTextureFormat = _mesa_choose_tex_format;
- driver->QuerySamplesForFormat = NULL;
+ driver->QuerySamplesForFormat = _mesa_query_samples_for_format;
driver->TexImage = _mesa_store_teximage;
driver->TexSubImage = _mesa_store_texsubimage;
driver->GetTexImage = _mesa_meta_GetTexImage;
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 78c5fbe..e45dc86 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -30,6 +30,21 @@
#include "fbobject.h"
#include "formatquery.h"
+/* default implementation of QuerySamplesForFormat driverfunc, for
+ * non-multisample-capable drivers. */
+size_t
+_mesa_query_samples_for_format(struct gl_context *ctx, GLenum target,
+ GLenum internalFormat, int samples[16])
+{
+ (void) target;
+ (void) internalFormat;
+ (void) ctx;
+
+ samples[0] = 1;
+ return 1;
+}
+
+
void GLAPIENTRY
_mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
GLsizei bufSize, GLint *params)
diff --git a/src/mesa/main/formatquery.h b/src/mesa/main/formatquery.h
index 585c3eb..6034000 100644
--- a/src/mesa/main/formatquery.h
+++ b/src/mesa/main/formatquery.h
@@ -28,6 +28,10 @@
#include "compiler.h"
#include "glheader.h"
+size_t
+_mesa_query_samples_for_format(struct gl_context *ctx, GLenum target,
+ GLenum internalFormat, int samples[16]);
+
extern void GLAPIENTRY
_mesa_GetInternalformativ(GLenum target, GLenum internalformat,
GLenum pname, GLsizei bufSize, GLint *params);
--
1.8.2
More information about the mesa-dev
mailing list