Simplify logic for bindless texture handling (#1667)

* Simplify logic for bindless texture handling

* Nits
This commit is contained in:
gdkchan 2020-11-09 19:35:04 -03:00 committed by GitHub
parent eda6b78894
commit 934a78005e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 131 additions and 191 deletions

View file

@ -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;
}
}
}