diff options
author | riperiperi <rhy3756547@hotmail.com> | 2021-09-19 13:03:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-19 14:03:05 +0200 |
commit | b0af010247a2bc1d9af1fb1068d4fad0319ad216 (patch) | |
tree | 73f1b68c5b6e44bbdde1952e61209f9b12527edc /Ryujinx.Graphics.Gpu/Image/TextureManager.cs | |
parent | 32c09af71a5bebdb711b175627e1e26370275d96 (diff) |
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.
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureManager.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Image/TextureManager.cs | 36 |
1 files changed, 20 insertions, 16 deletions
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> |