Skip to content

glsl/linker: Fix xfb with explicit locations and 64bit types

  1. Per GL_ARB_enhanced_layouts if explicit location is set for varying, each struct member, array element and matrix row will take separate location. With GL_ARB_gpu_shader_fp64/GL_ARB_gpu_shader_int64 they may take two locations.

Examples:

| layout(location=0) dvec3[2] a; | layout(location=4) vec2[4] b; |
|                                |                               |
|   32b 32b 32b 32b              |   32b 32b 32b 32b             |
| 0  X   X   Y   Y               | 4  X   Y   0   0              |
| 1  Z   Z   0   0               | 5  X   Y   0   0              |
| 2  X   X   Y   Y               | 6  X   Y   0   0              |
| 3  Z   Z   0   0               | 7  X   Y   0   0              |

Previously it wasn't taken into account.

  1. Captured double-precision variables should be aligned to 8 bytes per GL_ARB_gpu_shader_fp64:
 "If any variable captured in transform feedback has double-precision
 components, the practical requirements for defined behavior are:
     ...
 (c) each double-precision variable captured must be aligned to a
     multiple of eight bytes relative to the beginning of a vertex."

Closes: #1667 (closed)

Passes CI: https://mesa-ci.01.org/global_logic/builds/219/group/63a9f0ea7bb98050796b649e85481845

Depends on !2332 (closed) for glsl/linker: Fix attempts to split up 64bit varyings between slots.

There are no tests at the moment. piglit!95 (merged) (adds support for xfb in shader tests) would make them easy to write. And I think they should be generated the same way as random_ubo-arb_uniform_buffer_object.py does.

Merge request reports