File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
include/nbl/builtin/hlsl/bda Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,28 @@ namespace nbl
12
12
namespace hlsl
13
13
{
14
14
15
+ namespace impl {
16
+
17
+ struct BdaAccessorBase
18
+ {
19
+ // Note: Its a funny quirk of the SPIR-V Vulkan Env spec that `MemorySemanticsUniformMemoryMask` means SSBO as well :facepalm: (and probably BDA)
20
+ void workgroupExecutionAndMemoryBarrier ()
21
+ {
22
+ // we're only barriering the workgroup and trading memory within a workgroup
23
+ spirv::controlBarrier (spv::ScopeWorkgroup, spv::ScopeWorkgroup, spv::MemorySemanticsAcquireReleaseMask | spv::MemorySemanticsUniformMemoryMask);
24
+ }
25
+
26
+ void memoryBarrier ()
27
+ {
28
+ // By default it's device-wide access to the buffer
29
+ spirv::memoryBarrier (spv::ScopeDevice, spv::MemorySemanticsAcquireReleaseMask | spv::MemorySemanticsUniformMemoryMask);
30
+ }
31
+ };
32
+
33
+ } //namespace impl
34
+
15
35
template<typename T>
16
- struct BdaAccessor
36
+ struct BdaAccessor : impl::BdaAccessorBase
17
37
{
18
38
using type_t = T;
19
39
static BdaAccessor<T> create (const bda::__ptr<T> ptr)
@@ -61,7 +81,7 @@ struct BdaAccessor
61
81
};
62
82
63
83
template<typename T>
64
- struct DoubleBdaAccessor
84
+ struct DoubleBdaAccessor : impl::BdaAccessorBase
65
85
{
66
86
using type_t = T;
67
87
static DoubleBdaAccessor<T> create (const bda::__ptr<T> inputPtr, const bda::__ptr<T> outputPtr)
You can’t perform that action at this time.
0 commit comments