forked from Mirror/Ryujinx
Fix out-of-bounds shader thread shuffle (#2605)
* Fix out-of-bounds shader thread shuffle * Shader cache version bump
This commit is contained in:
parent
82cefc8dd3
commit
416dc8fde4
5 changed files with 10 additions and 7 deletions
|
@ -40,7 +40,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||
/// <summary>
|
||||
/// Version of the codegen (to be changed when codegen or guest format change).
|
||||
/// </summary>
|
||||
private const ulong ShaderCodeGenVersion = 2546;
|
||||
private const ulong ShaderCodeGenVersion = 2605;
|
||||
|
||||
// Progress reporting helpers
|
||||
private volatile int _shaderCount;
|
||||
|
|
|
@ -6,5 +6,6 @@ float Helper_Shuffle(float x, uint index, uint mask, out bool valid)
|
|||
uint maxThreadId = minThreadId | (clamp & ~segMask);
|
||||
uint srcThreadId = (index & ~segMask) | minThreadId;
|
||||
valid = srcThreadId <= maxThreadId;
|
||||
return valid ? readInvocationARB(x, srcThreadId) : x;
|
||||
float v = readInvocationARB(x, srcThreadId);
|
||||
return valid ? v : x;
|
||||
}
|
|
@ -6,5 +6,6 @@ float Helper_ShuffleDown(float x, uint index, uint mask, out bool valid)
|
|||
uint maxThreadId = minThreadId | (clamp & ~segMask);
|
||||
uint srcThreadId = gl_SubGroupInvocationARB + index;
|
||||
valid = srcThreadId <= maxThreadId;
|
||||
return valid ? readInvocationARB(x, srcThreadId) : x;
|
||||
float v = readInvocationARB(x, srcThreadId);
|
||||
return valid ? v : x;
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
float Helper_ShuffleUp(float x, uint index, uint mask, out bool valid)
|
||||
{
|
||||
uint clamp = mask & 0x1fu;
|
||||
uint segMask = (mask >> 8) & 0x1fu;
|
||||
uint minThreadId = gl_SubGroupInvocationARB & segMask;
|
||||
uint srcThreadId = gl_SubGroupInvocationARB - index;
|
||||
valid = srcThreadId >= minThreadId;
|
||||
return valid ? readInvocationARB(x, srcThreadId) : x;
|
||||
valid = int(srcThreadId) >= int(minThreadId);
|
||||
float v = readInvocationARB(x, srcThreadId);
|
||||
return valid ? v : x;
|
||||
}
|
|
@ -6,5 +6,6 @@ float Helper_ShuffleXor(float x, uint index, uint mask, out bool valid)
|
|||
uint maxThreadId = minThreadId | (clamp & ~segMask);
|
||||
uint srcThreadId = gl_SubGroupInvocationARB ^ index;
|
||||
valid = srcThreadId <= maxThreadId;
|
||||
return valid ? readInvocationARB(x, srcThreadId) : x;
|
||||
float v = readInvocationARB(x, srcThreadId);
|
||||
return valid ? v : x;
|
||||
}
|
Loading…
Reference in a new issue