mesa/src
Kenneth Graunke 4c4d9e4f03 glsl: Fix program interface queries relating to interface blocks.
This fixes 555 dEQP tests (using the nougat-cts-dev branch), Piglit's
arb_program_interface_query/arb_program_interface_query-resource-query,
and GL45-CTS.program_interface_query.separate-programs-{tess-control,
tess-eval,geometry}.  Only one dEQP program interface failure remains.

I would have liked to split this up into several distinct changes, but
I wasn't sure how to do that given thet tangled nature of these issues.

So, the issues:

   * We need to treat interface blocks declared as an array of instances
     as a single block - removing the outer array.  The resource list
     entry's name should not include the array length.  Properties such
     as GL_ARRAY_SIZE should refer to the variable inside the block, not
     the interface block's array properties.

   * We need to do this prefixing even for structure variables.

   * We need to do this for built-ins (such as gl_PerVertex.gl_Position).

   * After interface array unwrapping, any variable which is an array
     should have [0] appended.  It doesn't matter if it's a TCS/TES/GS
     input or TCS output - that looked like an attempt to unwrap for
     per-vertex variables, but that didn't consider per-patch variables,
     and as far as I can tell there's nothing to justify this.

Several Mesa developers have suggested that Issue 16 contradicts the
main specification, but I believe that it doesn't - the main spec just
isn't terribly clear.  The main ARB_program_interface query spec says:

  "* For an active interface block not declared as an array of block
     instances, a single entry will be generated, using the block name from
     the shader source.

   * For an active interface block declared as an array of instances,
     separate entries will be generated for each active instance.  The name
     of the instance is formed by concatenating the block name, the "["
     character, an integer identifying the instance number, and the "]"
     character."

Issue 16 says that built-ins should be named "gl_PerVertex.gl_Position",
but several people suggested the second bullet above means that it
should be named "gl_PerVertex[array length].gl_Position".

There are two important things to note.  Those bullet points say
"an active interface block", while the others say "variable" or "active
shader storage block member".  They also don't mention applying the
rules recursively (unlike the other bullets).  Both suggest that
these rules apply to blocks themselves, not members of blocks.

In fact, for GL_UNIFORM_BLOCK queries, we do have "block[0]",
"block[1]", ... resource list entries - so those rules are real,
and actually used.  So if they don't apply to block members, then how
should members be named?  Unfortunately, I don't see any rules outside
of issue 16 - where the rationale is very unclear.  I hope to clarify
the spec in the future.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2016-12-19 15:43:09 -08:00
..
amd radv: Use correct workgroup size limits. 2016-12-18 22:18:14 +01:00
compiler glsl: Fix program interface queries relating to interface blocks. 2016-12-19 15:43:09 -08:00
egl EGL/android: Enhance pbuffer implementation 2016-12-19 08:26:32 +02:00
gallium Revert "cso: don't release sampler states that are bound" 2016-12-19 17:51:38 +09:00
gbm gbm: request correct version of the DRI2_FENCE extension 2016-11-22 15:56:44 +00:00
getopt Introduce .editorconfig 2016-08-31 17:06:54 -07:00
glx dri: make use of loader_get_extensions_name(..) helper 2016-11-15 18:15:16 +00:00
gtest Introduce .editorconfig 2016-08-31 17:06:54 -07:00
hgl glapi/hgl: remove the final user of _glapi_check_table() 2016-10-06 15:03:46 +01:00
intel anv: Fix uniform and storage buffer offset alignment limits. 2016-12-16 14:12:54 -08:00
loader loader: automake: whitespace cleanup 2016-11-21 14:46:40 +00:00
mapi glapi: add missing INTEL_conservative_rasterization 2016-12-13 16:27:56 +00:00
mesa glsl: Fix program interface queries relating to interface blocks. 2016-12-19 15:43:09 -08:00
util util: import CRC32 implementation from gallium 2016-11-22 18:05:51 +01:00
vulkan/wsi vulkan: use STATIC_ASSERT instead of static_assert 2016-12-07 22:32:38 +11:00
Makefile.am amd: flatten amd/common makefile structure 2016-11-15 20:04:37 +00:00
SConscript scons: put the generated git_sha1.h file in top-level src/ directory 2016-06-17 10:33:00 -06:00