mesa: provide default implementation of QuerySamplesForFormat
authorChris Forbes <chrisf@ijw.co.nz>
Fri, 29 Mar 2013 03:22:09 +0000 (16:22 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Fri, 29 Mar 2013 07:54:36 +0000 (20:54 +1300)
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@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/common/driverfuncs.c
src/mesa/main/formatquery.c
src/mesa/main/formatquery.h

index 731d46658d081e1bfe0cd682f5b26768876cc905..a98dfc607c53221b5918cc6fdd15efc006e396db 100644 (file)
@@ -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;
index 78c5fbe5e2b9902c0d0af0ffce3322b459d3058e..e45dc868060217252eb8521d22d631f19c038c46 100644 (file)
 #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)
index 585c3eb64bab273c9de5164ad763fbf2e2ac3587..603400059e5c54faa892cb4b3b18620ace879246 100644 (file)
 #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);