zink: do not read is_generated unless in tcs shader
It's undefined behavior in C to read a union member if another member has been written to more recently. Let's be more careful here! Fixes:a9d2b86c2c
("zink: store the spirv_shader to the zink_shader struct for generated tcs") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19457> (cherry picked from commit090a111c5d
)
This commit is contained in:

committed by
Dylan Baker

parent
46f2002521
commit
e0d84e84f7
@@ -148,7 +148,7 @@
|
||||
"description": "zink: do not read is_generated unless in tcs shader",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "a9d2b86c2c80b94281b6f0cfc1f73adde8e0e294"
|
||||
},
|
||||
|
@@ -2183,7 +2183,7 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, nir_shad
|
||||
ralloc_free(nir);
|
||||
|
||||
/* TODO: determine if there's any reason to cache spirv output? */
|
||||
if (zs->is_generated)
|
||||
if (zs->nir->info.stage == MESA_SHADER_TESS_CTRL && zs->is_generated)
|
||||
zs->spirv = spirv;
|
||||
else
|
||||
ralloc_free(spirv);
|
||||
|
Reference in New Issue
Block a user