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>
(cherry picked from commit ace8a7068e)
This commit is contained in:
Marek Olšák 2023-03-10 23:03:58 -05:00 committed by Eric Engestrom
parent cf9829388a
commit 32c5980e63
2 changed files with 3 additions and 4 deletions

View file

@ -517,7 +517,7 @@
"description": "nir: fix 2 bugs in nir_create_passthrough_tcs",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "a8e84f50bc6c855fa08af343c02d3e1b783d1586"
},

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;