aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2022-12-04 17:18:40 +0000
committerGitHub <noreply@github.com>2022-12-04 18:18:40 +0100
commit4965681e069eeedc5272030b131c2a45e6131e61 (patch)
tree050a6596728c6a040c5c17fd21339c913b97ee8f /Ryujinx.Graphics.Gpu/Image/TextureManager.cs
parent3868a0020611491e30db19e5b27d33a7559c7071 (diff)
GPU: Swap bindings array instead of copying (#4003)1.1.418
* GPU: Swap bindings array instead of copying Reduces work on UpdateShaderState. Now the cost is a few reference moves for arrays, rather than copying data. Downside: bindings arrays are no longer readonly. * Micro optimisation * Add missing docs * Address Feedback
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureManager.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureManager.cs60
1 files changed, 8 insertions, 52 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
index fe0175a6..083de64c 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
@@ -57,45 +57,21 @@ namespace Ryujinx.Graphics.Gpu.Image
}
/// <summary>
- /// Rents the texture bindings array of the compute pipeline.
+ /// Sets the texture and image bindings for the compute pipeline.
/// </summary>
- /// <param name="count">The number of bindings needed</param>
- /// <returns>The texture bindings array</returns>
- public TextureBindingInfo[] RentComputeTextureBindings(int count)
+ /// <param name="bindings">Bindings for the active shader</param>
+ public void SetComputeBindings(CachedShaderBindings bindings)
{
- return _cpBindingsManager.RentTextureBindings(0, count);
+ _cpBindingsManager.SetBindings(bindings);
}
/// <summary>
- /// Rents the texture bindings array for a given stage on the graphics pipeline.
+ /// Sets the texture and image bindings for the graphics pipeline.
/// </summary>
- /// <param name="stage">The index of the shader stage to bind the textures</param>
- /// <param name="count">The number of bindings needed</param>
- /// <returns>The texture bindings array</returns>
- public TextureBindingInfo[] RentGraphicsTextureBindings(int stage, int count)
+ /// <param name="bindings">Bindings for the active shader</param>
+ public void SetGraphicsBindings(CachedShaderBindings bindings)
{
- return _gpBindingsManager.RentTextureBindings(stage, count);
- }
-
- /// <summary>
- /// Rents the image bindings array of the compute pipeline.
- /// </summary>
- /// <param name="count">The number of bindings needed</param>
- /// <returns>The image bindings array</returns>
- public TextureBindingInfo[] RentComputeImageBindings(int count)
- {
- return _cpBindingsManager.RentImageBindings(0, count);
- }
-
- /// <summary>
- /// 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="count">The number of bindings needed</param>
- /// <returns>The image bindings array</returns>
- public TextureBindingInfo[] RentGraphicsImageBindings(int stage, int count)
- {
- return _gpBindingsManager.RentImageBindings(stage, count);
+ _gpBindingsManager.SetBindings(bindings);
}
/// <summary>
@@ -108,16 +84,6 @@ namespace Ryujinx.Graphics.Gpu.Image
}
/// <summary>
- /// Sets the max binding indexes on the compute pipeline.
- /// </summary>
- /// <param name="maxTextureBinding">The maximum texture binding</param>
- /// <param name="maxImageBinding">The maximum image binding</param>
- public void SetComputeMaxBindings(int maxTextureBinding, int maxImageBinding)
- {
- _cpBindingsManager.SetMaxBindings(maxTextureBinding, maxImageBinding);
- }
-
- /// <summary>
/// Sets the texture constant buffer index on the graphics pipeline.
/// </summary>
/// <param name="index">The texture constant buffer index</param>
@@ -127,16 +93,6 @@ namespace Ryujinx.Graphics.Gpu.Image
}
/// <summary>
- /// Sets the max binding indexes on the graphics pipeline.
- /// </summary>
- /// <param name="maxTextureBinding">The maximum texture binding</param>
- /// <param name="maxImageBinding">The maximum image binding</param>
- public void SetGraphicsMaxBindings(int maxTextureBinding, int maxImageBinding)
- {
- _gpBindingsManager.SetMaxBindings(maxTextureBinding, maxImageBinding);
- }
-
- /// <summary>
/// Sets the current sampler pool on the compute pipeline.
/// </summary>
/// <param name="gpuVa">The start GPU virtual address of the sampler pool</param>