[Mesa-dev] [PATCH 03/10] mesa: Returns zero samples when querying GL_NUM_SAMPLE_COUNTS when internal format is integer
Ian Romanick
idr at freedesktop.org
Tue Dec 2 12:47:25 PST 2014
On 12/01/2014 05:04 AM, Eduardo Lima Mitev wrote:
> In GLES3, multisampling is not supported for signed and unsigned integer
> internal formats. See https://www.khronos.org/opengles/sdk/docs/man3/docbook4/xhtml/glGetInternalformativ.xml.
>
> Fixes 19 dEQP tests under 'dEQP-GLES3.functional.state_query.internal_format.*'.
> ---
> src/mesa/main/formatquery.c | 44 +++++++++++++++++++++++++++-----------------
> 1 file changed, 27 insertions(+), 17 deletions(-)
>
> diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
> index 40eca87..629b07b 100644
> --- a/src/mesa/main/formatquery.c
> +++ b/src/mesa/main/formatquery.c
> @@ -115,23 +115,33 @@ _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);
> + size_t num_samples;
> +
> + if (_mesa_is_gles3(ctx) && _mesa_is_enum_format_integer(internalformat)) {
> + /* In GLES3.0, multisampling is not supported for signed and unsigned integer internal
> + formats <https://www.khronos.org/opengles/sdk/docs/man3/docbook4/xhtml/glGetInternalformativ.xml>,
> + so return zero
> + */
Rather than quote the man page, please quote the spec.
I might also be tempted to leave this code along but change what gets
stored to buffer[0]. Not a big deal either way.
> + num_samples = 0;
> + }
> + else {
} else {
> + /* 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.
>
More information about the mesa-dev
mailing list