aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Shader
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
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')
-rw-r--r--Ryujinx.Graphics/Shader/CodeGen/Glsl/CodeGenContext.cs20
-rw-r--r--Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs10
-rw-r--r--Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs12
-rw-r--r--Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstType.cs10
-rw-r--r--Ryujinx.Graphics/Shader/CodeGen/Glsl/OperandManager.cs12
-rw-r--r--Ryujinx.Graphics/Shader/Decoders/Decoder.cs18
-rw-r--r--Ryujinx.Graphics/Shader/Decoders/OpCode.cs2
-rw-r--r--Ryujinx.Graphics/Shader/Decoders/OpCodeTextureScalar.cs1
-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
-rw-r--r--Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs2
-rw-r--r--Ryujinx.Graphics/Shader/ShaderHeader.cs2
-rw-r--r--Ryujinx.Graphics/Shader/StructuredIr/AstBlockVisitor.cs6
-rw-r--r--Ryujinx.Graphics/Shader/StructuredIr/GotoElimination.cs48
-rw-r--r--Ryujinx.Graphics/Shader/StructuredIr/StructuredProgram.cs8
-rw-r--r--Ryujinx.Graphics/Shader/StructuredIr/StructuredProgramContext.cs10
-rw-r--r--Ryujinx.Graphics/Shader/Translation/AttributeConsts.cs4
-rw-r--r--Ryujinx.Graphics/Shader/Translation/Dominance.cs4
-rw-r--r--Ryujinx.Graphics/Shader/Translation/Optimizations/BranchElimination.cs14
-rw-r--r--Ryujinx.Graphics/Shader/Translation/Optimizations/HalfConversion.cs4
-rw-r--r--Ryujinx.Graphics/Shader/Translation/Optimizations/Optimizer.cs12
-rw-r--r--Ryujinx.Graphics/Shader/Translation/Optimizations/Simplification.cs22
-rw-r--r--Ryujinx.Graphics/Shader/Translation/Ssa.cs12
-rw-r--r--Ryujinx.Graphics/Shader/Translation/Translator.cs28
31 files changed, 185 insertions, 184 deletions
diff --git a/Ryujinx.Graphics/Shader/CodeGen/Glsl/CodeGenContext.cs b/Ryujinx.Graphics/Shader/CodeGen/Glsl/CodeGenContext.cs
index ce5d7b94..dcbdc309 100644
--- a/Ryujinx.Graphics/Shader/CodeGen/Glsl/CodeGenContext.cs
+++ b/Ryujinx.Graphics/Shader/CodeGen/Glsl/CodeGenContext.cs
@@ -18,7 +18,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
private int _level;
- private string _identation;
+ private string _indentation;
public CodeGenContext(ShaderConfig config)
{
@@ -39,7 +39,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
public void AppendLine(string str)
{
- _sb.AppendLine(_identation + str);
+ _sb.AppendLine(_indentation + str);
}
public string GetCode()
@@ -53,7 +53,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
_level++;
- UpdateIdentation();
+ UpdateIndentation();
}
public void LeaveScope(string suffix = "")
@@ -65,26 +65,26 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
_level--;
- UpdateIdentation();
+ UpdateIndentation();
AppendLine("}" + suffix);
}
- private void UpdateIdentation()
+ private void UpdateIndentation()
{
- _identation = GetIdentation(_level);
+ _indentation = GetIndentation(_level);
}
- private static string GetIdentation(int level)
+ private static string GetIndentation(int level)
{
- string identation = string.Empty;
+ string indentation = string.Empty;
for (int index = 0; index < level; index++)
{
- identation += Tab;
+ indentation += Tab;
}
- return identation;
+ return indentation;
}
}
} \ No newline at end of file
diff --git a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs
index 0b860072..9855cd91 100644
--- a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs
+++ b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs
@@ -112,13 +112,13 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
public static bool NeedsParenthesis(IAstNode node, Instruction pInst, InstInfo pInfo, bool isLhs)
{
- //If the node isn't a operation, then it can only be a operand,
- //and those never needs to be surrounded in parenthesis.
+ // If the node isn't a operation, then it can only be a operand,
+ // and those never needs to be surrounded in parenthesis.
if (!(node is AstOperation operation))
{
- //This is sort of a special case, if this is a negative constant,
- //and it is consumed by a unary operation, we need to put on the parenthesis,
- //as in GLSL a sequence like --2 or ~-1 is not valid.
+ // This is sort of a special case, if this is a negative constant,
+ // and it is consumed by a unary operation, we need to put on the parenthesis,
+ // as in GLSL a sequence like --2 or ~-1 is not valid.
if (IsNegativeConst(node) && pInfo.Type == InstType.OpUnary)
{
return true;
diff --git a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs
index 79f80057..8b5257fc 100644
--- a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs
+++ b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs
@@ -69,8 +69,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
arrayIndexElem = pCount++;
}
- //The sampler 1D shadow overload expects a
- //dummy value on the middle of the vector, who knows why...
+ // The sampler 1D shadow overload expects a
+ // dummy value on the middle of the vector, who knows why...
bool hasDummy1DShadowElem = texOp.Type == (TextureType.Texture1D | TextureType.Shadow);
if (hasDummy1DShadowElem)
@@ -83,8 +83,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
pCount++;
}
- //On textureGather*, the comparison value is
- //always specified as an extra argument.
+ // On textureGather*, the comparison value is
+ // always specified as an extra argument.
bool hasExtraCompareArg = isShadow && isGather;
if (pCount == 5)
@@ -199,8 +199,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
Append(Src(VariableType.F32));
}
- //textureGather* optional extra component index,
- //not needed for shadow samplers.
+ // textureGather* optional extra component index,
+ // not needed for shadow samplers.
if (isGather && !isShadow)
{
Append(Src(VariableType.S32));
diff --git a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstType.cs b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstType.cs
index 7d38a9d2..121cd079 100644
--- a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstType.cs
+++ b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstType.cs
@@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
OpUnary = Op | 1,
OpBinary = Op | 2,
OpTernary = Op | 3,
- OpBinaryCom = OpBinary | Comutative,
+ OpBinaryCom = OpBinary | Commutative,
CallNullary = Call | 0,
CallUnary = Call | 1,
@@ -17,10 +17,10 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
CallTernary = Call | 3,
CallQuaternary = Call | 4,
- Comutative = 1 << 8,
- Op = 1 << 9,
- Call = 1 << 10,
- Special = 1 << 11,
+ Commutative = 1 << 8,
+ Op = 1 << 9,
+ Call = 1 << 10,
+ Special = 1 << 11,
ArityMask = 0xff
}
diff --git a/Ryujinx.Graphics/Shader/CodeGen/Glsl/OperandManager.cs b/Ryujinx.Graphics/Shader/CodeGen/Glsl/OperandManager.cs
index 9aed8eb8..19f7185e 100644
--- a/Ryujinx.Graphics/Shader/CodeGen/Glsl/OperandManager.cs
+++ b/Ryujinx.Graphics/Shader/CodeGen/Glsl/OperandManager.cs
@@ -102,9 +102,9 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
public static string GetConstantBufferName(IAstNode slot, string offsetExpr, GalShaderType shaderType)
{
- //Non-constant slots are not supported.
- //It is expected that upstream stages are never going to generate non-constant
- //slot access.
+ // Non-constant slots are not supported.
+ // It is expected that upstream stages are never going to generate non-constant
+ // slot access.
AstOperand operand = (AstOperand)slot;
string ubName = GetUbName(shaderType, operand.Value);
@@ -157,7 +157,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
}
else if (_builtInAttributes.TryGetValue(value & ~3, out BuiltInAttribute builtInAttr))
{
- //TODO: There must be a better way to handle this...
+ // TODO: There must be a better way to handle this...
if (shaderType == GalShaderType.Fragment)
{
switch (value & ~3)
@@ -180,14 +180,14 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
}
}
- //TODO: Warn about unknown built-in attribute.
+ // TODO: Warn about unknown built-in attribute.
return isOutAttr ? "// bad_attr0x" + value.ToString("X") : "0.0";
}
public static string GetUbName(GalShaderType shaderType, int slot)
{
- string ubName = OperandManager.GetShaderStagePrefix(shaderType);
+ string ubName = GetShaderStagePrefix(shaderType);
ubName += "_" + DefaultNames.UniformNamePrefix + slot;
diff --git a/Ryujinx.Graphics/Shader/Decoders/Decoder.cs b/Ryujinx.Graphics/Shader/Decoders/Decoder.cs
index 86df3b20..754e0388 100644
--- a/Ryujinx.Graphics/Shader/Decoders/Decoder.cs
+++ b/Ryujinx.Graphics/Shader/Decoders/Decoder.cs
@@ -51,7 +51,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
while (workQueue.TryDequeue(out Block currBlock))
{
- //Check if the current block is inside another block.
+ // Check if the current block is inside another block.
if (BinarySearch(blocks, currBlock.Address, out int nBlkIndex))
{
Block nBlock = blocks[nBlkIndex];
@@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
continue;
}
- //If we have a block after the current one, set the limit address.
+ // If we have a block after the current one, set the limit address.
ulong limitAddress = ulong.MaxValue;
if (nBlkIndex != blocks.Count)
@@ -96,10 +96,10 @@ namespace Ryujinx.Graphics.Shader.Decoders
GetBlock(ssyOp.GetAbsoluteAddress());
}
- //Set child blocks. "Branch" is the block the branch instruction
- //points to (when taken), "Next" is the block at the next address,
- //executed when the branch is not taken. For Unconditional Branches
- //or end of program, Next is null.
+ // Set child blocks. "Branch" is the block the branch instruction
+ // points to (when taken), "Next" is the block at the next address,
+ // executed when the branch is not taken. For Unconditional Branches
+ // or end of program, Next is null.
OpCode lastOp = currBlock.GetLastOp();
if (lastOp is OpCodeBranch op)
@@ -113,7 +113,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
}
}
- //Insert the new block on the list (sorted by address).
+ // Insert the new block on the list (sorted by address).
if (blocks.Count != 0)
{
Block nBlock = blocks[nBlkIndex];
@@ -187,7 +187,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
break;
}
- //Ignore scheduling instructions, which are written every 32 bytes.
+ // Ignore scheduling instructions, which are written every 32 bytes.
if (((address - startAddress) & 0x1f) == 0)
{
address += 8;
@@ -208,7 +208,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
if (emitter == null)
{
- //TODO: Warning, illegal encoding.
+ // TODO: Warning, illegal encoding.
continue;
}
diff --git a/Ryujinx.Graphics/Shader/Decoders/OpCode.cs b/Ryujinx.Graphics/Shader/Decoders/OpCode.cs
index b0f2ffdc..94af49e0 100644
--- a/Ryujinx.Graphics/Shader/Decoders/OpCode.cs
+++ b/Ryujinx.Graphics/Shader/Decoders/OpCode.cs
@@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
public bool InvertPredicate { get; protected set; }
- //When inverted, the always true predicate == always false.
+ // When inverted, the always true predicate == always false.
public bool NeverExecute => Predicate.Index == RegisterConsts.PredicateTrueIndex && InvertPredicate;
public OpCode(InstEmitter emitter, ulong address, long opCode)
diff --git a/Ryujinx.Graphics/Shader/Decoders/OpCodeTextureScalar.cs b/Ryujinx.Graphics/Shader/Decoders/OpCodeTextureScalar.cs
index 4389f453..470b81f5 100644
--- a/Ryujinx.Graphics/Shader/Decoders/OpCodeTextureScalar.cs
+++ b/Ryujinx.Graphics/Shader/Decoders/OpCodeTextureScalar.cs
@@ -1,3 +1,4 @@
+// ReSharper disable InconsistentNaming
using Ryujinx.Graphics.Shader.Instructions;
namespace Ryujinx.Graphics.Shader.Decoders
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)
diff --git a/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs b/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs
index f6579953..c60f393e 100644
--- a/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs
+++ b/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs
@@ -23,7 +23,7 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
Inst = inst;
Dest = dest;
- //The array may be modified externally, so we store a copy.
+ // The array may be modified externally, so we store a copy.
_sources = (Operand[])sources.Clone();
for (int index = 0; index < _sources.Length; index++)
diff --git a/Ryujinx.Graphics/Shader/ShaderHeader.cs b/Ryujinx.Graphics/Shader/ShaderHeader.cs
index 53abdc56..379f3f35 100644
--- a/Ryujinx.Graphics/Shader/ShaderHeader.cs
+++ b/Ryujinx.Graphics/Shader/ShaderHeader.cs
@@ -158,7 +158,7 @@ namespace Ryujinx.Graphics.Shader
}
}
- //Depth register is always two registers after the last color output.
+ // Depth register is always two registers after the last color output.
return count + 1;
}
}
diff --git a/Ryujinx.Graphics/Shader/StructuredIr/AstBlockVisitor.cs b/Ryujinx.Graphics/Shader/StructuredIr/AstBlockVisitor.cs
index 9397fdb9..10d5dce0 100644
--- a/Ryujinx.Graphics/Shader/StructuredIr/AstBlockVisitor.cs
+++ b/Ryujinx.Graphics/Shader/StructuredIr/AstBlockVisitor.cs
@@ -33,7 +33,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
while (node != null)
{
- //We reached a child block, visit the nodes inside.
+ // We reached a child block, visit the nodes inside.
while (node is AstBlock childBlock)
{
Block = childBlock;
@@ -43,7 +43,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
BlockEntered?.Invoke(this, new BlockVisitationEventArgs(Block));
}
- //Node may be null, if the block is empty.
+ // Node may be null, if the block is empty.
if (node != null)
{
IAstNode next = Next(node);
@@ -53,7 +53,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
node = next;
}
- //We reached the end of the list, go up on tree to the parent blocks.
+ // We reached the end of the list, go up on tree to the parent blocks.
while (node == null && Block.Type != AstBlockType.Main)
{
BlockLeft?.Invoke(this, new BlockVisitationEventArgs(Block));
diff --git a/Ryujinx.Graphics/Shader/StructuredIr/GotoElimination.cs b/Ryujinx.Graphics/Shader/StructuredIr/GotoElimination.cs
index dffc3142..8bcf9d9c 100644
--- a/Ryujinx.Graphics/Shader/StructuredIr/GotoElimination.cs
+++ b/Ryujinx.Graphics/Shader/StructuredIr/GotoElimination.cs
@@ -8,8 +8,8 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
{
static class GotoElimination
{
- //This is a modified version of the algorithm presented on the paper
- //"Taming Control Flow: A Structured Approach to Eliminating Goto Statements".
+ // This is a modified version of the algorithm presented on the paper
+ // "Taming Control Flow: A Structured Approach to Eliminating Goto Statements".
public static void Eliminate(GotoStatement[] gotos)
{
for (int index = gotos.Length - 1; index >= 0; index--)
@@ -43,10 +43,10 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
if (Previous(stmt.Goto) is AstBlock elseBlock && elseBlock.Type == AstBlockType.Else)
{
- //It's possible that the label was enclosed inside an else block,
- //in this case we need to update the block and level.
- //We also need to set the IsLoop for the case when the label is
- //now before the goto, due to the newly introduced else block.
+ // It's possible that the label was enclosed inside an else block,
+ // in this case we need to update the block and level.
+ // We also need to set the IsLoop for the case when the label is
+ // now before the goto, due to the newly introduced else block.
lBlock = ParentBlock(stmt.Label);
lLevel = Level(lBlock);
@@ -97,7 +97,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
private static bool DirectlyRelated(AstBlock lBlock, AstBlock rBlock, int lLevel, int rLevel)
{
- //If the levels are equal, they can be either siblings or indirectly related.
+ // If the levels are equal, they can be either siblings or indirectly related.
if (lLevel == rLevel)
{
return false;
@@ -171,9 +171,9 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
AstBlock block = origin;
- //Check if a loop is enclosing the goto, and the block that is
- //directly related to the label is above the loop block.
- //In that case, we need to introduce a break to get out of the loop.
+ // Check if a loop is enclosing the goto, and the block that is
+ // directly related to the label is above the loop block.
+ // In that case, we need to introduce a break to get out of the loop.
AstBlock loopBlock = origin;
int loopLevel = gLevel;
@@ -199,7 +199,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
}
}
- //Insert ifs to skip the parts that shouldn't be executed due to the goto.
+ // Insert ifs to skip the parts that shouldn't be executed due to the goto.
bool tryInsertElse = stmt.IsUnconditional && origin.Type == AstBlockType.If;
while (gLevel > lLevel)
@@ -210,10 +210,10 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
AstBlock child = block;
- //We can't move the goto in the middle of a if and a else block, in
- //this case we need to move it after the else.
- //IsLoop may need to be updated if the label is inside the else, as
- //introducing a loop is the only way to ensure the else will be executed.
+ // We can't move the goto in the middle of a if and a else block, in
+ // this case we need to move it after the else.
+ // IsLoop may need to be updated if the label is inside the else, as
+ // introducing a loop is the only way to ensure the else will be executed.
if (Next(child) is AstBlock elseBlock && elseBlock.Type == AstBlockType.Else)
{
child = elseBlock;
@@ -256,7 +256,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
if (child.Type == AstBlockType.If)
{
- //Modify the if condition to allow it to be entered by the goto.
+ // Modify the if condition to allow it to be entered by the goto.
if (!ContainsCondComb(child.Condition, Instruction.LogicalOr, stmt.Condition))
{
child.OrCondition(stmt.Condition);
@@ -264,7 +264,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
}
else if (child.Type == AstBlockType.Else)
{
- //Modify the matching if condition to force the else to be entered by the goto.
+ // Modify the matching if condition to force the else to be entered by the goto.
if (!(Previous(child) is AstBlock ifBlock) || ifBlock.Type != AstBlockType.If)
{
throw new InvalidOperationException("Found an else without a matching if.");
@@ -309,14 +309,14 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
{
if (block.Type == AstBlockType.DoWhile && first == block.First)
{
- //We only need to insert the continue if we're not at the end of the loop,
- //or if our condition is different from the loop condition.
+ // We only need to insert the continue if we're not at the end of the loop,
+ // or if our condition is different from the loop condition.
if (Next(stmt.Goto) != null || block.Condition != stmt.Condition)
{
EncloseSingleInst(stmt, Instruction.LoopContinue);
}
- //Modify the do-while condition to allow it to continue.
+ // Modify the do-while condition to allow it to continue.
if (!ContainsCondComb(block.Condition, Instruction.LogicalOr, stmt.Condition))
{
block.OrCondition(stmt.Condition);
@@ -356,10 +356,10 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
cond = InverseCond(cond);
}
- //Do a quick check, if we are enclosing a single block,
- //and the block type/condition matches the one we're going
- //to create, then we don't need a new block, we can just
- //return the old one.
+ // Do a quick check, if we are enclosing a single block,
+ // and the block type/condition matches the one we're going
+ // to create, then we don't need a new block, we can just
+ // return the old one.
bool hasSingleNode = Next(first) == last;
if (hasSingleNode && BlockMatches(first, type, cond))
diff --git a/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgram.cs b/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgram.cs
index f65631be..26faaf36 100644
--- a/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgram.cs
+++ b/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgram.cs
@@ -69,10 +69,10 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
AstAssignment assignment;
- //If all the sources are bool, it's better to use short-circuiting
- //logical operations, rather than forcing a cast to int and doing
- //a bitwise operation with the value, as it is likely to be used as
- //a bool in the end.
+ // If all the sources are bool, it's better to use short-circuiting
+ // logical operations, rather than forcing a cast to int and doing
+ // a bitwise operation with the value, as it is likely to be used as
+ // a bool in the end.
if (IsBitwiseInst(inst) && AreAllSourceTypesEqual(sources, VariableType.Bool))
{
inst = GetLogicalFromBitwiseInst(inst);
diff --git a/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgramContext.cs b/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgramContext.cs
index e1f0503a..5d6ff890 100644
--- a/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgramContext.cs
+++ b/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgramContext.cs
@@ -65,8 +65,8 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
private void LookForDoWhileStatements(BasicBlock block)
{
- //Check if we have any predecessor whose index is greater than the
- //current block, this indicates a loop.
+ // Check if we have any predecessor whose index is greater than the
+ // current block, this indicates a loop.
bool done = false;
foreach (BasicBlock predecessor in block.Predecessors.OrderByDescending(x => x.Index))
@@ -146,9 +146,9 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
{
AddNode(gotoTempAsg);
- //For block 0, we don't need to add the extra "reset" at the beggining,
- //because it is already the first node to be executed on the shader,
- //so it is reset to false by the "local" assignment anyway.
+ // For block 0, we don't need to add the extra "reset" at the beginning,
+ // because it is already the first node to be executed on the shader,
+ // so it is reset to false by the "local" assignment anyway.
if (block.Index != 0)
{
Info.MainBlock.AddFirst(Assign(gotoTempAsg.Destination, Const(IrConsts.False)));
diff --git a/Ryujinx.Graphics/Shader/Translation/AttributeConsts.cs b/Ryujinx.Graphics/Shader/Translation/AttributeConsts.cs
index 0fd16ce8..f21a6252 100644
--- a/Ryujinx.Graphics/Shader/Translation/AttributeConsts.cs
+++ b/Ryujinx.Graphics/Shader/Translation/AttributeConsts.cs
@@ -29,8 +29,8 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
public const int UserAttributeEnd = UserAttributeBase + UserAttributesCount * 16;
- //Note: Those attributes are used internally by the translator
- //only, they don't exist on Maxwell.
+ // Note: Those attributes are used internally by the translator
+ // only, they don't exist on Maxwell.
public const int FragmentOutputDepth = 0x1000000;
public const int FragmentOutputColorBase = 0x1000010;
public const int FragmentOutputColorEnd = FragmentOutputColorBase + 8 * 16;
diff --git a/Ryujinx.Graphics/Shader/Translation/Dominance.cs b/Ryujinx.Graphics/Shader/Translation/Dominance.cs
index b4b80e3e..6a3ff35f 100644
--- a/Ryujinx.Graphics/Shader/Translation/Dominance.cs
+++ b/Ryujinx.Graphics/Shader/Translation/Dominance.cs
@@ -5,8 +5,8 @@ namespace Ryujinx.Graphics.Shader.Translation
{
static class Dominance
{
- //Those methods are an implementation of the algorithms on "A Simple, Fast Dominance Algorithm".
- //https://www.cs.rice.edu/~keith/EMBED/dom.pdf
+ // Those methods are an implementation of the algorithms on "A Simple, Fast Dominance Algorithm".
+ // https://www.cs.rice.edu/~keith/EMBED/dom.pdf
public static void FindDominators(BasicBlock entry, int blocksCount)
{
HashSet<BasicBlock> visited = new HashSet<BasicBlock>();
diff --git a/Ryujinx.Graphics/Shader/Translation/Optimizations/BranchElimination.cs b/Ryujinx.Graphics/Shader/Translation/Optimizations/BranchElimination.cs
index 2b0f1905..070f07a4 100644
--- a/Ryujinx.Graphics/Shader/Translation/Optimizations/BranchElimination.cs
+++ b/Ryujinx.Graphics/Shader/Translation/Optimizations/BranchElimination.cs
@@ -19,13 +19,13 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
private static bool IsRedundantBranch(Operation current, BasicBlock nextBlock)
{
- //Here we check that:
- //- The current block ends with a branch.
- //- The next block only contains a branch.
- //- The branch on the next block is unconditional.
- //- Both branches are jumping to the same location.
- //In this case, the branch on the current block can be removed,
- //as the next block is going to jump to the same place anyway.
+ // Here we check that:
+ // - The current block ends with a branch.
+ // - The next block only contains a branch.
+ // - The branch on the next block is unconditional.
+ // - Both branches are jumping to the same location.
+ // In this case, the branch on the current block can be removed,
+ // as the next block is going to jump to the same place anyway.
if (nextBlock == null)
{
return false;
diff --git a/Ryujinx.Graphics/Shader/Translation/Optimizations/HalfConversion.cs b/Ryujinx.Graphics/Shader/Translation/Optimizations/HalfConversion.cs
index 9ef35abc..96060272 100644
--- a/Ryujinx.Graphics/Shader/Translation/Optimizations/HalfConversion.cs
+++ b/Ryujinx.Graphics/Shader/Translation/Optimizations/HalfConversion.cs
@@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
if (exponent == 0x1f)
{
- //NaN or Infinity.
+ // NaN or Infinity.
mantissa <<= 13;
exponent = 0xff;
}
@@ -20,7 +20,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
{
if (exponent == 0)
{
- //Denormal.
+ // Denormal.
int e = -1;
int m = mantissa;
diff --git a/Ryujinx.Graphics/Shader/Translation/Optimizations/Optimizer.cs b/Ryujinx.Graphics/Shader/Translation/Optimizations/Optimizer.cs
index 88118e3a..8cce0e74 100644
--- a/Ryujinx.Graphics/Shader/Translation/Optimizations/Optimizer.cs
+++ b/Ryujinx.Graphics/Shader/Translation/Optimizations/Optimizer.cs
@@ -81,8 +81,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
private static void PropagateCopy(Operation copyOp)
{
- //Propagate copy source operand to all uses of
- //the destination operand.
+ // Propagate copy source operand to all uses of
+ // the destination operand.
Operand dest = copyOp.Dest;
Operand src = copyOp.GetSource(0);
@@ -102,8 +102,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
private static bool PropagatePack(Operation packOp)
{
- //Propagate pack source operands to uses by unpack
- //instruction. The source depends on the unpack instruction.
+ // Propagate pack source operands to uses by unpack
+ // instruction. The source depends on the unpack instruction.
bool modified = false;
Operand dest = packOp.Dest;
@@ -132,8 +132,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
private static void RemoveNode(BasicBlock block, LinkedListNode<INode> llNode)
{
- //Remove a node from the nodes list, and also remove itself
- //from all the use lists on the operands that this node uses.
+ // Remove a node from the nodes list, and also remove itself
+ // from all the use lists on the operands that this node uses.
block.Operations.Remove(llNode);
Queue<INode> nodes = new Queue<INode>();
diff --git a/Ryujinx.Graphics/Shader/Translation/Optimizations/Simplification.cs b/Ryujinx.Graphics/Shader/Translation/Optimizations/Simplification.cs
index 56b1543f..d6366dfe 100644
--- a/Ryujinx.Graphics/Shader/Translation/Optimizations/Simplification.cs
+++ b/Ryujinx.Graphics/Shader/Translation/Optimizations/Simplification.cs
@@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
{
case Instruction.Add:
case Instruction.BitwiseExclusiveOr:
- TryEliminateBinaryOpComutative(operation, 0);
+ TryEliminateBinaryOpCommutative(operation, 0);
break;
case Instruction.BitwiseAnd:
@@ -34,7 +34,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
break;
case Instruction.Multiply:
- TryEliminateBinaryOpComutative(operation, 1);
+ TryEliminateBinaryOpCommutative(operation, 1);
break;
case Instruction.ShiftLeft:
@@ -48,9 +48,9 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
private static void TryEliminateBitwiseAnd(Operation operation)
{
- //Try to recognize and optimize those 3 patterns (in order):
- //x & 0xFFFFFFFF == x, 0xFFFFFFFF & y == y,
- //x & 0x00000000 == 0x00000000, 0x00000000 & y == 0x00000000
+ // Try to recognize and optimize those 3 patterns (in order):
+ // x & 0xFFFFFFFF == x, 0xFFFFFFFF & y == y,
+ // x & 0x00000000 == 0x00000000, 0x00000000 & y == 0x00000000
Operand x = operation.GetSource(0);
Operand y = operation.GetSource(1);
@@ -70,9 +70,9 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
private static void TryEliminateBitwiseOr(Operation operation)
{
- //Try to recognize and optimize those 3 patterns (in order):
- //x | 0x00000000 == x, 0x00000000 | y == y,
- //x | 0xFFFFFFFF == 0xFFFFFFFF, 0xFFFFFFFF | y == 0xFFFFFFFF
+ // Try to recognize and optimize those 3 patterns (in order):
+ // x | 0x00000000 == x, 0x00000000 | y == y,
+ // x | 0xFFFFFFFF == 0xFFFFFFFF, 0xFFFFFFFF | y == 0xFFFFFFFF
Operand x = operation.GetSource(0);
Operand y = operation.GetSource(1);
@@ -101,7 +101,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
}
}
- private static void TryEliminateBinaryOpComutative(Operation operation, int comparand)
+ private static void TryEliminateBinaryOpCommutative(Operation operation, int comparand)
{
Operand x = operation.GetSource(0);
Operand y = operation.GetSource(1);
@@ -125,8 +125,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
return;
}
- //The condition is constant, we can turn it into a copy, and select
- //the source based on the condition value.
+ // The condition is constant, we can turn it into a copy, and select
+ // the source based on the condition value.
int srcIndex = cond.Value != 0 ? 1 : 2;
Operand source = operation.GetSource(srcIndex);
diff --git a/Ryujinx.Graphics/Shader/Translation/Ssa.cs b/Ryujinx.Graphics/Shader/Translation/Ssa.cs
index b612649c..a4d763be 100644
--- a/Ryujinx.Graphics/Shader/Translation/Ssa.cs
+++ b/Ryujinx.Graphics/Shader/Translation/Ssa.cs
@@ -86,7 +86,7 @@ namespace Ryujinx.Graphics.Shader.Translation
Queue<BasicBlock> dfPhiBlocks = new Queue<BasicBlock>();
- //First pass, get all defs and locals uses.
+ // First pass, get all defs and locals uses.
for (int blkIndex = 0; blkIndex < blocks.Length; blkIndex++)
{
Operand[] localDefs = new Operand[RegisterConsts.TotalCount];
@@ -157,7 +157,7 @@ namespace Ryujinx.Graphics.Shader.Translation
}
}
- //Second pass, rename variables with definitions on different blocks.
+ // Second pass, rename variables with definitions on different blocks.
for (int blkIndex = 0; blkIndex < blocks.Length; blkIndex++)
{
Operand[] localDefs = new Operand[RegisterConsts.TotalCount];
@@ -251,10 +251,10 @@ namespace Ryujinx.Graphics.Shader.Translation
private static Operand InsertPhi(DefMap[] globalDefs, BasicBlock block, Register reg)
{
- //This block has a Phi that has not been materialized yet, but that
- //would define a new version of the variable we're looking for. We need
- //to materialize the Phi, add all the block/operand pairs into the Phi, and
- //then use the definition from that Phi.
+ // This block has a Phi that has not been materialized yet, but that
+ // would define a new version of the variable we're looking for. We need
+ // to materialize the Phi, add all the block/operand pairs into the Phi, and
+ // then use the definition from that Phi.
Operand local = Local();
PhiNode phi = new PhiNode(local);
diff --git a/Ryujinx.Graphics/Shader/Translation/Translator.cs b/Ryujinx.Graphics/Shader/Translation/Translator.cs
index 706f3cfa..fcebe913 100644
--- a/Ryujinx.Graphics/Shader/Translation/Translator.cs
+++ b/Ryujinx.Graphics/Shader/Translation/Translator.cs
@@ -28,7 +28,7 @@ namespace Ryujinx.Graphics.Shader.Translation
if (addressB != 0)
{
- //Dual vertex shader.
+ // Dual vertex shader.
Operation[] shaderOpsB = DecodeShader(memory, addressB, config.Type);
shaderOps = Combine(shaderOps, shaderOpsB);
@@ -86,10 +86,10 @@ namespace Ryujinx.Graphics.Shader.Translation
if (op is OpCodeSync opSync)
{
- //If the instruction is a SYNC instruction with only one
- //possible target address, then the instruction is basically
- //just a simple branch, we can generate code similar to branch
- //instructions, with the condition check on the branch itself.
+ // If the instruction is a SYNC instruction with only one
+ // possible target address, then the instruction is basically
+ // just a simple branch, we can generate code similar to branch
+ // instructions, with the condition check on the branch itself.
skipPredicateCheck |= opSync.Targets.Count < 2;
}
@@ -136,15 +136,15 @@ namespace Ryujinx.Graphics.Shader.Translation
private static Operation[] Combine(Operation[] a, Operation[] b)
{
- //Here we combine two shaders.
- //For shader A:
- //- All user attribute stores on shader A are turned into copies to a
- //temporary variable. It's assumed that shader B will consume them.
- //- All return instructions are turned into branch instructions, the
- //branch target being the start of the shader B code.
- //For shader B:
- //- All user attribute loads on shader B are turned into copies from a
- //temporary variable, as long that attribute is written by shader A.
+ // Here we combine two shaders.
+ // For shader A:
+ // - All user attribute stores on shader A are turned into copies to a
+ // temporary variable. It's assumed that shader B will consume them.
+ // - All return instructions are turned into branch instructions, the
+ // branch target being the start of the shader B code.
+ // For shader B:
+ // - All user attribute loads on shader B are turned into copies from a
+ // temporary variable, as long that attribute is written by shader A.
List<Operation> output = new List<Operation>(a.Length + b.Length);
Operand[] temps = new Operand[AttributeConsts.UserAttributesCount * 4];