zink: use SpvScopeDevice over SpvScopeWorkgroup for atomic shader ops

Workgroup is only allowed in compute shaders, and Device should be more
in line with the intended use here

the alternative would be to keep using Workgroup for compute and use Device
otherwise, but this would effectively make atomic ops non-atomic, which seems
like it isn't desirable

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14690>
(cherry picked from commit 6f38ea4ac7)
This commit is contained in:
Mike Blumenkrantz 2022-01-18 10:39:25 -05:00 committed by Eric Engestrom
parent 39e4072ef4
commit e5d09f30b9
2 changed files with 4 additions and 4 deletions

View file

@ -2803,7 +2803,7 @@
"description": "zink: use SpvScopeDevice over SpvScopeWorkgroup for atomic shader ops",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -1408,16 +1408,16 @@ static SpvId
emit_atomic(struct ntv_context *ctx, SpvId op, SpvId type, SpvId src0, SpvId src1, SpvId src2)
{
if (op == SpvOpAtomicLoad)
return spirv_builder_emit_triop(&ctx->builder, op, type, src0, emit_uint_const(ctx, 32, SpvScopeWorkgroup),
return spirv_builder_emit_triop(&ctx->builder, op, type, src0, emit_uint_const(ctx, 32, SpvScopeDevice),
emit_uint_const(ctx, 32, 0));
if (op == SpvOpAtomicCompareExchange)
return spirv_builder_emit_hexop(&ctx->builder, op, type, src0, emit_uint_const(ctx, 32, SpvScopeWorkgroup),
return spirv_builder_emit_hexop(&ctx->builder, op, type, src0, emit_uint_const(ctx, 32, SpvScopeDevice),
emit_uint_const(ctx, 32, 0),
emit_uint_const(ctx, 32, 0),
/* these params are intentionally swapped */
src2, src1);
return spirv_builder_emit_quadop(&ctx->builder, op, type, src0, emit_uint_const(ctx, 32, SpvScopeWorkgroup),
return spirv_builder_emit_quadop(&ctx->builder, op, type, src0, emit_uint_const(ctx, 32, SpvScopeDevice),
emit_uint_const(ctx, 32, 0), src1);
}