mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-22 22:45:46 +00:00
Fix FLO.SH shader instruction with a input of 0 (#2876)
* Fix FLO.SH shader instruction with a input of 0 * Shader cache version bump
This commit is contained in:
parent
2ab777885b
commit
acc0b0f313
6 changed files with 27 additions and 15 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 = 2816;
|
||||
private const ulong ShaderCodeGenVersion = 2876;
|
||||
|
||||
// Progress reporting helpers
|
||||
private volatile int _shaderCount;
|
||||
|
|
|
@ -71,8 +71,9 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
|
|||
Add(Instruction.ExponentB2, InstType.CallUnary, "exp2");
|
||||
Add(Instruction.FSIBegin, InstType.Special);
|
||||
Add(Instruction.FSIEnd, InstType.Special);
|
||||
Add(Instruction.FindFirstSetS32, InstType.CallUnary, "findMSB");
|
||||
Add(Instruction.FindFirstSetU32, InstType.CallUnary, "findMSB");
|
||||
Add(Instruction.FindLSB, InstType.CallUnary, "findLSB");
|
||||
Add(Instruction.FindMSBS32, InstType.CallUnary, "findMSB");
|
||||
Add(Instruction.FindMSBU32, InstType.CallUnary, "findMSB");
|
||||
Add(Instruction.Floor, InstType.CallUnary, "floor");
|
||||
Add(Instruction.FusedMultiplyAdd, InstType.CallTernary, "fma");
|
||||
Add(Instruction.GroupMemoryBarrier, InstType.CallNullary, "groupMemoryBarrier");
|
||||
|
|
|
@ -166,13 +166,17 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
{
|
||||
Operand srcB = context.BitwiseNot(src, invert);
|
||||
|
||||
Operand res = isSigned
|
||||
? context.FindFirstSetS32(srcB)
|
||||
: context.FindFirstSetU32(srcB);
|
||||
Operand res;
|
||||
|
||||
if (sh)
|
||||
{
|
||||
res = context.BitwiseExclusiveOr(res, Const(31));
|
||||
res = context.FindLSB(context.BitfieldReverse(srcB));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = isSigned
|
||||
? context.FindMSBS32(srcB)
|
||||
: context.FindMSBU32(srcB);
|
||||
}
|
||||
|
||||
context.Copy(GetDest(rd), res);
|
||||
|
|
|
@ -68,8 +68,9 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
|
|||
ExponentB2,
|
||||
FSIBegin,
|
||||
FSIEnd,
|
||||
FindFirstSetS32,
|
||||
FindFirstSetU32,
|
||||
FindLSB,
|
||||
FindMSBS32,
|
||||
FindMSBU32,
|
||||
Floor,
|
||||
FusedMultiplyAdd,
|
||||
GroupMemoryBarrier,
|
||||
|
|
|
@ -79,8 +79,9 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
|||
Add(Instruction.Ddy, VariableType.F32, VariableType.F32);
|
||||
Add(Instruction.Divide, VariableType.Scalar, VariableType.Scalar, VariableType.Scalar);
|
||||
Add(Instruction.ExponentB2, VariableType.Scalar, VariableType.Scalar);
|
||||
Add(Instruction.FindFirstSetS32, VariableType.S32, VariableType.S32);
|
||||
Add(Instruction.FindFirstSetU32, VariableType.S32, VariableType.U32);
|
||||
Add(Instruction.FindLSB, VariableType.Int, VariableType.Int);
|
||||
Add(Instruction.FindMSBS32, VariableType.S32, VariableType.S32);
|
||||
Add(Instruction.FindMSBU32, VariableType.S32, VariableType.U32);
|
||||
Add(Instruction.Floor, VariableType.Scalar, VariableType.Scalar);
|
||||
Add(Instruction.FusedMultiplyAdd, VariableType.Scalar, VariableType.Scalar, VariableType.Scalar, VariableType.Scalar);
|
||||
Add(Instruction.ImageLoad, VariableType.F32);
|
||||
|
|
|
@ -181,14 +181,19 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||
return context.Add(Instruction.EndPrimitive);
|
||||
}
|
||||
|
||||
public static Operand FindFirstSetS32(this EmitterContext context, Operand a)
|
||||
public static Operand FindLSB(this EmitterContext context, Operand a)
|
||||
{
|
||||
return context.Add(Instruction.FindFirstSetS32, Local(), a);
|
||||
return context.Add(Instruction.FindLSB, Local(), a);
|
||||
}
|
||||
|
||||
public static Operand FindFirstSetU32(this EmitterContext context, Operand a)
|
||||
public static Operand FindMSBS32(this EmitterContext context, Operand a)
|
||||
{
|
||||
return context.Add(Instruction.FindFirstSetU32, Local(), a);
|
||||
return context.Add(Instruction.FindMSBS32, Local(), a);
|
||||
}
|
||||
|
||||
public static Operand FindMSBU32(this EmitterContext context, Operand a)
|
||||
{
|
||||
return context.Add(Instruction.FindMSBU32, Local(), a);
|
||||
}
|
||||
|
||||
public static Operand FP32ConvertToFP64(this EmitterContext context, Operand a)
|
||||
|
|
Loading…
Reference in a new issue