aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Shader/Instructions
diff options
context:
space:
mode:
authorAlex Barney <thealexbarney@gmail.com>2019-07-01 21:39:22 -0500
committerAc_K <Acoustik666@gmail.com>2019-07-02 04:39:22 +0200
commitb2b736abc2569ab5d8199da666aef8d8394844a0 (patch)
tree88bcc2ae4fb0d4161c95df2cd7edb12388de922a /Ryujinx.Graphics/Shader/Instructions
parent10c74182babaf8cf6bedaeffd64c3109df4ea816 (diff)
Misc cleanup (#708)
* Fix typos * Remove unneeded using statements * Enforce var style more * Remove redundant qualifiers * Fix some indentation * Disable naming warnings on files with external enum names * Fix build * Mass find & replace for comments with no spacing * Standardize todo capitalization and for/if spacing
Diffstat (limited to 'Ryujinx.Graphics/Shader/Instructions')
-rw-r--r--Ryujinx.Graphics/Shader/Instructions/InstEmitAlu.cs44
-rw-r--r--Ryujinx.Graphics/Shader/Instructions/InstEmitAluHelper.cs12
-rw-r--r--Ryujinx.Graphics/Shader/Instructions/InstEmitConversion.cs14
-rw-r--r--Ryujinx.Graphics/Shader/Instructions/InstEmitFArith.cs2
-rw-r--r--Ryujinx.Graphics/Shader/Instructions/InstEmitFlow.cs12
-rw-r--r--Ryujinx.Graphics/Shader/Instructions/InstEmitHelper.cs2
-rw-r--r--Ryujinx.Graphics/Shader/Instructions/InstEmitMemory.cs4
-rw-r--r--Ryujinx.Graphics/Shader/Instructions/InstEmitTexture.cs2
-rw-r--r--Ryujinx.Graphics/Shader/Instructions/Lop3Expression.cs16
9 files changed, 54 insertions, 54 deletions
diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitAlu.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitAlu.cs
index f7815e23..8e2b39bf 100644
--- a/Ryujinx.Graphics/Shader/Instructions/InstEmitAlu.cs
+++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitAlu.cs
@@ -36,7 +36,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
context.Copy(GetDest(context), res);
- //TODO: CC, X, corner cases
+ // TODO: CC, X, corner cases
}
public static void Iadd(EmitterContext context)
@@ -60,7 +60,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (op.Extended)
{
- //Add carry, or subtract borrow.
+ // Add carry, or subtract borrow.
res = context.IAdd(res, isSubtraction
? context.BitwiseNot(GetCF(context))
: context.BitwiseAnd(GetCF(context), Const(1)));
@@ -102,7 +102,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
- //TODO: Warning.
+ // TODO: Warning.
}
return src;
@@ -126,7 +126,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
- //TODO: Warning.
+ // TODO: Warning.
}
}
@@ -134,7 +134,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
context.Copy(GetDest(context), res);
- //TODO: CC, X, corner cases
+ // TODO: CC, X, corner cases
}
public static void Imnmx(EmitterContext context)
@@ -162,7 +162,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
SetZnFlags(context, dest, op.SetCondCode);
- //TODO: X flags.
+ // TODO: X flags.
}
public static void Iscadd(EmitterContext context)
@@ -193,7 +193,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
context.Copy(GetDest(context), res);
- //TODO: CC, X
+ // TODO: CC, X
}
public static void Iset(EmitterContext context)
@@ -225,7 +225,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
context.Copy(dest, res);
}
- //TODO: CC, X
+ // TODO: CC, X
}
public static void Isetp(EmitterContext context)
@@ -330,10 +330,10 @@ namespace Ryujinx.Graphics.Shader.Instructions
public static void Rro(EmitterContext context)
{
- //This is the range reduction operator,
- //we translate it as a simple move, as it
- //should be always followed by a matching
- //MUFU instruction.
+ // This is the range reduction operator,
+ // we translate it as a simple move, as it
+ // should be always followed by a matching
+ // MUFU instruction.
OpCodeAlu op = (OpCodeAlu)context.CurrOp;
bool negateB = op.RawOpCode.Extract(45);
@@ -363,13 +363,13 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (!isMasked)
{
- //Clamped shift value.
+ // Clamped shift value.
Operand isLessThan32 = context.ICompareLessUnsigned(srcB, Const(32));
res = context.ConditionalSelect(isLessThan32, res, Const(0));
}
- //TODO: X, CC
+ // TODO: X, CC
context.Copy(GetDest(context), res);
}
@@ -401,7 +401,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (!isMasked)
{
- //Clamped shift value.
+ // Clamped shift value.
Operand resShiftBy32;
if (isSigned)
@@ -418,7 +418,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
res = context.ConditionalSelect(isLessThan32, res, resShiftBy32);
}
- //TODO: X, CC
+ // TODO: X, CC
context.Copy(GetDest(context), res);
}
@@ -454,7 +454,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
Operand srcB = GetSrcB(context);
Operand srcC = GetSrcC(context);
- //XMAD immediates are 16-bits unsigned integers.
+ // XMAD immediates are 16-bits unsigned integers.
if (srcB.Type == OperandType.Constant)
{
srcB = Const(srcB.Value & 0xffff);
@@ -541,12 +541,12 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (extended)
{
- //Add with carry.
+ // Add with carry.
res = context.IAdd(res, context.BitwiseAnd(GetCF(context), Const(1)));
}
else
{
- //Add (no carry in).
+ // Add (no carry in).
res = context.IAdd(res, srcC);
}
@@ -654,12 +654,12 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (!extended || isSubtraction)
{
- //C = d < a
+ // C = d < a
context.Copy(GetCF(context), context.ICompareLessUnsigned(res, srcA));
}
else
{
- //C = (d == a && CIn) || d < a
+ // C = (d == a && CIn) || d < a
Operand tempC0 = context.ICompareEqual (res, srcA);
Operand tempC1 = context.ICompareLessUnsigned(res, srcA);
@@ -668,7 +668,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
context.Copy(GetCF(context), context.BitwiseOr(tempC0, tempC1));
}
- //V = (d ^ a) & ~(a ^ b) < 0
+ // V = (d ^ a) & ~(a ^ b) < 0
Operand tempV0 = context.BitwiseExclusiveOr(res, srcA);
Operand tempV1 = context.BitwiseExclusiveOr(srcA, srcB);
diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitAluHelper.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitAluHelper.cs
index b5bde1a1..5c4f5398 100644
--- a/Ryujinx.Graphics/Shader/Instructions/InstEmitAluHelper.cs
+++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitAluHelper.cs
@@ -65,12 +65,12 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (extended)
{
- //When the operation is extended, it means we are doing
- //the operation on a long word with any number of bits,
- //so we need to AND the zero flag from result with the
- //previous result when extended is specified, to ensure
- //we have ZF set only if all words are zero, and not just
- //the last one.
+ // When the operation is extended, it means we are doing
+ // the operation on a long word with any number of bits,
+ // so we need to AND the zero flag from result with the
+ // previous result when extended is specified, to ensure
+ // we have ZF set only if all words are zero, and not just
+ // the last one.
Operand oldZF = GetZF(context);
Operand res = context.BitwiseAnd(context.ICompareEqual(dest, Const(0)), oldZF);
diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitConversion.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitConversion.cs
index f5e9af03..c4de1750 100644
--- a/Ryujinx.Graphics/Shader/Instructions/InstEmitConversion.cs
+++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitConversion.cs
@@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
WriteFP(context, dstType, srcB);
- //TODO: CC.
+ // TODO: CC.
}
public static void F2I(EmitterContext context)
@@ -88,7 +88,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
srcB = context.FPConvertToS32(srcB);
- //TODO: S/U64, conversion overflow handling.
+ // TODO: S/U64, conversion overflow handling.
if (intType != IntegerType.S32)
{
int min = GetIntMin(intType);
@@ -103,7 +103,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
context.Copy(dest, srcB);
- //TODO: CC.
+ // TODO: CC.
}
public static void I2F(EmitterContext context)
@@ -137,7 +137,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
WriteFP(context, dstType, srcB);
- //TODO: CC.
+ // TODO: CC.
}
public static void I2I(EmitterContext context)
@@ -149,7 +149,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (srcType == IntegerType.U64 || dstType == IntegerType.U64)
{
- //TODO: Warning. This instruction doesn't support 64-bits integers
+ // TODO: Warning. This instruction doesn't support 64-bits integers
}
bool srcIsSmallInt = srcType <= IntegerType.U16;
@@ -189,7 +189,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
context.Copy(GetDest(context), srcB);
- //TODO: CC.
+ // TODO: CC.
}
private static void WriteFP(EmitterContext context, FPType type, Operand srcB)
@@ -206,7 +206,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
- //TODO.
+ // TODO.
}
}
}
diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitFArith.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitFArith.cs
index 72492470..8c64c097 100644
--- a/Ryujinx.Graphics/Shader/Instructions/InstEmitFArith.cs
+++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitFArith.cs
@@ -146,7 +146,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
context.Copy(dest, res);
}
- //TODO: CC, X
+ // TODO: CC, X
}
public static void Fsetp(EmitterContext context)
diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitFlow.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitFlow.cs
index c4523f75..fb76e06a 100644
--- a/Ryujinx.Graphics/Shader/Instructions/InstEmitFlow.cs
+++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitFlow.cs
@@ -19,8 +19,8 @@ namespace Ryujinx.Graphics.Shader.Instructions
{
OpCodeExit op = (OpCodeExit)context.CurrOp;
- //TODO: Figure out how this is supposed to work in the
- //presence of other condition codes.
+ // TODO: Figure out how this is supposed to work in the
+ // presence of other condition codes.
if (op.Condition == Condition.Always)
{
context.Return();
@@ -54,8 +54,8 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (op.Targets.Count == 1)
{
- //If we have only one target, then the SSY is basically
- //a branch, we can produce better codegen for this case.
+ // If we have only one target, then the SSY is basically
+ // a branch, we can produce better codegen for this case.
OpCodeSsy opSsy = op.Targets.Keys.First();
EmitBranch(context, opSsy.GetAbsoluteAddress());
@@ -79,8 +79,8 @@ namespace Ryujinx.Graphics.Shader.Instructions
private static void EmitBranch(EmitterContext context, ulong address)
{
- //If we're branching to the next instruction, then the branch
- //is useless and we can ignore it.
+ // If we're branching to the next instruction, then the branch
+ // is useless and we can ignore it.
if (address == context.CurrOp.Address + 8)
{
return;
diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitHelper.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitHelper.cs
index e31528d0..c87e1789 100644
--- a/Ryujinx.Graphics/Shader/Instructions/InstEmitHelper.cs
+++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitHelper.cs
@@ -53,7 +53,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else if (floatType == FPType.FP64)
{
- //TODO.
+ // TODO.
}
throw new ArgumentException($"Invalid floating point type \"{floatType}\".");
diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitMemory.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitMemory.cs
index d81e97a1..a2a50fce 100644
--- a/Ryujinx.Graphics/Shader/Instructions/InstEmitMemory.cs
+++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitMemory.cs
@@ -71,7 +71,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (op.Size > IntegerSize.B64)
{
- //TODO: Warning.
+ // TODO: Warning.
}
bool isSmallInt = op.Size < IntegerSize.B32;
@@ -121,7 +121,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (!(emit || cut))
{
- //TODO: Warning.
+ // TODO: Warning.
}
if (emit)
diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitTexture.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitTexture.cs
index 1b19d901..a9b29f40 100644
--- a/Ryujinx.Graphics/Shader/Instructions/InstEmitTexture.cs
+++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitTexture.cs
@@ -443,7 +443,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
TextureProperty property = (TextureProperty)op.RawOpCode.Extract(22, 6);
- //TODO: Validate and use property.
+ // TODO: Validate and use property.
Instruction inst = Instruction.TextureSize;
TextureType type = TextureType.Texture2D;
diff --git a/Ryujinx.Graphics/Shader/Instructions/Lop3Expression.cs b/Ryujinx.Graphics/Shader/Instructions/Lop3Expression.cs
index e55ed660..67e24957 100644
--- a/Ryujinx.Graphics/Shader/Instructions/Lop3Expression.cs
+++ b/Ryujinx.Graphics/Shader/Instructions/Lop3Expression.cs
@@ -16,11 +16,11 @@ namespace Ryujinx.Graphics.Shader.Instructions
{
Operand expr = null;
- //Handle some simple cases, or cases where
- //the KMap would yield poor results (like XORs).
+ // Handle some simple cases, or cases where
+ // the KMap would yield poor results (like XORs).
if (imm == 0x96 || imm == 0x69)
{
- //XOR (0x96) and XNOR (0x69).
+ // XOR (0x96) and XNOR (0x69).
if (imm == 0x69)
{
srcA = context.BitwiseNot(srcA);
@@ -33,18 +33,18 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else if (imm == 0)
{
- //Always false.
+ // Always false.
return Const(IrConsts.False);
}
else if (imm == 0xff)
{
- //Always true.
+ // Always true.
return Const(IrConsts.True);
}
int map;
- //Encode into gray code.
+ // Encode into gray code.
map = ((imm >> 0) & 1) << 0;
map |= ((imm >> 1) & 1) << 4;
map |= ((imm >> 2) & 1) << 1;
@@ -54,7 +54,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
map |= ((imm >> 6) & 1) << 2;
map |= ((imm >> 7) & 1) << 6;
- //Solve KMap, get sum of products.
+ // Solve KMap, get sum of products.
int visited = 0;
for (int index = 0; index < 8 && visited != 0xff; index++)
@@ -76,7 +76,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
}
- //The mask should wrap, if we are on the high row, shift to low etc.
+ // The mask should wrap, if we are on the high row, shift to low etc.
int mask2 = (index & 4) != 0 ? mask >> 4 : mask << 4;
if ((map & mask2) == mask2)