diff options
| author | Alex Barney <thealexbarney@gmail.com> | 2019-07-01 21:39:22 -0500 |
|---|---|---|
| committer | Ac_K <Acoustik666@gmail.com> | 2019-07-02 04:39:22 +0200 |
| commit | b2b736abc2569ab5d8199da666aef8d8394844a0 (patch) | |
| tree | 88bcc2ae4fb0d4161c95df2cd7edb12388de922a /Ryujinx.Graphics | |
| parent | 10c74182babaf8cf6bedaeffd64c3109df4ea816 (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')
55 files changed, 298 insertions, 296 deletions
diff --git a/Ryujinx.Graphics/DmaPusher.cs b/Ryujinx.Graphics/DmaPusher.cs index c6825aba..74a32a4a 100644 --- a/Ryujinx.Graphics/DmaPusher.cs +++ b/Ryujinx.Graphics/DmaPusher.cs @@ -104,12 +104,12 @@ namespace Ryujinx.Graphics } else { - int sumissionMode = (word >> 29) & 7; + int submissionMode = (word >> 29) & 7; - switch (sumissionMode) + switch (submissionMode) { case 1: - //Incrementing. + // Incrementing. SetNonImmediateState(word); _state.NonIncrementing = false; @@ -118,7 +118,7 @@ namespace Ryujinx.Graphics break; case 3: - //Non-incrementing. + // Non-incrementing. SetNonImmediateState(word); _state.NonIncrementing = true; @@ -127,7 +127,7 @@ namespace Ryujinx.Graphics break; case 4: - //Immediate. + // Immediate. _state.Method = (word >> 0) & 0x1fff; _state.SubChannel = (word >> 13) & 7; _state.NonIncrementing = true; @@ -138,7 +138,7 @@ namespace Ryujinx.Graphics break; case 5: - //Increment-once. + // Increment-once. SetNonImmediateState(word); _state.NonIncrementing = false; diff --git a/Ryujinx.Graphics/Gal/GalImageFormat.cs b/Ryujinx.Graphics/Gal/GalImageFormat.cs index 8dcde182..19ce6cfc 100644 --- a/Ryujinx.Graphics/Gal/GalImageFormat.cs +++ b/Ryujinx.Graphics/Gal/GalImageFormat.cs @@ -1,4 +1,5 @@ -using System; +// ReSharper disable InconsistentNaming +using System; namespace Ryujinx.Graphics.Gal { diff --git a/Ryujinx.Graphics/Gal/GalVertexBinding.cs b/Ryujinx.Graphics/Gal/GalVertexBinding.cs index 0c3c845d..2337c2e3 100644 --- a/Ryujinx.Graphics/Gal/GalVertexBinding.cs +++ b/Ryujinx.Graphics/Gal/GalVertexBinding.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Gal { public struct GalVertexBinding { - //VboKey shouldn't be here, but ARB_vertex_attrib_binding is core since 4.3 + // VboKey shouldn't be here, but ARB_vertex_attrib_binding is core since 4.3 public bool Enabled; public int Stride; diff --git a/Ryujinx.Graphics/Gal/OpenGL/OglEnumConverter.cs b/Ryujinx.Graphics/Gal/OpenGL/OglEnumConverter.cs index a3f9957f..c36d8bf9 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OglEnumConverter.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OglEnumConverter.cs @@ -275,7 +275,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL } else { - //Fallback to non-mirrored clamps + // Fallback to non-mirrored clamps switch (wrap) { case GalTextureWrap.MirrorClampToEdge: return TextureWrapMode.ClampToEdge; @@ -291,7 +291,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL GalTextureFilter minFilter, GalTextureMipFilter mipFilter) { - //TODO: Mip (needs mipmap support first). + // TODO: Mip (needs mipmap support first). switch (minFilter) { case GalTextureFilter.Nearest: return TextureMinFilter.Nearest; diff --git a/Ryujinx.Graphics/Gal/OpenGL/OglPipeline.cs b/Ryujinx.Graphics/Gal/OpenGL/OglPipeline.cs index 64768e28..8d886be4 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OglPipeline.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OglPipeline.cs @@ -96,7 +96,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL _rasterizer = rasterizer; _shader = shader; - //These values match OpenGL's defaults + // These values match OpenGL's defaults _old = new GalPipelineState { FrontFace = GalFrontFace.Ccw, @@ -564,14 +564,14 @@ namespace Ryujinx.Graphics.Gal.OpenGL { _vaoHandle = GL.GenVertexArray(); - //Vertex arrays shouldn't be used anywhere else in OpenGL's backend - //if you want to use it, move this line out of the if + // Vertex arrays shouldn't be used anywhere else in OpenGL's backend + // if you want to use it, move this line out of the if GL.BindVertexArray(_vaoHandle); } foreach (GalVertexAttrib attrib in binding.Attribs) { - //Skip uninitialized attributes. + // Skip uninitialized attributes. if (attrib.Size == 0) { continue; diff --git a/Ryujinx.Graphics/Gal/OpenGL/OglRenderTarget.cs b/Ryujinx.Graphics/Gal/OpenGL/OglRenderTarget.cs index d36bac1b..11fc98cb 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OglRenderTarget.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OglRenderTarget.cs @@ -77,11 +77,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL private int _cropRight; private int _cropBottom; - //This framebuffer is used to attach guest rendertargets, - //think of it as a dummy OpenGL VAO + // This framebuffer is used to attach guest rendertargets, + // think of it as a dummy OpenGL VAO private int _dummyFrameBuffer; - //These framebuffers are used to blit images + // These framebuffers are used to blit images private int _srcFb; private int _dstFb; @@ -109,8 +109,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL private void TextureDeletionHandler(object sender, int handle) { - //Texture was deleted, the handle is no longer valid, so - //reset all uses of this handle on a render target. + // Texture was deleted, the handle is no longer valid, so + // reset all uses of this handle on a render target. for (int attachment = 0; attachment < RenderTargetsCount; attachment++) { if (_colorHandles[attachment] == handle) @@ -484,7 +484,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL GL.BindBuffer(BufferTarget.PixelPackBuffer, _copyPbo); - //The buffer should be large enough to hold the largest texture. + // The buffer should be large enough to hold the largest texture. int bufferSize = Math.Max(ImageUtils.GetSize(oldImage), ImageUtils.GetSize(newImage)); diff --git a/Ryujinx.Graphics/Gal/OpenGL/OglShader.cs b/Ryujinx.Graphics/Gal/OpenGL/OglShader.cs index 8f4072c5..8da0104e 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OglShader.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OglShader.cs @@ -115,7 +115,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL data[1] = flipY; data[2] = BitConverter.Int32BitsToSingle(instance); - //Invalidate buffer + // Invalidate buffer GL.BufferData(BufferTarget.UniformBuffer, ExtraDataSize * sizeof(float), IntPtr.Zero, BufferUsageHint.StreamDraw); GL.BufferSubData(BufferTarget.UniformBuffer, IntPtr.Zero, ExtraDataSize * sizeof(float), (IntPtr)data); @@ -228,9 +228,9 @@ namespace Ryujinx.Graphics.Gal.OpenGL if (blockIndex < 0) { - //This may be fine, the compiler may optimize away unused uniform buffers, - //and in this case the above call would return -1 as the buffer has been - //optimized away. + // This may be fine, the compiler may optimize away unused uniform buffers, + // and in this case the above call would return -1 as the buffer has been + // optimized away. continue; } diff --git a/Ryujinx.Graphics/Gal/OpenGL/OglTexture.cs b/Ryujinx.Graphics/Gal/OpenGL/OglTexture.cs index b6bf36c5..b5ac6692 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OglTexture.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OglTexture.cs @@ -207,7 +207,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL } else { - //TODO: Use KHR_texture_compression_astc_hdr when available + // TODO: Use KHR_texture_compression_astc_hdr when available if (IsAstc(image.Format)) { int textureBlockWidth = ImageUtils.GetBlockWidth(image.Format); diff --git a/Ryujinx.Graphics/Gal/ShaderDumper.cs b/Ryujinx.Graphics/Gal/ShaderDumper.cs index 726447e4..e25127de 100644 --- a/Ryujinx.Graphics/Gal/ShaderDumper.cs +++ b/Ryujinx.Graphics/Gal/ShaderDumper.cs @@ -38,7 +38,7 @@ namespace Ryujinx.Graphics.Gal ulong instruction = 0; - //Dump until a NOP instruction is found + // Dump until a NOP instruction is found while ((instruction >> 48 & 0xfff8) != 0x50b0) { uint word0 = (uint)memory.ReadInt32(position + 0x50 + offset + 0); @@ -46,8 +46,8 @@ namespace Ryujinx.Graphics.Gal instruction = word0 | (ulong)word1 << 32; - //Zero instructions (other kind of NOP) stop immediatly, - //this is to avoid two rows of zeroes + // Zero instructions (other kind of NOP) stop immediately, + // this is to avoid two rows of zeroes if (instruction == 0) { break; @@ -59,7 +59,7 @@ namespace Ryujinx.Graphics.Gal offset += 8; } - //Align to meet nvdisasm requeriments + // Align to meet nvdisasm requirements while (offset % 0x20 != 0) { fullWriter.Write(0); diff --git a/Ryujinx.Graphics/GpuResourceManager.cs b/Ryujinx.Graphics/GpuResourceManager.cs index 740e6be8..16e9f579 100644 --- a/Ryujinx.Graphics/GpuResourceManager.cs +++ b/Ryujinx.Graphics/GpuResourceManager.cs @@ -109,7 +109,7 @@ namespace Ryujinx.Graphics { if (oldType == ImageType.ColorBuffer || oldType == ImageType.ZetaBuffer) { - //Avoid data destruction + // Avoid data destruction MemoryRegionModified(vmm, position, size, NvGpuBufferType.Texture); skipCheck = true; diff --git a/Ryujinx.Graphics/Graphics3d/MacroInterpreter.cs b/Ryujinx.Graphics/Graphics3d/MacroInterpreter.cs index 84576213..9a6206fa 100644 --- a/Ryujinx.Graphics/Graphics3d/MacroInterpreter.cs +++ b/Ryujinx.Graphics/Graphics3d/MacroInterpreter.cs @@ -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; } diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngine2d.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngine2d.cs index d42dca28..b6dae2a3 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngine2d.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngine2d.cs @@ -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( diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs index 29b6cc5d..e475a964 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs @@ -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; diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs index 172c919b..fca8ae22 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs @@ -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; diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngineP2mf.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngineP2mf.cs index 83ad0e70..2b2c7b5f 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngineP2mf.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngineP2mf.cs @@ -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); diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuFifo.cs b/Ryujinx.Graphics/Graphics3d/NvGpuFifo.cs index ae96a4f5..23bfd0b3 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuFifo.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuFifo.cs @@ -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; diff --git a/Ryujinx.Graphics/Graphics3d/Texture/AstcDecoder.cs b/Ryujinx.Graphics/Graphics3d/Texture/AstcDecoder.cs index 99b166f3..3e68be7d 100644 --- a/Ryujinx.Graphics/Graphics3d/Texture/AstcDecoder.cs +++ b/Ryujinx.Graphics/Graphics3d/Texture/AstcDecoder.cs @@ -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; } diff --git a/Ryujinx.Graphics/Graphics3d/Texture/AstcPixel.cs b/Ryujinx.Graphics/Graphics3d/Texture/AstcPixel.cs index cd30acca..2f73c62b 100644 --- a/Ryujinx.Graphics/Graphics3d/Texture/AstcPixel.cs +++ b/Ryujinx.Graphics/Graphics3d/Texture/AstcPixel.cs @@ -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]); diff --git a/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs b/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs index bd9b4327..2e78cf14 100644 --- a/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs +++ b/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs @@ -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; diff --git a/Ryujinx.Graphics/Memory/NvGpuVmm.cs b/Ryujinx.Graphics/Memory/NvGpuVmm.cs index ac1b765a..fea99587 100644 --- a/Ryujinx.Graphics/Memory/NvGpuVmm.cs +++ b/Ryujinx.Graphics/Memory/NvGpuVmm.cs @@ -146,8 +146,8 @@ namespace Ryujinx.Graphics.Memory private long GetFreePosition(long size, long align = 1, long start = 1L << 32) { - //Note: Address 0 is not considered valid by the driver, - //when 0 is returned it's considered a mapping error. + // Note: Address 0 is not considered valid by the driver, + // when 0 is returned it's considered a mapping error. long position = start; long freeSize = 0; diff --git a/Ryujinx.Graphics/QuadHelper.cs b/Ryujinx.Graphics/QuadHelper.cs index 49c679e3..643084ba 100644 --- a/Ryujinx.Graphics/QuadHelper.cs +++ b/Ryujinx.Graphics/QuadHelper.cs @@ -33,13 +33,13 @@ namespace Ryujinx.Graphics Buffer.BlockCopy(data, src, output, dst, copyCount * entrySize); } - //0 1 2 -> 0 1 2. + // 0 1 2 -> 0 1 2. AssignIndex(0, 0, 3); - //2 3 -> 3 4. + // 2 3 -> 3 4. AssignIndex(2, 3, 2); - //0 -> 5. + // 0 -> 5. AssignIndex(0, 5); } @@ -65,13 +65,13 @@ namespace Ryujinx.Graphics Buffer.BlockCopy(data, src, output, dst, copyCount * entrySize); } - //-2 -1 0 -> 0 1 2. + // -2 -1 0 -> 0 1 2. AssignIndex(-2, 0, 3); - //0 1 -> 3 4. + // 0 1 -> 3 4. AssignIndex(0, 3, 2); - //-2 -> 5. + // -2 -> 5. AssignIndex(-2, 5); } 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]; diff --git a/Ryujinx.Graphics/VDec/H264Decoder.cs b/Ryujinx.Graphics/VDec/H264Decoder.cs index 01085a73..24c7e0b9 100644 --- a/Ryujinx.Graphics/VDec/H264Decoder.cs +++ b/Ryujinx.Graphics/VDec/H264Decoder.cs @@ -89,7 +89,7 @@ namespace Ryujinx.Graphics.VDec { H264BitStreamWriter writer = new H264BitStreamWriter(data); - //Sequence Parameter Set. + // Sequence Parameter Set. writer.WriteU(1, 24); writer.WriteU(0, 1); writer.WriteU(3, 2); @@ -145,7 +145,7 @@ namespace Ryujinx.Graphics.VDec writer.End(); - //Picture Parameter Set. + // Picture Parameter Set. writer.WriteU(1, 24); writer.WriteU(0, 1); writer.WriteU(3, 2); @@ -196,7 +196,7 @@ namespace Ryujinx.Graphics.VDec } } - //ZigZag LUTs from libavcodec. + // ZigZag LUTs from libavcodec. private static readonly byte[] ZigZagDirect = new byte[] { 0, 1, 8, 16, 9, 2, 3, 10, diff --git a/Ryujinx.Graphics/VDec/VideoDecoder.cs b/Ryujinx.Graphics/VDec/VideoDecoder.cs index 2be47a30..3ebb93f4 100644 --- a/Ryujinx.Graphics/VDec/VideoDecoder.cs +++ b/Ryujinx.Graphics/VDec/VideoDecoder.cs @@ -254,7 +254,7 @@ namespace Ryujinx.Graphics.VDec } } - //Copy chroma data from both channels with interleaving. + // Copy chroma data from both channels with interleaving. for (int y = 0; y < halfHeight; y++) { int src = y * halfSrcWidth; diff --git a/Ryujinx.Graphics/VDec/Vp9Decoder.cs b/Ryujinx.Graphics/VDec/Vp9Decoder.cs index d77bc6c4..b20a40be 100644 --- a/Ryujinx.Graphics/VDec/Vp9Decoder.cs +++ b/Ryujinx.Graphics/VDec/Vp9Decoder.cs @@ -287,7 +287,7 @@ namespace Ryujinx.Graphics.VDec bool showFrame = !isFrameIntra; - //Write compressed header. + // Write compressed header. byte[] compressedHeaderData; using (MemoryStream compressedHeader = new MemoryStream()) @@ -437,7 +437,7 @@ namespace Ryujinx.Graphics.VDec compressedHeaderData = compressedHeader.ToArray(); } - //Write uncompressed header. + // Write uncompressed header. using (MemoryStream encodedHeader = new MemoryStream()) { VpxBitStreamWriter writer = new VpxBitStreamWriter(encodedHeader); @@ -460,8 +460,8 @@ namespace Ryujinx.Graphics.VDec _cachedRefFrames.Clear(); - //On key frames, all frame slots are set to the current frame, - //so the value of the selected slot doesn't really matter. + // On key frames, all frame slots are set to the current frame, + // so the value of the selected slot doesn't really matter. GetNewFrameSlot(keys.CurrKey); } else @@ -593,8 +593,8 @@ namespace Ryujinx.Graphics.VDec int tileColsLog2IncMask = (1 << tileColsLog2Diff) - 1; - //If it's less than the maximum, we need to add an extra 0 on the bitstream - //to indicate that it should stop reading. + // If it's less than the maximum, we need to add an extra 0 on the bitstream + // to indicate that it should stop reading. if (header.TileColsLog2 < maxTileColsLog2) { writer.WriteU(tileColsLog2IncMask << 1, tileColsLog2Diff + 1); @@ -653,8 +653,8 @@ namespace Ryujinx.Graphics.VDec return node.Value; } - //Reference frame was lost. - //What we should do in this case? + // Reference frame was lost. + // What we should do in this case? return 0; } @@ -668,8 +668,8 @@ namespace Ryujinx.Graphics.VDec private void WriteCoefProbabilityUpdate(VpxRangeEncoder writer, int txMode, byte[] New, byte[] old) { - //Note: There's 1 byte added on each packet for alignment, - //this byte is ignored when doing updates. + // Note: There's 1 byte added on each packet for alignment, + // this byte is ignored when doing updates. const int blockBytes = 2 * 2 * 6 * 6 * 4; bool NeedsUpdate(int baseIndex) |
