Unify GpuAccessorBase and TextureDescriptorCapableGpuAccessor (#2542)
* Unify GpuAccessorBase and TextureDescriptorCapableGpuAccessor * Shader cache version bump
This commit is contained in:
parent
d44d8f2eb6
commit
3148c0c21c
4 changed files with 43 additions and 59 deletions
|
@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a GPU state and memory accessor.
|
/// Represents a GPU state and memory accessor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class GpuAccessor : TextureDescriptorCapableGpuAccessor
|
class GpuAccessor : TextureDescriptorCapableGpuAccessor, IGpuAccessor
|
||||||
{
|
{
|
||||||
private readonly GpuChannel _channel;
|
private readonly GpuChannel _channel;
|
||||||
private readonly GpuAccessorState _state;
|
private readonly GpuAccessorState _state;
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
namespace Ryujinx.Graphics.Gpu.Shader
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a GPU state and memory accessor.
|
|
||||||
/// </summary>
|
|
||||||
class GpuAccessorBase
|
|
||||||
{
|
|
||||||
private readonly GpuContext _context;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new instance of the GPU state accessor.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="context">GPU context</param>
|
|
||||||
public GpuAccessorBase(GpuContext context)
|
|
||||||
{
|
|
||||||
_context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Queries host about the presence of the FrontFacing built-in variable bug.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>True if the bug is present on the host device used, false otherwise</returns>
|
|
||||||
public bool QueryHostHasFrontFacingBug() => _context.Capabilities.HasFrontFacingBug;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Queries host about the presence of the vector indexing bug.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>True if the bug is present on the host device used, false otherwise</returns>
|
|
||||||
public bool QueryHostHasVectorIndexingBug() => _context.Capabilities.HasVectorIndexingBug;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Queries host storage buffer alignment required.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Host storage buffer alignment in bytes</returns>
|
|
||||||
public int QueryHostStorageBufferOffsetAlignment() => _context.Capabilities.StorageBufferOffsetAlignment;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Queries host support for readable images without a explicit format declaration on the shader.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>True if formatted image load is supported, false otherwise</returns>
|
|
||||||
public bool QueryHostSupportsImageLoadFormatted() => _context.Capabilities.SupportsImageLoadFormatted;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Queries host GPU non-constant texture offset support.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>True if the GPU and driver supports non-constant texture offsets, false otherwise</returns>
|
|
||||||
public bool QueryHostSupportsNonConstantTextureOffset() => _context.Capabilities.SupportsNonConstantTextureOffset;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Queries host GPU texture shadow LOD support.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>True if the GPU and driver supports texture shadow LOD, false otherwise</returns>
|
|
||||||
public bool QueryHostSupportsTextureShadowLod() => _context.Capabilities.SupportsTextureShadowLod;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -38,7 +38,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version of the codegen (to be changed when codegen or guest format change).
|
/// Version of the codegen (to be changed when codegen or guest format change).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const ulong ShaderCodeGenVersion = 2540;
|
private const ulong ShaderCodeGenVersion = 2542;
|
||||||
|
|
||||||
// Progress reporting helpers
|
// Progress reporting helpers
|
||||||
private volatile int _shaderCount;
|
private volatile int _shaderCount;
|
||||||
|
|
|
@ -4,16 +4,55 @@ using Ryujinx.Graphics.Shader;
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.Gpu.Shader
|
namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
{
|
{
|
||||||
abstract class TextureDescriptorCapableGpuAccessor : GpuAccessorBase, IGpuAccessor
|
abstract class TextureDescriptorCapableGpuAccessor : IGpuAccessor
|
||||||
{
|
{
|
||||||
public TextureDescriptorCapableGpuAccessor(GpuContext context) : base(context)
|
private readonly GpuContext _context;
|
||||||
|
|
||||||
|
public TextureDescriptorCapableGpuAccessor(GpuContext context)
|
||||||
{
|
{
|
||||||
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract T MemoryRead<T>(ulong address) where T : unmanaged;
|
public abstract T MemoryRead<T>(ulong address) where T : unmanaged;
|
||||||
|
|
||||||
public abstract ITextureDescriptor GetTextureDescriptor(int handle, int cbufSlot);
|
public abstract ITextureDescriptor GetTextureDescriptor(int handle, int cbufSlot);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Queries host about the presence of the FrontFacing built-in variable bug.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if the bug is present on the host device used, false otherwise</returns>
|
||||||
|
public bool QueryHostHasFrontFacingBug() => _context.Capabilities.HasFrontFacingBug;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Queries host about the presence of the vector indexing bug.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if the bug is present on the host device used, false otherwise</returns>
|
||||||
|
public bool QueryHostHasVectorIndexingBug() => _context.Capabilities.HasVectorIndexingBug;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Queries host storage buffer alignment required.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Host storage buffer alignment in bytes</returns>
|
||||||
|
public int QueryHostStorageBufferOffsetAlignment() => _context.Capabilities.StorageBufferOffsetAlignment;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Queries host support for readable images without a explicit format declaration on the shader.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if formatted image load is supported, false otherwise</returns>
|
||||||
|
public bool QueryHostSupportsImageLoadFormatted() => _context.Capabilities.SupportsImageLoadFormatted;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Queries host GPU non-constant texture offset support.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if the GPU and driver supports non-constant texture offsets, false otherwise</returns>
|
||||||
|
public bool QueryHostSupportsNonConstantTextureOffset() => _context.Capabilities.SupportsNonConstantTextureOffset;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Queries host GPU texture shadow LOD support.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if the GPU and driver supports texture shadow LOD, false otherwise</returns>
|
||||||
|
public bool QueryHostSupportsTextureShadowLod() => _context.Capabilities.SupportsTextureShadowLod;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Queries texture format information, for shaders using image load or store.
|
/// Queries texture format information, for shaders using image load or store.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in a new issue