Add shader support for the round mode on the F2F instruction, support mipmaps on ASTC compressed textures

This commit is contained in:
gdk 2019-10-27 17:51:33 -03:00 committed by Thog
parent d3fcab8511
commit 3bcc395253
8 changed files with 39 additions and 18 deletions

View file

@ -74,6 +74,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
Add(Instruction.Negate, InstType.OpUnary, "-", 0);
Add(Instruction.ReciprocalSquareRoot, InstType.CallUnary, "inversesqrt");
Add(Instruction.Return, InstType.OpNullary, "return");
Add(Instruction.Round, InstType.CallUnary, "roundEven");
Add(Instruction.Sine, InstType.CallUnary, "sin");
Add(Instruction.SquareRoot, InstType.CallUnary, "sqrt");
Add(Instruction.StoreLocal, InstType.Special);

View file

@ -29,6 +29,10 @@ namespace Ryujinx.Graphics.Shader.Instructions
{
switch (op.RoundingMode)
{
case RoundingMode.ToNearest:
srcB = context.FPRound(srcB);
break;
case RoundingMode.TowardsNegativeInfinity:
srcB = context.FPFloor(srcB);
break;

View file

@ -71,6 +71,7 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
PackHalf2x16,
ReciprocalSquareRoot,
Return,
Round,
ShiftLeft,
ShiftRightS32,
ShiftRightU32,

View file

@ -83,6 +83,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
Add(Instruction.Negate, VariableType.Scalar, VariableType.Scalar);
Add(Instruction.PackHalf2x16, VariableType.U32, VariableType.F32, VariableType.F32);
Add(Instruction.ReciprocalSquareRoot, VariableType.Scalar, VariableType.Scalar);
Add(Instruction.Round, VariableType.F32, VariableType.F32);
Add(Instruction.Sine, VariableType.Scalar, VariableType.Scalar);
Add(Instruction.SquareRoot, VariableType.Scalar, VariableType.Scalar);
Add(Instruction.StoreGlobal, VariableType.None, VariableType.S32, VariableType.S32, VariableType.F32);

View file

@ -171,6 +171,11 @@ namespace Ryujinx.Graphics.Shader.Translation
return context.Add(Instruction.FP | Instruction.Floor, Local(), a);
}
public static Operand FPFusedMultiplyAdd(this EmitterContext context, Operand a, Operand b, Operand c)
{
return context.Add(Instruction.FusedMultiplyAdd, Local(), a, b, c);
}
public static Operand FPLogarithmB2(this EmitterContext context, Operand a)
{
return context.Add(Instruction.FP | Instruction.LogarithmB2, Local(), a);
@ -191,11 +196,6 @@ namespace Ryujinx.Graphics.Shader.Translation
return context.Add(Instruction.FP | Instruction.Multiply, Local(), a, b);
}
public static Operand FPFusedMultiplyAdd(this EmitterContext context, Operand a, Operand b, Operand c)
{
return context.Add(Instruction.FusedMultiplyAdd, Local(), a, b, c);
}
public static Operand FPNegate(this EmitterContext context, Operand a, bool neg)
{
if (neg)
@ -221,6 +221,11 @@ namespace Ryujinx.Graphics.Shader.Translation
return context.Add(Instruction.FP | Instruction.ReciprocalSquareRoot, Local(), a);
}
public static Operand FPRound(this EmitterContext context, Operand a)
{
return context.Add(Instruction.FP | Instruction.Round, Local(), a);
}
public static Operand FPSaturate(this EmitterContext context, Operand a, bool sat)
{
if (sat)