forked from Mirror/Ryujinx
Fix shader buffer write flag on atomic instructions (#2261)
* Fix shader buffer write flag on atomic instructions * Shader cache version bump
This commit is contained in:
parent
1998a3a90a
commit
0e9823d7e6
3 changed files with 10 additions and 5 deletions
|
@ -35,7 +35,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version of the codegen (to be changed when codegen or guest format change).
|
/// Version of the codegen (to be changed when codegen or guest format change).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const ulong ShaderCodeGenVersion = 2217;
|
private const ulong ShaderCodeGenVersion = 2261;
|
||||||
|
|
||||||
// Progress reporting helpers
|
// Progress reporting helpers
|
||||||
private volatile int _shaderCount;
|
private volatile int _shaderCount;
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
|
||||||
switch (memRegion)
|
switch (memRegion)
|
||||||
{
|
{
|
||||||
case Instruction.MrShared: args += LoadShared(context, operation); break;
|
case Instruction.MrShared: args += LoadShared(context, operation); break;
|
||||||
case Instruction.MrStorage: args += LoadStorage(context, operation); break;
|
case Instruction.MrStorage: args += LoadStorage(context, operation, forAtomic: true); break;
|
||||||
|
|
||||||
default: throw new InvalidOperationException($"Invalid memory region \"{memRegion}\".");
|
default: throw new InvalidOperationException($"Invalid memory region \"{memRegion}\".");
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
|
||||||
return $"{arrayName}[{offsetExpr}]";
|
return $"{arrayName}[{offsetExpr}]";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string LoadStorage(CodeGenContext context, AstOperation operation)
|
public static string LoadStorage(CodeGenContext context, AstOperation operation, bool forAtomic = false)
|
||||||
{
|
{
|
||||||
IAstNode src1 = operation.GetSource(0);
|
IAstNode src1 = operation.GetSource(0);
|
||||||
IAstNode src2 = operation.GetSource(1);
|
IAstNode src2 = operation.GetSource(1);
|
||||||
|
@ -213,6 +213,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
|
||||||
string indexExpr = GetSoureExpr(context, src1, GetSrcVarType(operation.Inst, 0));
|
string indexExpr = GetSoureExpr(context, src1, GetSrcVarType(operation.Inst, 0));
|
||||||
string offsetExpr = GetSoureExpr(context, src2, GetSrcVarType(operation.Inst, 1));
|
string offsetExpr = GetSoureExpr(context, src2, GetSrcVarType(operation.Inst, 1));
|
||||||
|
|
||||||
|
if (forAtomic)
|
||||||
|
{
|
||||||
|
SetStorageWriteFlag(context, src1, context.Config.Stage);
|
||||||
|
}
|
||||||
|
|
||||||
return GetStorageBufferAccessor(indexExpr, offsetExpr, context.Config.Stage);
|
return GetStorageBufferAccessor(indexExpr, offsetExpr, context.Config.Stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue