mesa: skip validation of legality of size/type queries for format queries
authorRoland Scheidegger <sroland@vmware.com>
Sat, 27 Jan 2018 00:39:35 +0000 (01:39 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Tue, 30 Jan 2018 00:28:47 +0000 (01:28 +0100)
The size/type query is always legal (if we made it that far).
Removing this causes a difference for GL_TEXTURE_BUFFER - the reason is that
these parameters are valid only with GetTexLevelParameter() if gl 3.1 is
supported, but not if only ARB_texture_buffer_object is supported.
However, while the spec says that these queries return "the same information
as querying GetTexLevelParameter" I believe we're not expected to return just
zeros here. By definition, these pnames are always valid (unlike for the
GetTexLevelParameter() function which would return an error without GL 3.1).
The spec is a bit inconsistent there and open to interpretation - while
mentioning the "same information as querying GetTexLevelParameter" is
returned, it also mentions that 0 is returned for size/type if the
target/format is not supported - implying correct results to be returned
if it is supported, regardless that GetTexLevelParameter would return
an error. (Also, the bit about this returning the same as
GetTexLevelParameter also includes querying stencil type, which isn't
even possible with GetTexLevelParameter.)

This breaks some piglit arb_internalformat_query2 tests (which I believe to
be wrong).

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>§
src/mesa/main/formatquery.c

index 303e7b2f8cb6955cbe8707f20ba9dbfee6406852..834f11118ed1837059a401a9b099e8ce00bfdaf7 100644 (file)
@@ -960,9 +960,6 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
       mesa_format texformat;
 
       if (target != GL_RENDERBUFFER) {
-         if (!_mesa_legal_get_tex_level_parameter_target(ctx, target, true))
-            goto end;
-
          baseformat = _mesa_base_tex_format(ctx, internalformat);
       } else {
          baseformat = _mesa_base_fbo_format(ctx, internalformat);