Add support for saturation on some shader instructions, fix ReadTexture alignment and add ColorMask support (#451)

* Add support for saturation on some shader instructions, fix ReadTexture alignment

* Add ColorMask support, other tweaks
This commit is contained in:
gdkchan 2018-10-13 23:54:14 -03:00 committed by GitHub
parent 894459fcd7
commit 72317d7777
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 63 additions and 12 deletions

View file

@ -2,6 +2,9 @@ namespace Ryujinx.Graphics.Gal.Shader
{
static class ShaderDecodeHelper
{
private static readonly ShaderIrOperImmf ImmfZero = new ShaderIrOperImmf(0);
private static readonly ShaderIrOperImmf ImmfOne = new ShaderIrOperImmf(1);
public static ShaderIrNode GetAluFabsFneg(ShaderIrNode Node, bool Abs, bool Neg)
{
return GetAluFneg(GetAluFabs(Node, Abs), Neg);
@ -17,6 +20,11 @@ namespace Ryujinx.Graphics.Gal.Shader
return Neg ? new ShaderIrOp(ShaderIrInst.Fneg, Node) : Node;
}
public static ShaderIrNode GetAluFsat(ShaderIrNode Node, bool Sat)
{
return Sat ? new ShaderIrOp(ShaderIrInst.Fclamp, Node, ImmfZero, ImmfOne) : Node;
}
public static ShaderIrNode GetAluIabsIneg(ShaderIrNode Node, bool Abs, bool Neg)
{
return GetAluIneg(GetAluIabs(Node, Abs), Neg);