diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-07-09 23:01:59 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-09 23:01:59 -0300 |
| commit | 1968386808bb48f823b1877b0e5ff8c6e2f8bd49 (patch) | |
| tree | 40b4dd9e9dc1f756af99fcd571a7ef5272f4cc8f /Ryujinx.HLE | |
| parent | 791fe70810f0f0f417c74aaff5446551bed78fee (diff) | |
Add locking methods to the ogl resource cache (#238)
* Add locking methods to the ogl resource cache
* Remove some unused arguments
* Add the ZF32 texture format
Diffstat (limited to 'Ryujinx.HLE')
| -rw-r--r-- | Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs | 20 | ||||
| -rw-r--r-- | Ryujinx.HLE/Gpu/Texture/TextureHelper.cs | 28 | ||||
| -rw-r--r-- | Ryujinx.HLE/Gpu/Texture/TextureReader.cs | 1 |
3 files changed, 38 insertions, 11 deletions
diff --git a/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs b/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs index b9f9cc49..2bacd71b 100644 --- a/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs +++ b/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs @@ -73,6 +73,8 @@ namespace Ryujinx.HLE.Gpu.Engines private void VertexEndGl(NvGpuVmm Vmm, NvGpuPBEntry PBEntry) { + LockCaches(); + SetFrameBuffer(Vmm, 0); long[] Keys = UploadShaders(Vmm); @@ -90,6 +92,20 @@ namespace Ryujinx.HLE.Gpu.Engines UploadTextures(Vmm, Keys); UploadUniforms(Vmm); UploadVertexArrays(Vmm); + + UnlockCaches(); + } + + private void LockCaches() + { + Gpu.Renderer.Rasterizer.LockCaches(); + Gpu.Renderer.Texture.LockCache(); + } + + private void UnlockCaches() + { + Gpu.Renderer.Rasterizer.UnlockCaches(); + Gpu.Renderer.Texture.UnlockCache(); } private void ClearBuffers(NvGpuVmm Vmm, NvGpuPBEntry PBEntry) @@ -570,7 +586,7 @@ namespace Ryujinx.HLE.Gpu.Engines Gpu.Renderer.Rasterizer.CreateIbo(IboKey, Data); } - Gpu.Renderer.Rasterizer.SetIndexArray(IboKey, IbSize, IndexFormat); + Gpu.Renderer.Rasterizer.SetIndexArray(IbSize, IndexFormat); } List<GalVertexAttrib>[] Attribs = new List<GalVertexAttrib>[32]; @@ -634,7 +650,7 @@ namespace Ryujinx.HLE.Gpu.Engines Gpu.Renderer.Rasterizer.CreateVbo(VboKey, Data); } - Gpu.Renderer.Rasterizer.SetVertexArray(Index, Stride, VboKey, Attribs[Index].ToArray()); + Gpu.Renderer.Rasterizer.SetVertexArray(Stride, VboKey, Attribs[Index].ToArray()); } GalPrimitiveType PrimType = (GalPrimitiveType)(PrimCtrl & 0xffff); diff --git a/Ryujinx.HLE/Gpu/Texture/TextureHelper.cs b/Ryujinx.HLE/Gpu/Texture/TextureHelper.cs index ac8f75c5..3c633b69 100644 --- a/Ryujinx.HLE/Gpu/Texture/TextureHelper.cs +++ b/Ryujinx.HLE/Gpu/Texture/TextureHelper.cs @@ -28,15 +28,25 @@ namespace Ryujinx.HLE.Gpu.Texture { switch (Texture.Format) { - case GalTextureFormat.R32G32B32A32: return Texture.Width * Texture.Height * 16; - case GalTextureFormat.R16G16B16A16: return Texture.Width * Texture.Height * 8; - case GalTextureFormat.A8B8G8R8: return Texture.Width * Texture.Height * 4; - case GalTextureFormat.R32: return Texture.Width * Texture.Height * 4; - case GalTextureFormat.A1B5G5R5: return Texture.Width * Texture.Height * 2; - case GalTextureFormat.B5G6R5: return Texture.Width * Texture.Height * 2; - case GalTextureFormat.G8R8: return Texture.Width * Texture.Height * 2; - case GalTextureFormat.R16: return Texture.Width * Texture.Height * 2; - case GalTextureFormat.R8: return Texture.Width * Texture.Height; + case GalTextureFormat.R32G32B32A32: + return Texture.Width * Texture.Height * 16; + + case GalTextureFormat.R16G16B16A16: + return Texture.Width * Texture.Height * 8; + + case GalTextureFormat.A8B8G8R8: + case GalTextureFormat.R32: + case GalTextureFormat.ZF32: + return Texture.Width * Texture.Height * 4; + + case GalTextureFormat.A1B5G5R5: + case GalTextureFormat.B5G6R5: + case GalTextureFormat.G8R8: + case GalTextureFormat.R16: + return Texture.Width * Texture.Height * 2; + + case GalTextureFormat.R8: + return Texture.Width * Texture.Height; case GalTextureFormat.BC1: case GalTextureFormat.BC4: diff --git a/Ryujinx.HLE/Gpu/Texture/TextureReader.cs b/Ryujinx.HLE/Gpu/Texture/TextureReader.cs index 48bf1a90..24bceffb 100644 --- a/Ryujinx.HLE/Gpu/Texture/TextureReader.cs +++ b/Ryujinx.HLE/Gpu/Texture/TextureReader.cs @@ -25,6 +25,7 @@ namespace Ryujinx.HLE.Gpu.Texture case GalTextureFormat.BC3: return Read16Bpt4x4(Memory, Texture); case GalTextureFormat.BC4: return Read8Bpt4x4 (Memory, Texture); case GalTextureFormat.BC5: return Read16Bpt4x4(Memory, Texture); + case GalTextureFormat.ZF32: return Read4Bpp (Memory, Texture); case GalTextureFormat.Astc2D4x4: return Read16Bpt4x4(Memory, Texture); } |
