diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-11-08 08:10:00 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-08 12:10:00 +0100 |
| commit | 8d168574eb04ae1e7026ac2b058e3b184f068fae (patch) | |
| tree | 6e0f79447276619af980055419874f5e99595b58 /Ryujinx.Graphics.Gpu/Engine/Compute.cs | |
| parent | 5561a3b95e9c980e3354366570e7896a213b95ae (diff) | |
Use explicit buffer and texture bindings on shaders (#1666)
* Use explicit buffer and texture bindings on shaders
* More XML docs and other nits
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/Compute.cs')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Engine/Compute.cs | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Compute.cs b/Ryujinx.Graphics.Gpu/Engine/Compute.cs index 1219ef0c..3ea98f3e 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Compute.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Compute.cs @@ -28,9 +28,6 @@ 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)) @@ -38,8 +35,6 @@ namespace Ryujinx.Graphics.Gpu.Engine continue; } - ubEnableMask |= 1u << index; - ulong gpuVa = (uint)qmd.ConstantBufferAddrLower(index) | (ulong)qmd.ConstantBufferAddrUpper(index) << 32; ulong size = (ulong)qmd.ConstantBufferSize(index); @@ -58,13 +53,10 @@ namespace Ryujinx.Graphics.Gpu.Engine _context.Renderer.Pipeline.SetProgram(cs.HostProgram); var samplerPool = state.Get<PoolState>(MethodOffset.SamplerPoolState); - - TextureManager.SetComputeSamplerPool(samplerPool.Address.Pack(), samplerPool.MaximumId, qmd.SamplerIndex); - var texturePool = state.Get<PoolState>(MethodOffset.TexturePoolState); + TextureManager.SetComputeSamplerPool(samplerPool.Address.Pack(), samplerPool.MaximumId, qmd.SamplerIndex); TextureManager.SetComputeTexturePool(texturePool.Address.Pack(), texturePool.MaximumId); - TextureManager.SetComputeTextureBufferIndex(state.Get<int>(MethodOffset.TextureBufferIndex)); ShaderProgramInfo info = cs.Shaders[0].Program.Info; @@ -82,8 +74,6 @@ namespace Ryujinx.Graphics.Gpu.Engine continue; } - ubEnableMask |= 1u << cb.Slot; - ulong cbDescAddress = BufferManager.GetComputeUniformBufferAddress(0); int cbDescOffset = 0x260 + (cb.Slot - 8) * 0x10; @@ -99,8 +89,6 @@ namespace Ryujinx.Graphics.Gpu.Engine { BufferDescriptor sb = info.SBuffers[index]; - sbEnableMask |= 1u << sb.Slot; - ulong sbDescAddress = BufferManager.GetComputeUniformBufferAddress(0); int sbDescOffset = 0x310 + sb.Slot * 0x10; @@ -112,15 +100,8 @@ namespace Ryujinx.Graphics.Gpu.Engine BufferManager.SetComputeStorageBuffer(sb.Slot, sbDescriptor.PackAddress(), (uint)sbDescriptor.Size); } - ubEnableMask = 0; - - for (int index = 0; index < info.CBuffers.Count; index++) - { - ubEnableMask |= 1u << info.CBuffers[index].Slot; - } - - BufferManager.SetComputeStorageBufferEnableMask(sbEnableMask); - BufferManager.SetComputeUniformBufferEnableMask(ubEnableMask); + BufferManager.SetComputeStorageBufferBindings(info.SBuffers); + BufferManager.SetComputeUniformBufferBindings(info.CBuffers); var textureBindings = new TextureBindingInfo[info.Textures.Count]; @@ -132,11 +113,16 @@ namespace Ryujinx.Graphics.Gpu.Engine if (descriptor.IsBindless) { - textureBindings[index] = new TextureBindingInfo(target, descriptor.CbufOffset, descriptor.CbufSlot, descriptor.Flags); + textureBindings[index] = new TextureBindingInfo( + target, + descriptor.Binding, + descriptor.CbufOffset, + descriptor.CbufSlot, + descriptor.Flags); } else { - textureBindings[index] = new TextureBindingInfo(target, descriptor.HandleIndex, descriptor.Flags); + textureBindings[index] = new TextureBindingInfo(target, descriptor.Binding, descriptor.HandleIndex, descriptor.Flags); } } @@ -151,7 +137,7 @@ namespace Ryujinx.Graphics.Gpu.Engine Target target = ShaderTexture.GetTarget(descriptor.Type); Format format = ShaderTexture.GetFormat(descriptor.Format); - imageBindings[index] = new TextureBindingInfo(target, format, descriptor.HandleIndex, descriptor.Flags); + imageBindings[index] = new TextureBindingInfo(target, format, descriptor.Binding, descriptor.HandleIndex, descriptor.Flags); } TextureManager.SetComputeImages(imageBindings); |
