nir: fix 2 bugs in nir_create_passthrough_tcs

- VAR31 was ignored.
- Only a half of the 16-bit slot was passed through, though I'm not sure
  if nir_lower_io handles vec8. The slots are only for GLES and I don't
  think a passthrough TCS is possible with GLES.

Fixes: a8e84f50bc - nir: Add helper to create passthrough TCS shader

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21861>
This commit is contained in:
Marek Olšák 2023-03-10 23:03:58 -05:00 committed by Marge Bot
parent 13e885842a
commit ace8a7068e

View file

@ -77,10 +77,9 @@ nir_create_passthrough_tcs_impl(const nir_shader_compiler_options *options,
for (unsigned i = 0; i < num_locations; i++) {
const struct glsl_type *type;
unsigned semantic = locations[i];
if (semantic < VARYING_SLOT_VAR31 && semantic != VARYING_SLOT_EDGE)
if ((semantic <= VARYING_SLOT_VAR31 && semantic != VARYING_SLOT_EDGE) ||
semantic >= VARYING_SLOT_VAR0_16BIT)
type = glsl_array_type(glsl_vec4_type(), 0, 0);
else if (semantic >= VARYING_SLOT_VAR0_16BIT)
type = glsl_array_type(glsl_vector_type(GLSL_TYPE_FLOAT16, 4), 0, 0);
else
continue;