aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs66
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs29
2 files changed, 18 insertions, 77 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs b/Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs
index a328fc2b..be94f310 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs
@@ -25,28 +25,14 @@ namespace Ryujinx.Graphics.Gpu.Image
public int Binding { get; }
/// <summary>
- /// Shader texture handle.
- /// This is an index into the texture constant buffer.
- /// </summary>
- public int Handle { get; }
-
- /// <summary>
- /// Indicates if the texture is a bindless texture.
- /// </summary>
- /// <remarks>
- /// For those textures, Handle is ignored.
- /// </remarks>
- public bool IsBindless { get; }
-
- /// <summary>
- /// Constant buffer slot with the bindless texture handle, for bindless texture.
+ /// Constant buffer slot with the texture handle.
/// </summary>
public int CbufSlot { get; }
/// <summary>
- /// Constant buffer offset of the bindless texture handle, for bindless texture.
+ /// Index of the texture handle on the constant buffer at slot <see cref="CbufSlot"/>.
/// </summary>
- public int CbufOffset { get; }
+ public int Handle { get; }
/// <summary>
/// Flags from the texture descriptor that indicate how the texture is used.
@@ -59,21 +45,17 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <param name="target">The shader sampler target type</param>
/// <param name="format">Format of the image as declared on the shader</param>
/// <param name="binding">The shader texture binding point</param>
+ /// <param name="cbufSlot">Constant buffer slot where the texture handle is located</param>
/// <param name="handle">The shader texture handle (read index into the texture constant buffer)</param>
/// <param name="flags">The texture's usage flags, indicating how it is used in the shader</param>
- public TextureBindingInfo(Target target, Format format, int binding, int handle, TextureUsageFlags flags)
+ public TextureBindingInfo(Target target, Format format, int binding, int cbufSlot, int handle, TextureUsageFlags flags)
{
- Target = target;
- Format = format;
- Binding = binding;
- Handle = handle;
-
- IsBindless = false;
-
- CbufSlot = 0;
- CbufOffset = 0;
-
- Flags = flags;
+ Target = target;
+ Format = format;
+ Binding = binding;
+ CbufSlot = cbufSlot;
+ Handle = handle;
+ Flags = flags;
}
/// <summary>
@@ -81,33 +63,11 @@ namespace Ryujinx.Graphics.Gpu.Image
/// </summary>
/// <param name="target">The shader sampler target type</param>
/// <param name="binding">The shader texture binding point</param>
+ /// <param name="cbufSlot">Constant buffer slot where the texture handle is located</param>
/// <param name="handle">The shader texture handle (read index into the texture constant buffer)</param>
/// <param name="flags">The texture's usage flags, indicating how it is used in the shader</param>
- public TextureBindingInfo(Target target, int binding, int handle, TextureUsageFlags flags) : this(target, (Format)0, binding, handle, flags)
+ public TextureBindingInfo(Target target, int binding, int cbufSlot, int handle, TextureUsageFlags flags) : this(target, (Format)0, binding, cbufSlot, handle, flags)
{
}
-
- /// <summary>
- /// Constructs the bindless texture binding information structure.
- /// </summary>
- /// <param name="target">The shader sampler target type</param>
- /// <param name="binding">The shader texture binding point</param>
- /// <param name="cbufSlot">Constant buffer slot where the bindless texture handle is located</param>
- /// <param name="cbufOffset">Constant buffer offset of the bindless texture handle</param>
- /// <param name="flags">The texture's usage flags, indicating how it is used in the shader</param>
- public TextureBindingInfo(Target target, int binding, int cbufSlot, int cbufOffset, TextureUsageFlags flags)
- {
- Target = target;
- Format = 0;
- Binding = binding;
- Handle = 0;
-
- IsBindless = true;
-
- CbufSlot = cbufSlot;
- CbufOffset = cbufOffset;
-
- Flags = flags;
- }
}
} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
index bfb6da25..8d44165c 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
@@ -267,30 +267,9 @@ namespace Ryujinx.Graphics.Gpu.Image
{
TextureBindingInfo bindingInfo = _textureBindings[stageIndex][index];
- int packedId;
-
- if (bindingInfo.IsBindless)
- {
- ulong address;
-
- var bufferManager = _context.Methods.BufferManager;
-
- if (_isCompute)
- {
- address = bufferManager.GetComputeUniformBufferAddress(bindingInfo.CbufSlot);
- }
- else
- {
- address = bufferManager.GetGraphicsUniformBufferAddress(stageIndex, bindingInfo.CbufSlot);
- }
-
- packedId = _context.PhysicalMemory.Read<int>(address + (ulong)bindingInfo.CbufOffset * 4);
- }
- else
- {
- packedId = ReadPackedId(stageIndex, bindingInfo.Handle, _textureBufferIndex);
- }
+ int textureBufferIndex = bindingInfo.CbufSlot < 0 ? _textureBufferIndex : bindingInfo.CbufSlot;
+ int packedId = ReadPackedId(stageIndex, bindingInfo.Handle, textureBufferIndex);
int textureId = UnpackTextureId(packedId);
int samplerId;
@@ -361,7 +340,9 @@ namespace Ryujinx.Graphics.Gpu.Image
{
TextureBindingInfo bindingInfo = _imageBindings[stageIndex][index];
- int packedId = ReadPackedId(stageIndex, bindingInfo.Handle, _textureBufferIndex);
+ int textureBufferIndex = bindingInfo.CbufSlot < 0 ? _textureBufferIndex : bindingInfo.CbufSlot;
+
+ int packedId = ReadPackedId(stageIndex, bindingInfo.Handle, textureBufferIndex);
int textureId = UnpackTextureId(packedId);
Texture texture = pool.Get(textureId);