diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2023-06-17 16:28:27 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-17 16:28:27 -0300 |
| commit | f9a538bb0f02b4665f8cccbde0730e08da208024 (patch) | |
| tree | bf2412f0ddd744302990c541d74c1ba6da8d3669 /src/Ryujinx.Graphics.Shader/Translation/TranslatorContext.cs | |
| parent | f92921a6d118aa9c6acdb3ecaa3cd61a19fe341e (diff) | |
Ensure shader local and shared memory sizes are not zero (#5321)
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/Translation/TranslatorContext.cs')
| -rw-r--r-- | src/Ryujinx.Graphics.Shader/Translation/TranslatorContext.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.Shader/Translation/TranslatorContext.cs b/src/Ryujinx.Graphics.Shader/Translation/TranslatorContext.cs index 9647b13f..13c5e0e4 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/TranslatorContext.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/TranslatorContext.cs @@ -149,6 +149,17 @@ namespace Ryujinx.Graphics.Shader.Translation public ShaderProgram Translate(TranslatorContext other = null) { + bool usesLocalMemory = _config.UsedFeatures.HasFlag(FeatureFlags.LocalMemory); + + _config.ResourceManager.SetCurrentLocalMemory(_config.LocalMemorySize, usesLocalMemory); + + if (_config.Stage == ShaderStage.Compute) + { + bool usesSharedMemory = _config.UsedFeatures.HasFlag(FeatureFlags.SharedMemory); + + _config.ResourceManager.SetCurrentSharedMemory(GpuAccessor.QueryComputeSharedMemorySize(), usesSharedMemory); + } + FunctionCode[] code = EmitShader(_program, _config, initializeOutputs: other == null, out _); if (other != null) @@ -157,6 +168,7 @@ namespace Ryujinx.Graphics.Shader.Translation // We need to share the resource manager since both shaders accesses the same constant buffers. other._config.ResourceManager = _config.ResourceManager; + other._config.ResourceManager.SetCurrentLocalMemory(other._config.LocalMemorySize, other._config.UsedFeatures.HasFlag(FeatureFlags.LocalMemory)); FunctionCode[] otherCode = EmitShader(other._program, other._config, initializeOutputs: true, out int aStart); |
