Add support for shader atomic min/max (S32) (#1948)
This commit is contained in:
parent
c19cfca183
commit
e453ba69f4
11 changed files with 103 additions and 21 deletions
|
@ -0,0 +1,21 @@
|
|||
int Helper_AtomicMaxS32(int offset, int value)
|
||||
{
|
||||
uint oldValue, newValue;
|
||||
do
|
||||
{
|
||||
oldValue = $SHARED_MEM$[offset];
|
||||
newValue = uint(max(int(oldValue), value));
|
||||
} while (atomicCompSwap($SHARED_MEM$[offset], newValue, oldValue) != oldValue);
|
||||
return int(oldValue);
|
||||
}
|
||||
|
||||
int Helper_AtomicMinS32(int offset, int value)
|
||||
{
|
||||
uint oldValue, newValue;
|
||||
do
|
||||
{
|
||||
oldValue = $SHARED_MEM$[offset];
|
||||
newValue = uint(min(int(oldValue), value));
|
||||
} while (atomicCompSwap($SHARED_MEM$[offset], newValue, oldValue) != oldValue);
|
||||
return int(oldValue);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue