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
|
@ -82,8 +82,8 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
|
||||
while (Step(vmm, mme));
|
||||
|
||||
//Due to the delay slot, we still need to execute
|
||||
//one more instruction before we actually exit.
|
||||
// Due to the delay slot, we still need to execute
|
||||
// one more instruction before we actually exit.
|
||||
Step(vmm, mme);
|
||||
}
|
||||
|
||||
|
@ -108,14 +108,14 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
|
||||
if ((_opCode & 7) < 7)
|
||||
{
|
||||
//Operation produces a value.
|
||||
// Operation produces a value.
|
||||
AssignmentOperation asgOp = (AssignmentOperation)((_opCode >> 4) & 7);
|
||||
|
||||
int result = GetAluResult();
|
||||
|
||||
switch (asgOp)
|
||||
{
|
||||
//Fetch parameter and ignore result.
|
||||
// Fetch parameter and ignore result.
|
||||
case AssignmentOperation.IgnoreAndFetch:
|
||||
{
|
||||
SetDstGpr(FetchParam());
|
||||
|
@ -123,7 +123,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
break;
|
||||
}
|
||||
|
||||
//Move result.
|
||||
// Move result.
|
||||
case AssignmentOperation.Move:
|
||||
{
|
||||
SetDstGpr(result);
|
||||
|
@ -131,7 +131,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
break;
|
||||
}
|
||||
|
||||
//Move result and use as Method Address.
|
||||
// Move result and use as Method Address.
|
||||
case AssignmentOperation.MoveAndSetMaddr:
|
||||
{
|
||||
SetDstGpr(result);
|
||||
|
@ -141,7 +141,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
break;
|
||||
}
|
||||
|
||||
//Fetch parameter and send result.
|
||||
// Fetch parameter and send result.
|
||||
case AssignmentOperation.FetchAndSend:
|
||||
{
|
||||
SetDstGpr(FetchParam());
|
||||
|
@ -151,7 +151,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
break;
|
||||
}
|
||||
|
||||
//Move and send result.
|
||||
// Move and send result.
|
||||
case AssignmentOperation.MoveAndSend:
|
||||
{
|
||||
SetDstGpr(result);
|
||||
|
@ -161,7 +161,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
break;
|
||||
}
|
||||
|
||||
//Fetch parameter and use result as Method Address.
|
||||
// Fetch parameter and use result as Method Address.
|
||||
case AssignmentOperation.FetchAndSetMaddr:
|
||||
{
|
||||
SetDstGpr(FetchParam());
|
||||
|
@ -171,7 +171,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
break;
|
||||
}
|
||||
|
||||
//Move result and use as Method Address, then fetch and send paramter.
|
||||
// Move result and use as Method Address, then fetch and send parameter.
|
||||
case AssignmentOperation.MoveAndSetMaddrThenFetchAndSend:
|
||||
{
|
||||
SetDstGpr(result);
|
||||
|
@ -183,7 +183,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
break;
|
||||
}
|
||||
|
||||
//Move result and use as Method Address, then send bits 17:12 of result.
|
||||
// Move result and use as Method Address, then send bits 17:12 of result.
|
||||
case AssignmentOperation.MoveAndSetMaddrThenSendHigh:
|
||||
{
|
||||
SetDstGpr(result);
|
||||
|
@ -198,7 +198,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
}
|
||||
else
|
||||
{
|
||||
//Branch.
|
||||
// Branch.
|
||||
bool onNotZero = ((_opCode >> 4) & 1) != 0;
|
||||
|
||||
bool taken = onNotZero
|
||||
|
@ -355,7 +355,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
|
||||
private int GetImm()
|
||||
{
|
||||
//Note: The immediate is signed, the sign-extension is intended here.
|
||||
// Note: The immediate is signed, the sign-extension is intended here.
|
||||
return _opCode >> 14;
|
||||
}
|
||||
|
||||
|
|
|
@ -204,10 +204,10 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
dstBlitX + dstBlitW,
|
||||
dstBlitY + dstBlitH);
|
||||
|
||||
//Do a guest side copy aswell. This is necessary when
|
||||
//the texture is modified by the guest, however it doesn't
|
||||
//work when resources that the gpu can write to are copied,
|
||||
//like framebuffers.
|
||||
// Do a guest side copy as well. This is necessary when
|
||||
// the texture is modified by the guest, however it doesn't
|
||||
// work when resources that the gpu can write to are copied,
|
||||
// like framebuffers.
|
||||
|
||||
// FIXME: SUPPORT MULTILAYER CORRECTLY HERE (this will cause weird stuffs on the first layer)
|
||||
ImageUtils.CopyTexture(
|
||||
|
|
|
@ -67,8 +67,8 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
_constBuffers[index] = new ConstBuffer[18];
|
||||
}
|
||||
|
||||
//Ensure that all components are enabled by default.
|
||||
//FIXME: Is this correct?
|
||||
// Ensure that all components are enabled by default.
|
||||
// FIXME: Is this correct?
|
||||
WriteRegister(NvGpuEngine3dReg.ColorMaskN, 0x1111);
|
||||
|
||||
WriteRegister(NvGpuEngine3dReg.FrameBufferSrgb, 1);
|
||||
|
@ -333,12 +333,12 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
|
||||
if (vpAEnable)
|
||||
{
|
||||
//Note: The maxwell supports 2 vertex programs, usually
|
||||
//only VP B is used, but in some cases VP A is also used.
|
||||
//In this case, it seems to function as an extra vertex
|
||||
//shader stage.
|
||||
//The graphics abstraction layer has a special overload for this
|
||||
//case, which should merge the two shaders into one vertex shader.
|
||||
// Note: The maxwell supports 2 vertex programs, usually
|
||||
// only VP B is used, but in some cases VP A is also used.
|
||||
// In this case, it seems to function as an extra vertex
|
||||
// shader stage.
|
||||
// The graphics abstraction layer has a special overload for this
|
||||
// case, which should merge the two shaders into one vertex shader.
|
||||
int vpAOffset = ReadRegister(NvGpuEngine3dReg.ShaderNOffset);
|
||||
int vpBOffset = ReadRegister(NvGpuEngine3dReg.ShaderNOffset + 0x10);
|
||||
|
||||
|
@ -360,7 +360,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
int control = ReadRegister(NvGpuEngine3dReg.ShaderNControl + index * 0x10);
|
||||
int offset = ReadRegister(NvGpuEngine3dReg.ShaderNOffset + index * 0x10);
|
||||
|
||||
//Note: Vertex Program (B) is always enabled.
|
||||
// Note: Vertex Program (B) is always enabled.
|
||||
bool enable = (control & 1) != 0 || index == 1;
|
||||
|
||||
if (!enable)
|
||||
|
@ -405,7 +405,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
|
||||
GalFrontFace frontFace = (GalFrontFace)ReadRegister(NvGpuEngine3dReg.FrontFace);
|
||||
|
||||
//Flipping breaks facing. Flipping front facing too fixes it
|
||||
// Flipping breaks facing. Flipping front facing too fixes it
|
||||
if (signX != signY)
|
||||
{
|
||||
switch (frontFace)
|
||||
|
@ -574,8 +574,8 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
}
|
||||
else
|
||||
{
|
||||
//It seems that even when independent blend is disabled, the first IBlend enable
|
||||
//register is still set to indicate whenever blend is enabled or not (?).
|
||||
// It seems that even when independent blend is disabled, the first IBlend enable
|
||||
// register is still set to indicate whenever blend is enabled or not (?).
|
||||
state.Blends[index].Enabled = ReadRegisterBool(NvGpuEngine3dReg.IBlendNEnable);
|
||||
|
||||
if (state.Blends[index].Enabled)
|
||||
|
@ -632,8 +632,8 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
|
||||
private void SetRenderTargets()
|
||||
{
|
||||
//Commercial games do not seem to
|
||||
//bool SeparateFragData = ReadRegisterBool(NvGpuEngine3dReg.RTSeparateFragData);
|
||||
// Commercial games do not seem to
|
||||
// bool SeparateFragData = ReadRegisterBool(NvGpuEngine3dReg.RTSeparateFragData);
|
||||
|
||||
uint control = (uint)(ReadRegister(NvGpuEngine3dReg.RtControl));
|
||||
|
||||
|
@ -711,8 +711,8 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
{
|
||||
if (textureHandle == 0)
|
||||
{
|
||||
//FIXME: Some games like puyo puyo will use handles with the value 0.
|
||||
//This is a bug, most likely caused by sync issues.
|
||||
// FIXME: Some games like puyo puyo will use handles with the value 0.
|
||||
// This is a bug, most likely caused by sync issues.
|
||||
return (0, default(GalImage), default(GalTextureSampler));
|
||||
}
|
||||
|
||||
|
@ -751,7 +751,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
{
|
||||
Profile.End(Profiles.GPU.Engine3d.UploadTexture);
|
||||
|
||||
//FIXME: Shouldn't ignore invalid addresses.
|
||||
// FIXME: Shouldn't ignore invalid addresses.
|
||||
return (0, default(GalImage), default(GalTextureSampler));
|
||||
}
|
||||
|
||||
|
@ -910,8 +910,8 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
// Check vertex array is enabled to avoid out of bounds exception when reading bytes
|
||||
bool enable = (ReadRegister(NvGpuEngine3dReg.VertexArrayNControl + arrayIndex * 4) & 0x1000) != 0;
|
||||
|
||||
//Note: 16 is the maximum size of an attribute,
|
||||
//having a component size of 32-bits with 4 elements (a vec4).
|
||||
// Note: 16 is the maximum size of an attribute,
|
||||
// having a component size of 32-bits with 4 elements (a vec4).
|
||||
if (enable)
|
||||
{
|
||||
byte[] data = vmm.ReadBytes(vbPosition + offset, 16);
|
||||
|
@ -954,7 +954,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
|
||||
if (vbPosition > vbEndPos)
|
||||
{
|
||||
//Instance is invalid, ignore the draw call
|
||||
// Instance is invalid, ignore the draw call
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1057,14 +1057,14 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
|
||||
long iboKey = vmm.GetPhysicalAddress(indexPosition);
|
||||
|
||||
//Quad primitive types were deprecated on OpenGL 3.x,
|
||||
//they are converted to a triangles index buffer on IB creation,
|
||||
//so we should use the triangles type here too.
|
||||
// Quad primitive types were deprecated on OpenGL 3.x,
|
||||
// they are converted to a triangles index buffer on IB creation,
|
||||
// so we should use the triangles type here too.
|
||||
if (primType == GalPrimitiveType.Quads || primType == GalPrimitiveType.QuadStrip)
|
||||
{
|
||||
//Note: We assume that index first points to the first
|
||||
//vertex of a quad, if it points to the middle of a
|
||||
//quad (First % 4 != 0 for Quads) then it will not work properly.
|
||||
// Note: We assume that index first points to the first
|
||||
// vertex of a quad, if it points to the middle of a
|
||||
// quad (First % 4 != 0 for Quads) then it will not work properly.
|
||||
if (primType == GalPrimitiveType.Quads)
|
||||
{
|
||||
indexFirst = QuadHelper.ConvertSizeQuadsToTris(indexFirst);
|
||||
|
@ -1084,14 +1084,14 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
int vertexFirst = ReadRegister(NvGpuEngine3dReg.VertexArrayFirst);
|
||||
int vertexCount = ReadRegister(NvGpuEngine3dReg.VertexArrayCount);
|
||||
|
||||
//Quad primitive types were deprecated on OpenGL 3.x,
|
||||
//they are converted to a triangles index buffer on IB creation,
|
||||
//so we should use the triangles type here too.
|
||||
// Quad primitive types were deprecated on OpenGL 3.x,
|
||||
// they are converted to a triangles index buffer on IB creation,
|
||||
// so we should use the triangles type here too.
|
||||
if (primType == GalPrimitiveType.Quads || primType == GalPrimitiveType.QuadStrip)
|
||||
{
|
||||
//Note: We assume that index first points to the first
|
||||
//vertex of a quad, if it points to the middle of a
|
||||
//quad (First % 4 != 0 for Quads) then it will not work properly.
|
||||
// Note: We assume that index first points to the first
|
||||
// vertex of a quad, if it points to the middle of a
|
||||
// quad (First % 4 != 0 for Quads) then it will not work properly.
|
||||
if (primType == GalPrimitiveType.Quads)
|
||||
{
|
||||
vertexFirst = QuadHelper.ConvertSizeQuadsToTris(vertexFirst);
|
||||
|
@ -1111,7 +1111,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
// Reset pipeline for host OpenGL calls
|
||||
_gpu.Renderer.Pipeline.Unbind(state);
|
||||
|
||||
//Is the GPU really clearing those registers after draw?
|
||||
// Is the GPU really clearing those registers after draw?
|
||||
WriteRegister(NvGpuEngine3dReg.IndexBatchFirst, 0);
|
||||
WriteRegister(NvGpuEngine3dReg.IndexBatchCount, 0);
|
||||
}
|
||||
|
@ -1140,7 +1140,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
|
||||
case QueryMode.WriteCounterAndTimestamp:
|
||||
{
|
||||
//TODO: Implement counters.
|
||||
// TODO: Implement counters.
|
||||
long counter = 1;
|
||||
|
||||
long timestamp = PerformanceCounter.ElapsedMilliseconds;
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
{
|
||||
Profile.Begin(Profiles.GPU.EngineM2mf.Execute);
|
||||
|
||||
//TODO: Some registers and copy modes are still not implemented.
|
||||
// TODO: Some registers and copy modes are still not implemented.
|
||||
int control = methCall.Argument;
|
||||
|
||||
bool srcLinear = ((control >> 7) & 1) != 0;
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
{
|
||||
Profile.Begin(Profiles.GPU.EngineP2mf.Execute);
|
||||
|
||||
//TODO: Some registers and copy modes are still not implemented.
|
||||
// TODO: Some registers and copy modes are still not implemented.
|
||||
int control = methCall.Argument;
|
||||
|
||||
long dstAddress = MakeInt64From2xInt32(NvGpuEngineP2mfReg.DstAddress);
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace Ryujinx.Graphics.Graphics3d
|
|||
private const int MacrosCount = 0x80;
|
||||
private const int MacroIndexMask = MacrosCount - 1;
|
||||
|
||||
//Note: The size of the macro memory is unknown, we just make
|
||||
//a guess here and use 256kb as the size. Increase if needed.
|
||||
// Note: The size of the macro memory is unknown, we just make
|
||||
// a guess here and use 256kb as the size. Increase if needed.
|
||||
private const int MmeWords = 256 * 256;
|
||||
|
||||
private NvGpu _gpu;
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
public AstcDecoderException(string exMsg) : base(exMsg) { }
|
||||
}
|
||||
|
||||
//https://github.com/GammaUNC/FasTC/blob/master/ASTCEncoder/src/Decompressor.cpp
|
||||
// https://github.com/GammaUNC/FasTC/blob/master/ASTCEncoder/src/Decompressor.cpp
|
||||
public static class AstcDecoder
|
||||
{
|
||||
struct TexelWeightParams
|
||||
|
@ -1356,7 +1356,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
}
|
||||
|
||||
default:
|
||||
//Don't know this layout...
|
||||
// Don't know this layout...
|
||||
texelParams.Error = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
|
||||
public void ChangeBitDepth(byte[] depth)
|
||||
{
|
||||
for(int i = 0; i< 4; i++)
|
||||
for (int i = 0; i< 4; i++)
|
||||
{
|
||||
int value = ChangeBitDepth(GetComponent(i), _bitDepth[i], depth[i]);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
{ GalTextureFormat.D32Fx24S8, GalImageFormat.D32S8 | Float },
|
||||
{ GalTextureFormat.D16, GalImageFormat.D16 | Unorm },
|
||||
|
||||
//Compressed formats
|
||||
// Compressed formats
|
||||
{ GalTextureFormat.BptcSfloat, GalImageFormat.BptcSfloat | Float },
|
||||
{ GalTextureFormat.BptcUfloat, GalImageFormat.BptcUfloat | Float },
|
||||
{ GalTextureFormat.BptcUnorm, GalImageFormat.BptcUnorm | Unorm | Srgb },
|
||||
|
@ -248,7 +248,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
|
||||
int bytesPerPixel = desc.BytesPerPixel;
|
||||
|
||||
//Note: Each row of the texture needs to be aligned to 4 bytes.
|
||||
// Note: Each row of the texture needs to be aligned to 4 bytes.
|
||||
int pitch = (width * bytesPerPixel + 3) & ~3;
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue