From 900a84ae0a90ae13c8c3f5158eff85c68a953362 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Wed, 27 Jun 2018 01:32:28 -0300 Subject: Fix vertex buffer size on the gpu when the draw vertex count is less than the buffer size, added a few more registers (currently not implemented) --- Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs | 26 ++++++++++++++------------ Ryujinx.HLE/Gpu/Engines/NvGpuEngine3dReg.cs | 5 +++++ 2 files changed, 19 insertions(+), 12 deletions(-) (limited to 'Ryujinx.HLE') diff --git a/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs b/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs index 02461d5d..1663d4c5 100644 --- a/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs +++ b/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs @@ -79,6 +79,8 @@ namespace Ryujinx.HLE.Gpu.Engines Gpu.Renderer.Shader.BindProgram(); + SetCullFace(); + SetDepth(); SetAlphaBlending(); UploadTextures(Vmm, Keys); @@ -98,8 +100,7 @@ namespace Ryujinx.HLE.Gpu.Engines SetFrameBuffer(Vmm, 0); - //TODO: Enable this once the frame buffer problems are fixed. - //Gpu.Renderer.ClearBuffers(Layer, Flags); + Gpu.Renderer.Rasterizer.ClearBuffers(Layer, Flags); } private void SetFrameBuffer(NvGpuVmm Vmm, int FbIndex) @@ -177,6 +178,16 @@ namespace Ryujinx.HLE.Gpu.Engines throw new ArgumentOutOfRangeException(nameof(Program)); } + private void SetCullFace() + { + //TODO. + } + + private void SetDepth() + { + //TODO. + } + private void SetAlphaBlending() { //TODO: Support independent blend properly. @@ -434,16 +445,7 @@ namespace Ryujinx.HLE.Gpu.Engines int Stride = Control & 0xfff; - long VbSize = 0; - - if (IndexCount != 0) - { - VbSize = (VertexEndPos - VertexPosition) + 1; - } - else - { - VbSize = VertexCount * Stride; - } + long VbSize = (VertexEndPos - VertexPosition) + 1; bool VboCached = Gpu.Renderer.Rasterizer.IsVboCached(VertexPosition, VbSize); diff --git a/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3dReg.cs b/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3dReg.cs index de2b2eef..64866ce9 100644 --- a/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3dReg.cs +++ b/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3dReg.cs @@ -15,7 +15,9 @@ namespace Ryujinx.HLE.Gpu.Engines VertexArrayFirst = 0x35d, VertexArrayCount = 0x35e, VertexAttribNFormat = 0x458, + DepthTestEnable = 0x4b3, IBlendEnable = 0x4b9, + DepthTestFunction = 0x4c3, BlendSeparateAlpha = 0x4cf, BlendEquationRgb = 0x4d0, BlendFuncSrcRgb = 0x4d1, @@ -35,6 +37,9 @@ namespace Ryujinx.HLE.Gpu.Engines IndexArrayFormat = 0x5f6, IndexBatchFirst = 0x5f7, IndexBatchCount = 0x5f8, + CullFaceEnable = 0x646, + FrontFace = 0x647, + CullFace = 0x648, QueryAddress = 0x6c0, QuerySequence = 0x6c2, QueryControl = 0x6c3, -- cgit v1.2.3