From 03711dd7b5d44e20fb45c728803ea6b9599dec87 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 21 Apr 2020 20:35:28 -0300 Subject: Implement SULD shader instruction (#1117) * Implement SULD shader instruction * Some nits --- Ryujinx.Graphics.Gpu/Engine/Compute.cs | 39 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Engine/Compute.cs') diff --git a/Ryujinx.Graphics.Gpu/Engine/Compute.cs b/Ryujinx.Graphics.Gpu/Engine/Compute.cs index fc257f99..920cf0dd 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Compute.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Compute.cs @@ -29,7 +29,26 @@ namespace Ryujinx.Graphics.Gpu.Engine int sharedMemorySize = Math.Min(qmd.SharedMemorySize, _context.Capabilities.MaximumComputeSharedMemorySize); + uint sbEnableMask = 0; + uint ubEnableMask = 0; + + for (int index = 0; index < Constants.TotalCpUniformBuffers; index++) + { + if (!qmd.ConstantBufferValid(index)) + { + continue; + } + + ubEnableMask |= 1u << index; + + ulong gpuVa = (uint)qmd.ConstantBufferAddrLower(index) | (ulong)qmd.ConstantBufferAddrUpper(index) << 32; + ulong size = (ulong)qmd.ConstantBufferSize(index); + + BufferManager.SetComputeUniformBuffer(index, gpuVa, size); + } + ComputeShader cs = ShaderCache.GetComputeShader( + state, shaderGpuVa, qmd.CtaThreadDimension0, qmd.CtaThreadDimension1, @@ -49,25 +68,7 @@ namespace Ryujinx.Graphics.Gpu.Engine TextureManager.SetComputeTextureBufferIndex(state.Get(MethodOffset.TextureBufferIndex)); - ShaderProgramInfo info = cs.Shader.Program.Info; - - uint sbEnableMask = 0; - uint ubEnableMask = 0; - - for (int index = 0; index < Constants.TotalCpUniformBuffers; index++) - { - if (!qmd.ConstantBufferValid(index)) - { - continue; - } - - ubEnableMask |= 1u << index; - - ulong gpuVa = (uint)qmd.ConstantBufferAddrLower(index) | (ulong)qmd.ConstantBufferAddrUpper(index) << 32; - ulong size = (ulong)qmd.ConstantBufferSize(index); - - BufferManager.SetComputeUniformBuffer(index, gpuVa, size); - } + ShaderProgramInfo info = cs.Shader.Program.Info; for (int index = 0; index < info.CBuffers.Count; index++) { -- cgit v1.2.3