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/Image/TextureManager.cs | 36 +++++++++++++++------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Image/TextureManager.cs') diff --git a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs index 4db6532b..1d7b8df2 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs @@ -43,41 +43,45 @@ namespace Ryujinx.Graphics.Gpu.Image } /// <summary> - /// Sets texture bindings on the compute pipeline. + /// Rents the texture bindings array of the compute pipeline. /// </summary> - /// <param name="bindings">The texture bindings</param> - public void SetComputeTextures(TextureBindingInfo[] bindings) + /// <param name="count">The number of bindings needed</param> + /// <returns>The texture bindings array</returns> + public TextureBindingInfo[] RentComputeTextureBindings(int count) { - _cpBindingsManager.SetTextures(0, bindings); + return _cpBindingsManager.RentTextureBindings(0, count); } /// <summary> - /// Sets texture bindings on the graphics pipeline. + /// Rents the texture bindings array for a given stage on the graphics pipeline. /// </summary> /// <param name="stage">The index of the shader stage to bind the textures</param> - /// <param name="bindings">The texture bindings</param> - public void SetGraphicsTextures(int stage, TextureBindingInfo[] bindings) + /// <param name="count">The number of bindings needed</param> + /// <returns>The texture bindings array</returns> + public TextureBindingInfo[] RentGraphicsTextureBindings(int stage, int count) { - _gpBindingsManager.SetTextures(stage, bindings); + return _gpBindingsManager.RentTextureBindings(stage, count); } /// <summary> - /// Sets image bindings on the compute pipeline. + /// Rents the image bindings array of the compute pipeline. /// </summary> - /// <param name="bindings">The image bindings</param> - public void SetComputeImages(TextureBindingInfo[] bindings) + /// <param name="count">The number of bindings needed</param> + /// <returns>The image bindings array</returns> + public TextureBindingInfo[] RentComputeImageBindings(int count) { - _cpBindingsManager.SetImages(0, bindings); + return _cpBindingsManager.RentImageBindings(0, count); } /// <summary> - /// Sets image bindings on the graphics pipeline. + /// Rents the image bindings array for a given stage on the graphics pipeline. /// </summary> /// <param name="stage">The index of the shader stage to bind the images</param> - /// <param name="bindings">The image bindings</param> - public void SetGraphicsImages(int stage, TextureBindingInfo[] bindings) + /// <param name="count">The number of bindings needed</param> + /// <returns>The image bindings array</returns> + public TextureBindingInfo[] RentGraphicsImageBindings(int stage, int count) { - _gpBindingsManager.SetImages(stage, bindings); + return _gpBindingsManager.RentImageBindings(stage, count); } /// <summary> -- cgit v1.2.3-70-g09d2