From 4a65b4bb1446201fab8ba2f99b5e5109896ca8bf Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Wed, 28 Jun 2023 19:10:41 +0900 Subject: [PATCH] asahi: Fix type confusion for fragment shader keys We can't attempt to access the fs union member if this is not a FS. That worked so far since there wasn't a VS shader key at all, but we're about to introduce one. Signed-off-by: Asahi Lina Part-of: --- src/asahi/compiler/agx_compile.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 661ad4be5b3..43b536c81bd 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -2455,9 +2455,7 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key, * Note: when epilogs are used, special handling is required since the sample * count is dynamic when the main fragment shader is compiled. */ - if (key->fs.nr_samples) { - assert(nir->info.stage == MESA_SHADER_FRAGMENT); - + if (nir->info.stage == MESA_SHADER_FRAGMENT && key->fs.nr_samples) { if (agx_nir_lower_sample_mask(nir, key->fs.nr_samples)) { /* Clean up ixor(bcsel) patterns created from sample mask lowering. * If this succeeds, we'll have expressions to constant fold to get the