summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/formatquery.c
diff options
context:
space:
mode:
authorEduardo Lima Mitev <[email protected]>2014-11-20 14:52:35 +0100
committerIago Toral Quiroga <[email protected]>2014-12-09 11:40:00 +0100
commit09cb149ba745302e366c2f965a033103d398748c (patch)
tree625740fde8d6e4625cf6fb58e79a78b8fcae8ca2 /src/mesa/main/formatquery.c
parent78942787170615c9333810cf3a4819a13c9eb8e8 (diff)
mesa: Returns zero samples when querying GL_NUM_SAMPLE_COUNTS when internal format is integer
From GL ES 3.0 specification, section 6.1.15 Internal Format Queries (page 236), multisampling is not supported for signed and unsigned integer internal formats. Fixes 19 dEQP tests under 'dEQP-GLES3.functional.state_query.internal_format.*'. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main/formatquery.c')
-rw-r--r--src/mesa/main/formatquery.c57
1 files changed, 34 insertions, 23 deletions
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 40eca8711cd..f6274fe30a1 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -115,29 +115,40 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
internalformat, buffer);
break;
case GL_NUM_SAMPLE_COUNTS: {
- /* The driver can return 0, and we should pass that along to the
- * application. The ARB decided that ARB_internalformat_query should
- * behave as ARB_internalformat_query2 in this situation.
- *
- * The ARB_internalformat_query2 spec says:
- *
- * "- NUM_SAMPLE_COUNTS: The number of sample counts that would be
- * returned by querying SAMPLES is returned in <params>.
- * * If <internalformat> is not color-renderable,
- * depth-renderable, or stencil-renderable (as defined in
- * section 4.4.4), or if <target> does not support multiple
- * samples (ie other than TEXTURE_2D_MULTISAMPLE,
- * TEXTURE_2D_MULTISAMPLE_ARRAY, or RENDERBUFFER), 0 is
- * returned."
- */
- const size_t num_samples =
- ctx->Driver.QuerySamplesForFormat(ctx, target, internalformat, buffer);
-
- /* QuerySamplesForFormat writes some stuff to buffer, so we have to
- * separately over-write it with the requested value.
- */
- buffer[0] = (GLint) num_samples;
- count = 1;
+ if (_mesa_is_gles3(ctx) && _mesa_is_enum_format_integer(internalformat)) {
+ /* From GL ES 3.0 specification, section 6.1.15 page 236: "Since
+ * multisampling is not supported for signed and unsigned integer
+ * internal formats, the value of NUM_SAMPLE_COUNTS will be zero
+ * for such formats.
+ */
+ buffer[0] = 0;
+ count = 1;
+ } else {
+ size_t num_samples;
+
+ /* The driver can return 0, and we should pass that along to the
+ * application. The ARB decided that ARB_internalformat_query should
+ * behave as ARB_internalformat_query2 in this situation.
+ *
+ * The ARB_internalformat_query2 spec says:
+ *
+ * "- NUM_SAMPLE_COUNTS: The number of sample counts that would be
+ * returned by querying SAMPLES is returned in <params>.
+ * * If <internalformat> is not color-renderable,
+ * depth-renderable, or stencil-renderable (as defined in
+ * section 4.4.4), or if <target> does not support multiple
+ * samples (ie other than TEXTURE_2D_MULTISAMPLE,
+ * TEXTURE_2D_MULTISAMPLE_ARRAY, or RENDERBUFFER), 0 is
+ * returned."
+ */
+ num_samples = ctx->Driver.QuerySamplesForFormat(ctx, target, internalformat, buffer);
+
+ /* QuerySamplesForFormat writes some stuff to buffer, so we have to
+ * separately over-write it with the requested value.
+ */
+ buffer[0] = (GLint) num_samples;
+ count = 1;
+ }
break;
}
default: