From b0af010247a2bc1d9af1fb1068d4fad0319ad216 Mon Sep 17 00:00:00 2001
From: riperiperi <rhy3756547@hotmail.com>
Date: Sun, 19 Sep 2021 13:03:05 +0100
Subject: 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.
---
 Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

(limited to 'Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs')

diff --git a/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs b/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs
index a0304308..8469f1ae 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs
@@ -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();
 
-- 
cgit v1.2.3-70-g09d2