From: Erik Faye-Lund Date: Thu, 17 Nov 2022 11:15:54 +0000 (+0100) Subject: zink: process non-optimal-key passes first X-Git-Tag: upstream/23.3.3~16149 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=09ced773fce790245f3c76e1eec5549199242f04;p=platform%2Fupstream%2Fmesa.git zink: process non-optimal-key passes first Right now, it's only the vertex-shader that needs special handling for non-optimal keys. That makes it possible to use fallthrough to always end up in the last-vertex-stage conditional. But we're about to add special handling for the geometry stage as well, so let's prepare by splitting the switch-statement in two; one that only happens for non-optimal keys, and does all the needed processing there, and one that deals with the rest. Part-of: --- diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index 9d5234af..6a03ad5 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -2410,9 +2410,10 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, nir_shad } /* TODO: use a separate mem ctx here for ralloc */ - switch (zs->nir->info.stage) { - case MESA_SHADER_VERTEX: { - if (!screen->optimal_keys) { + + if (!screen->optimal_keys) { + switch (zs->nir->info.stage) { + case MESA_SHADER_VERTEX: { uint32_t decomposed_attrs = 0, decomposed_attrs_without_w = 0; const struct zink_vs_key *vs_key = zink_vs_key(key); switch (vs_key->size) { @@ -2432,9 +2433,16 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, nir_shad } if (decomposed_attrs || decomposed_attrs_without_w) NIR_PASS_V(nir, decompose_attribs, decomposed_attrs, decomposed_attrs_without_w); + break; + } + + default: + break; } - FALLTHROUGH; } + + switch (zs->nir->info.stage) { + case MESA_SHADER_VERTEX: case MESA_SHADER_TESS_EVAL: case MESA_SHADER_GEOMETRY: if (zink_vs_key_base(key)->last_vertex_stage) {