glsl/linker: location aliasing requires types to have the same width
From the OpenGL 4.60.5 spec, section 4.4.1 Input Layout Qualifiers, Page 67, (Location aliasing):
" Further, when location aliasing, the aliases sharing the location must have the same underlying numerical type and bit width (floating-point or integer, 32-bit versus 64-bit, etc.) and the same auxiliary storage and interpolation qualification."
Additionally, we have improved the linker error descriptions. Specifically, when taking structs into account we were producing a linker error because we assumed that all components in each location were used and that would cause component aliasing. This is not accurate of the actual problem. Now, the failure specifies that the underlying numerical type incompatibility is the cause for the failure.
Fixes the following piglit test:
- Do not assert if we see invalid numerical types. These come straight from shader code, so we should produce linker errors if shaders attempt to do location aliasing on variables that are not numerical such as records.
- While we are at it, improve error reporting for the case of numerical type mismatch to include the shader stage.
- Allow location aliasing of images and samplers. If we get these it means bindless support is active and they should be handled as 64-bit integers (Ilia)
- Make sure we produce link errors for any non-numerical type for which we attempt location aliasing, not just structs.
- Rebased with minor fixes (Andres).
- Added fixing tag to the commit log (Andres).
- Remove the helper function and check individually for the underlying numerical type and bit width (Timothy).
- Implicitly, assume that any non-treated type which is checked for its underlying numerical type is either integer or float and has a defined bit width (Timothy).
- Implicitly, assume that structs are the only non-treated non-numerical type (Timothy).
- Improve the linker error descriptions and commit log (Andres).
Fixes: 13652e75 ("glsl/linker: Fix type checks for location aliasing") Cc: Ilia Mirkin firstname.lastname@example.org Cc: Timothy Arceri email@example.com Cc: Iago Toral Quiroga firstname.lastname@example.org Signed-off-by: Andres Gomez email@example.com Reviewed-by: Timothy Arceri firstname.lastname@example.org (cherry picked from commit 75a3dd97) [Andres Gomez: is_record() instead of is_struct() and brought glsl_base_type_get_bit_size] Signed-off-by: Andres Gomez email@example.com