Initial support for GPU channels (#2372)
* Ground work for separate GPU channels * Rename TextureManager to TextureCache * Decouple texture bindings management from the texture cache * Rename BufferManager to BufferCache * Decouple buffer bindings management from the buffer cache * More comments and proper disposal * PR feedback * Force host state update on channel switch * Typo * PR feedback * Missing using
This commit is contained in:
parent
12a7a2ead8
commit
a10b2c5ff2
24 changed files with 1745 additions and 1456 deletions
|
@ -40,7 +40,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||
ulong gpuVa = (uint)qmd.ConstantBufferAddrLower(index) | (ulong)qmd.ConstantBufferAddrUpper(index) << 32;
|
||||
ulong size = (ulong)qmd.ConstantBufferSize(index);
|
||||
|
||||
BufferManager.SetComputeUniformBuffer(index, gpuVa, size);
|
||||
state.Channel.BufferManager.SetComputeUniformBuffer(index, gpuVa, size);
|
||||
}
|
||||
|
||||
ShaderBundle cs = ShaderCache.GetComputeShader(
|
||||
|
@ -57,9 +57,9 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||
var samplerPool = state.Get<PoolState>(MethodOffset.SamplerPoolState);
|
||||
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));
|
||||
state.Channel.TextureManager.SetComputeSamplerPool(samplerPool.Address.Pack(), samplerPool.MaximumId, qmd.SamplerIndex);
|
||||
state.Channel.TextureManager.SetComputeTexturePool(texturePool.Address.Pack(), texturePool.MaximumId);
|
||||
state.Channel.TextureManager.SetComputeTextureBufferIndex(state.Get<int>(MethodOffset.TextureBufferIndex));
|
||||
|
||||
ShaderProgramInfo info = cs.Shaders[0].Info;
|
||||
|
||||
|
@ -76,7 +76,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||
continue;
|
||||
}
|
||||
|
||||
ulong cbDescAddress = BufferManager.GetComputeUniformBufferAddress(0);
|
||||
ulong cbDescAddress = state.Channel.BufferManager.GetComputeUniformBufferAddress(0);
|
||||
|
||||
int cbDescOffset = 0x260 + (cb.Slot - 8) * 0x10;
|
||||
|
||||
|
@ -84,14 +84,14 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||
|
||||
SbDescriptor cbDescriptor = _context.PhysicalMemory.Read<SbDescriptor>(cbDescAddress);
|
||||
|
||||
BufferManager.SetComputeUniformBuffer(cb.Slot, cbDescriptor.PackAddress(), (uint)cbDescriptor.Size);
|
||||
state.Channel.BufferManager.SetComputeUniformBuffer(cb.Slot, cbDescriptor.PackAddress(), (uint)cbDescriptor.Size);
|
||||
}
|
||||
|
||||
for (int index = 0; index < info.SBuffers.Count; index++)
|
||||
{
|
||||
BufferDescriptor sb = info.SBuffers[index];
|
||||
|
||||
ulong sbDescAddress = BufferManager.GetComputeUniformBufferAddress(0);
|
||||
ulong sbDescAddress = state.Channel.BufferManager.GetComputeUniformBufferAddress(0);
|
||||
|
||||
int sbDescOffset = 0x310 + sb.Slot * 0x10;
|
||||
|
||||
|
@ -99,11 +99,11 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||
|
||||
SbDescriptor sbDescriptor = _context.PhysicalMemory.Read<SbDescriptor>(sbDescAddress);
|
||||
|
||||
BufferManager.SetComputeStorageBuffer(sb.Slot, sbDescriptor.PackAddress(), (uint)sbDescriptor.Size, sb.Flags);
|
||||
state.Channel.BufferManager.SetComputeStorageBuffer(sb.Slot, sbDescriptor.PackAddress(), (uint)sbDescriptor.Size, sb.Flags);
|
||||
}
|
||||
|
||||
BufferManager.SetComputeStorageBufferBindings(info.SBuffers);
|
||||
BufferManager.SetComputeUniformBufferBindings(info.CBuffers);
|
||||
state.Channel.BufferManager.SetComputeStorageBufferBindings(info.SBuffers);
|
||||
state.Channel.BufferManager.SetComputeUniformBufferBindings(info.CBuffers);
|
||||
|
||||
var textureBindings = new TextureBindingInfo[info.Textures.Count];
|
||||
|
||||
|
@ -121,7 +121,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||
descriptor.Flags);
|
||||
}
|
||||
|
||||
TextureManager.SetComputeTextures(textureBindings);
|
||||
state.Channel.TextureManager.SetComputeTextures(textureBindings);
|
||||
|
||||
var imageBindings = new TextureBindingInfo[info.Images.Count];
|
||||
|
||||
|
@ -141,10 +141,10 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||
descriptor.Flags);
|
||||
}
|
||||
|
||||
TextureManager.SetComputeImages(imageBindings);
|
||||
state.Channel.TextureManager.SetComputeImages(imageBindings);
|
||||
|
||||
TextureManager.CommitComputeBindings();
|
||||
BufferManager.CommitComputeBindings();
|
||||
state.Channel.TextureManager.CommitComputeBindings();
|
||||
state.Channel.BufferManager.CommitComputeBindings();
|
||||
|
||||
_context.Renderer.Pipeline.DispatchCompute(
|
||||
qmd.CtaRasterWidth,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue