spirv: workaround for tests assuming that OpKill terminates invocations or loops

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-04-15 10:41:21 +02:00 committed by Marge Bot
parent 7af16e9f1e
commit cfa5beeeab

View file

@ -1256,10 +1256,19 @@ vtn_emit_branch(struct vtn_builder *b, const struct vtn_block *block,
break;
case vtn_branch_type_discard:
if (b->convert_discard_to_demote)
if (b->convert_discard_to_demote) {
nir_demote(&b->nb);
else
/* Workaround for outdated test cases from CTS and Tint which assume
* that OpKill always terminates the invocation. Break from the
* current loop if it exists in order to prevent infinite loops.
*/
struct vtn_construct *loop = block->parent->innermost_loop;
if (loop)
vtn_emit_break_for_construct(b, block, loop);
} else {
nir_discard(&b->nb);
}
break;
case vtn_branch_type_terminate_invocation: