spirv: make gl_HelperInvocation volatile if demote is being used

Non-volatile gl_HelperInvocation after demote is undefined.
In order to avoid application bugs, make it volatile if we use demote.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27617>
This commit is contained in:
Daniel Schürmann
2024-02-06 12:33:02 +01:00
committed by Marge Bot
parent 9336190868
commit e0ab1ed14e
+9
View File
@@ -1600,6 +1600,15 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
case SpvDecorationCounterBuffer:
/* Counter buffer decorations can safely be ignored by the driver. */
return;
case SpvDecorationBuiltIn:
/* Non-volatile gl_HelperInvocation after demote is undefined.
* In order to avoid application bugs, make it volatile if we use demote.
*/
if (dec->operands[0] == SpvBuiltInHelperInvocation &&
(b->enabled_capabilities.DemoteToHelperInvocation ||
b->convert_discard_to_demote))
vtn_var->access |= ACCESS_VOLATILE;
break;
default:
break;
}