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
This commit is contained in:
parent
10c74182ba
commit
b2b736abc2
205 changed files with 1020 additions and 1041 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
}
|
||||
else if (floatType == FPType.FP64)
|
||||
{
|
||||
//TODO.
|
||||
// TODO.
|
||||
}
|
||||
|
||||
throw new ArgumentException($"Invalid floating point type \"{floatType}\".");
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue