mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-23 19:11:21 -08:00
Fix SPIR-V call out arguments regression (#5767)
* Fix SPIR-V call out arguments regression * Shader cache version bump
This commit is contained in:
parent
7afae8c699
commit
b6ac45d36d
@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||||||
private const ushort FileFormatVersionMajor = 1;
|
private const ushort FileFormatVersionMajor = 1;
|
||||||
private const ushort FileFormatVersionMinor = 2;
|
private const ushort FileFormatVersionMinor = 2;
|
||||||
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
||||||
private const uint CodeGenVersion = 5764;
|
private const uint CodeGenVersion = 5767;
|
||||||
|
|
||||||
private const string SharedTocFileName = "shared.toc";
|
private const string SharedTocFileName = "shared.toc";
|
||||||
private const string SharedDataFileName = "shared.data";
|
private const string SharedDataFileName = "shared.data";
|
||||||
|
@ -2,6 +2,7 @@ using Ryujinx.Graphics.Shader.IntermediateRepresentation;
|
|||||||
using Ryujinx.Graphics.Shader.Translation;
|
using Ryujinx.Graphics.Shader.Translation;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.Shader.StructuredIr
|
namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||||
@ -62,7 +63,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddOperation(context, operation, targetLanguage);
|
AddOperation(context, operation, targetLanguage, functions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,7 +78,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
|||||||
return context.Info;
|
return context.Info;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddOperation(StructuredProgramContext context, Operation operation, TargetLanguage targetLanguage)
|
private static void AddOperation(StructuredProgramContext context, Operation operation, TargetLanguage targetLanguage, IReadOnlyList<Function> functions)
|
||||||
{
|
{
|
||||||
Instruction inst = operation.Inst;
|
Instruction inst = operation.Inst;
|
||||||
StorageKind storageKind = operation.StorageKind;
|
StorageKind storageKind = operation.StorageKind;
|
||||||
@ -124,15 +125,30 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
|||||||
// (or at least that's what the Khronos compiler does).
|
// (or at least that's what the Khronos compiler does).
|
||||||
|
|
||||||
// First one is the function index.
|
// First one is the function index.
|
||||||
sources[0] = context.GetOperandOrCbLoad(operation.GetSource(0));
|
Operand funcIndexOperand = operation.GetSource(0);
|
||||||
|
Debug.Assert(funcIndexOperand.Type == OperandType.Constant);
|
||||||
|
int funcIndex = funcIndexOperand.Value;
|
||||||
|
|
||||||
|
sources[0] = new AstOperand(OperandType.Constant, funcIndex);
|
||||||
|
|
||||||
|
int inArgsCount = functions[funcIndex].InArgumentsCount;
|
||||||
|
|
||||||
// Remaining ones are parameters, copy them to a temp local variable.
|
// Remaining ones are parameters, copy them to a temp local variable.
|
||||||
for (int index = 1; index < operation.SourcesCount; index++)
|
for (int index = 1; index < operation.SourcesCount; index++)
|
||||||
|
{
|
||||||
|
IAstNode source = context.GetOperandOrCbLoad(operation.GetSource(index));
|
||||||
|
|
||||||
|
if (index - 1 < inArgsCount)
|
||||||
{
|
{
|
||||||
AstOperand argTemp = context.NewTemp(FuncParameterType);
|
AstOperand argTemp = context.NewTemp(FuncParameterType);
|
||||||
context.AddNode(new AstAssignment(argTemp, context.GetOperandOrCbLoad(operation.GetSource(index))));
|
context.AddNode(new AstAssignment(argTemp, source));
|
||||||
sources[index] = argTemp;
|
sources[index] = argTemp;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sources[index] = source;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user