From 796e5d14b4fadc15439d273f8ff8f9e9afc4033a Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 2 Feb 2020 00:25:52 -0300 Subject: Use correct shader local memory size instead of a hardcoded size (#914) * Use correct shader local size instead of a hardcoded size * Remove unused uniform block * Update XML doc * Local memory size has 23 bits on maxwell * Generate compute QMD struct from nv open doc header * Remove dummy arrays when shared or local memory is not used, other improvements --- Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs | 31 +++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Shader') diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs index dad1b0ac..8aa9b1c7 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs @@ -51,12 +51,19 @@ namespace Ryujinx.Graphics.Gpu.Shader /// This automatically translates, compiles and adds the code to the cache if not present. /// /// GPU virtual address of the binary shader code - /// Shared memory size of the compute shader /// Local group size X of the computer shader /// Local group size Y of the computer shader /// Local group size Z of the computer shader + /// Local memory size of the compute shader + /// Shared memory size of the compute shader /// Compiled compute shader code - public ComputeShader GetComputeShader(ulong gpuVa, int sharedMemorySize, int localSizeX, int localSizeY, int localSizeZ) + public ComputeShader GetComputeShader( + ulong gpuVa, + int localSizeX, + int localSizeY, + int localSizeZ, + int localMemorySize, + int sharedMemorySize) { bool isCached = _cpPrograms.TryGetValue(gpuVa, out List list); @@ -71,7 +78,13 @@ namespace Ryujinx.Graphics.Gpu.Shader } } - CachedShader shader = TranslateComputeShader(gpuVa, sharedMemorySize, localSizeX, localSizeY, localSizeZ); + CachedShader shader = TranslateComputeShader( + gpuVa, + localSizeX, + localSizeY, + localSizeZ, + localMemorySize, + sharedMemorySize); shader.HostShader = _context.Renderer.CompileShader(shader.Program); @@ -237,12 +250,19 @@ namespace Ryujinx.Graphics.Gpu.Shader /// Translates the binary Maxwell shader code to something that the host API accepts. /// /// GPU virtual address of the binary shader code - /// Shared memory size of the compute shader /// Local group size X of the computer shader /// Local group size Y of the computer shader /// Local group size Z of the computer shader + /// Local memory size of the compute shader + /// Shared memory size of the compute shader /// Compiled compute shader code - private CachedShader TranslateComputeShader(ulong gpuVa, int sharedMemorySize, int localSizeX, int localSizeY, int localSizeZ) + private CachedShader TranslateComputeShader( + ulong gpuVa, + int localSizeX, + int localSizeY, + int localSizeZ, + int localMemorySize, + int sharedMemorySize) { if (gpuVa == 0) { @@ -256,6 +276,7 @@ namespace Ryujinx.Graphics.Gpu.Shader QueryInfoName.ComputeLocalSizeX => localSizeX, QueryInfoName.ComputeLocalSizeY => localSizeY, QueryInfoName.ComputeLocalSizeZ => localSizeZ, + QueryInfoName.ComputeLocalMemorySize => localMemorySize, QueryInfoName.ComputeSharedMemorySize => sharedMemorySize, _ => QueryInfoCommon(info) }; -- cgit v1.2.3