aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Shader
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-02-02 00:25:52 -0300
committerGitHub <noreply@github.com>2020-02-02 14:25:52 +1100
commit796e5d14b4fadc15439d273f8ff8f9e9afc4033a (patch)
treee45cbac1f155d939941bdb0aebeb29222e92abe4 /Ryujinx.Graphics.Gpu/Shader
parentea14a955243705b5d5b22868c30c174e6524b4d3 (diff)
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
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Shader')
-rw-r--r--Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs31
1 files changed, 26 insertions, 5 deletions
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.
/// </remarks>
/// <param name="gpuVa">GPU virtual address of the binary shader code</param>
- /// <param name="sharedMemorySize">Shared memory size of the compute shader</param>
/// <param name="localSizeX">Local group size X of the computer shader</param>
/// <param name="localSizeY">Local group size Y of the computer shader</param>
/// <param name="localSizeZ">Local group size Z of the computer shader</param>
+ /// <param name="localMemorySize">Local memory size of the compute shader</param>
+ /// <param name="sharedMemorySize">Shared memory size of the compute shader</param>
/// <returns>Compiled compute shader code</returns>
- 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<ComputeShader> 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.
/// </summary>
/// <param name="gpuVa">GPU virtual address of the binary shader code</param>
- /// <param name="sharedMemorySize">Shared memory size of the compute shader</param>
/// <param name="localSizeX">Local group size X of the computer shader</param>
/// <param name="localSizeY">Local group size Y of the computer shader</param>
/// <param name="localSizeZ">Local group size Z of the computer shader</param>
+ /// <param name="localMemorySize">Local memory size of the compute shader</param>
+ /// <param name="sharedMemorySize">Shared memory size of the compute shader</param>
/// <returns>Compiled compute shader code</returns>
- 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)
};