Skip to content

Commit e5104e7

Browse files
author
devsh
committed
fix typo in DXC workarounds for pointers to atomic compare exchange
1 parent 3144e75 commit e5104e7

File tree

1 file changed

+3
-2
lines changed
  • include/nbl/builtin/hlsl/glsl_compat

1 file changed

+3
-2
lines changed

include/nbl/builtin/hlsl/glsl_compat/core.hlsl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ genIUType bitfieldInsert(genIUType const& Base, genIUType const& Insert, int Off
3838
// Fun fact: ideally atomics should detect the address space of `ptr` and narrow down the sync-scope properly
3939
// https://github.com/microsoft/DirectXShaderCompiler/issues/6508
4040
// Would need own meta-type/tagged-type to implement, without & and fancy operator overloads... not posssible
41+
// TODO: we can template on `StorageClass` instead of Ptr_T then resolve the memory scope and semantics properly
4142
template<typename T>
4243
T atomicAdd(NBL_REF_ARG(T) ptr, T value)
4344
{
@@ -114,9 +115,9 @@ T atomicCompSwap(NBL_REF_ARG(T) ptr, T comparator, T value)
114115
return spirv::atomicCompareExchange<T>(ptr, spv::ScopeDevice, spv::MemorySemanticsMaskNone, spv::MemorySemanticsMaskNone, value, comparator);
115116
}
116117
template<typename T, typename Ptr_T> // DXC Workaround
117-
enable_if_t<is_spirv_type_v<Ptr_T>, T> atomicCompSwap(Ptr_T ptr, T value)
118+
enable_if_t<is_spirv_type_v<Ptr_T>, T> atomicCompSwap(Ptr_T ptr, T comparator, T value)
118119
{
119-
return spirv::atomicCompareExchange<T, Ptr_T>(ptr, spv::ScopeDevice, spv::MemorySemanticsMaskNone, value);
120+
return spirv::atomicCompareExchange<T, Ptr_T>(ptr, spv::ScopeDevice, spv::MemorySemanticsMaskNone, spv::MemorySemanticsMaskNone, value, comparator);
120121
}
121122

122123
/**

0 commit comments

Comments
 (0)