Mesa (master): zink: add util function for emitting ntv atomic ops
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jan 14 18:35:22 UTC 2021
Module: Mesa
Branch: master
Commit: 2fa1cf99b981294d25a5adb1b1de17b4332b7ed8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2fa1cf99b981294d25a5adb1b1de17b4332b7ed8
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Tue Aug 4 14:27:36 2020 -0400
zink: add util function for emitting ntv atomic ops
these all need specific memory params, but otherwise they're the same
as normal ops, so we can just make a helper function here to add in the memory
params
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8330>
---
src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index ba44de46503..beb03efbe3d 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -1054,6 +1054,25 @@ emit_so_outputs(struct ntv_context *ctx,
}
}
+static SpvId
+emit_atomic(struct ntv_context *ctx, SpvId op, SpvId type, SpvId src0, SpvId src1)
+{
+ if (!type) //AtomicStore
+ return spirv_builder_emit_triop(&ctx->builder, op, src0,
+ emit_uint_const(ctx, 32, SpvScopeWorkgroup),
+ emit_uint_const(ctx, 32, SpvMemorySemanticsUniformMemoryMask | SpvMemorySemanticsReleaseMask),
+ src1);
+ if (src1)
+ return spirv_builder_emit_quadop(&ctx->builder, op, type, src0,
+ emit_uint_const(ctx, 32, SpvScopeWorkgroup),
+ emit_uint_const(ctx, 32, SpvMemorySemanticsUniformMemoryMask | SpvMemorySemanticsReleaseMask),
+ src1);
+ //AtomicLoad
+ return spirv_builder_emit_triop(&ctx->builder, op, type, src0,
+ emit_uint_const(ctx, 32, SpvScopeWorkgroup),
+ emit_uint_const(ctx, 32, SpvMemorySemanticsUniformMemoryMask | SpvMemorySemanticsAcquireMask));
+}
+
static SpvId
emit_binop(struct ntv_context *ctx, SpvOp op, SpvId type,
SpvId src0, SpvId src1)
More information about the mesa-commit
mailing list