Set texture/image bindings in place rather than allocating and passing an array (#2647)

* Remove allocations for texture bindings and state

* Rent rather than stackalloc + copy

A bit faster.
This commit is contained in:
riperiperi 2021-09-19 13:03:05 +01:00 committed by GitHub
parent 32c09af71a
commit b0af010247
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 95 additions and 47 deletions

View file

@ -191,7 +191,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
_channel.BufferManager.SetComputeStorageBufferBindings(info.SBuffers);
_channel.BufferManager.SetComputeUniformBufferBindings(info.CBuffers);
var textureBindings = new TextureBindingInfo[info.Textures.Count];
TextureBindingInfo[] textureBindings = _channel.TextureManager.RentComputeTextureBindings(info.Textures.Count);
for (int index = 0; index < info.Textures.Count; index++)
{
@ -207,9 +207,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
descriptor.Flags);
}
_channel.TextureManager.SetComputeTextures(textureBindings);
var imageBindings = new TextureBindingInfo[info.Images.Count];
TextureBindingInfo[] imageBindings = _channel.TextureManager.RentComputeImageBindings(info.Images.Count);
for (int index = 0; index < info.Images.Count; index++)
{
@ -227,8 +225,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
descriptor.Flags);
}
_channel.TextureManager.SetComputeImages(imageBindings);
_channel.TextureManager.CommitComputeBindings();
_channel.BufferManager.CommitComputeBindings();