shader_runner: add force_no_names mode

Graphics / Mesa 3D Graphics Library / Piglit - Alejandro Piñeiro [] - 23 January 2020 18:54 UTC

Right now UBO data filling is based on using the name of the ubo and their components, in order to get the block and uniform index. It also uses it to set the binding (so it forces block_index and block_binding to be equal).

Since ARB_shading_language_420pack it is possible to set a explicit ubo binding, so it would be interesting to try to use it directly without such re-binding, and gather the info without using the names at all.

We extend this idea to the already existing program interface query support, so we can do a subset of the queries using only the explicit binding.

This will be specially interesting for ARB_gl_spirv testing, where SPIR-V shaders should work without names, and explicit binding is not just optional but mandatory. For that reason, if running using SPIR-V instead of GLSL, we use this mode automatically, as it would fail otherwise. Another alternative is not set a different mode, but working this way when we are using SPIR-V shaders. But as mentioned, there would be GLSL cases where this would be interesting, and we are also interested on a sanity check when writing a SPIR-V test.

In order this to work on all cases, we need to also explicitly set other info when filling the data:
- offsets for each individual component
- matrix stride
- row major

Using the same approach used to fill the array index info. Note that for arrays we are not adding array stride, as this can be done by using the explicit offset. This allow us to not add another variable.

We extended this idea for SSBO, so we gather the info in a generic "block_info" struct. Although this is not needed for ssbo data filling, as it already uses the explicit binding, it became useful to keep using program interface queries.

It is worth to note that some of the queries already supported by shader_runner will not be supported on this mode, as they are based on the names.

v2: improve legibility by avoiding so many indentation changes (Ian).

v3: fix length check for GL_NAME_LENGTH pname taking into account that glGetProgramResourceName does not consider the NULL terminator when returning the name length and glGetProgramResourceiv does, and improved the error message (Antia Puentes).

0473dbe8b shader_runner: add force_no_names mode
tests/shaders/shader_runner.c | 392 ++++++++++++++++++++++++++++++++----------
1 file changed, 300 insertions(+), 92 deletions(-)


  • Share