aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Gpu/Shader/DiskCache
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2024-04-22 15:05:55 -0300
committerGitHub <noreply@github.com>2024-04-22 15:05:55 -0300
commitc6f8bfed904e30f7c5d890a2f0ef531eb9e298e5 (patch)
treee1c048d390867e8c9403904498184e3a64277e49 /src/Ryujinx.Graphics.Gpu/Shader/DiskCache
parent9b94662b4bb2ebf846e1baf45ba8097fcd7da684 (diff)
Add support for bindless textures from shader input (vertex buffer) on Vulkan (#6577)
* Add support for bindless textures from shader input (vertex buffer) * Shader cache version bump * Format whitespace * Remove cache entries on pool removal, disable for OpenGL * PR feedback
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Shader/DiskCache')
-rw-r--r--src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs35
-rw-r--r--src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs2
2 files changed, 36 insertions, 1 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs
index 681838a9..45f32e2d 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs
@@ -110,6 +110,13 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
}
/// <inheritdoc/>
+ /// <exception cref="DiskCacheLoadException">Pool length is not available on the cache</exception>
+ public int QuerySamplerArrayLengthFromPool()
+ {
+ return QueryArrayLengthFromPool(isSampler: true);
+ }
+
+ /// <inheritdoc/>
public SamplerType QuerySamplerType(int handle, int cbufSlot)
{
_newSpecState.RecordTextureSamplerType(_stageIndex, handle, cbufSlot);
@@ -117,6 +124,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
}
/// <inheritdoc/>
+ /// <exception cref="DiskCacheLoadException">Constant buffer derived length is not available on the cache</exception>
public int QueryTextureArrayLengthFromBuffer(int slot)
{
if (!_oldSpecState.TextureArrayFromBufferRegistered(_stageIndex, 0, slot))
@@ -131,6 +139,13 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
}
/// <inheritdoc/>
+ /// <exception cref="DiskCacheLoadException">Pool length is not available on the cache</exception>
+ public int QueryTextureArrayLengthFromPool()
+ {
+ return QueryArrayLengthFromPool(isSampler: false);
+ }
+
+ /// <inheritdoc/>
public TextureFormat QueryTextureFormat(int handle, int cbufSlot)
{
_newSpecState.RecordTextureFormat(_stageIndex, handle, cbufSlot);
@@ -170,6 +185,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
}
/// <inheritdoc/>
+ /// <exception cref="DiskCacheLoadException">Texture information is not available on the cache</exception>
public void RegisterTexture(int handle, int cbufSlot)
{
if (!_oldSpecState.TextureRegistered(_stageIndex, handle, cbufSlot))
@@ -182,5 +198,24 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
bool coordNormalized = _oldSpecState.GetCoordNormalized(_stageIndex, handle, cbufSlot);
_newSpecState.RegisterTexture(_stageIndex, handle, cbufSlot, format, formatSrgb, target, coordNormalized);
}
+
+ /// <summary>
+ /// Gets the cached texture or sampler pool capacity.
+ /// </summary>
+ /// <param name="isSampler">True to get sampler pool length, false for texture pool length</param>
+ /// <returns>Pool length</returns>
+ /// <exception cref="DiskCacheLoadException">Pool length is not available on the cache</exception>
+ private int QueryArrayLengthFromPool(bool isSampler)
+ {
+ if (!_oldSpecState.TextureArrayFromPoolRegistered(isSampler))
+ {
+ throw new DiskCacheLoadException(DiskCacheLoadResult.MissingTextureArrayLength);
+ }
+
+ int arrayLength = _oldSpecState.GetTextureArrayFromPoolLength(isSampler);
+ _newSpecState.RegisterTextureArrayLengthFromPool(isSampler, arrayLength);
+
+ return arrayLength;
+ }
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
index b6a277a2..2c19cc4b 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
@@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
private const ushort FileFormatVersionMajor = 1;
private const ushort FileFormatVersionMinor = 2;
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
- private const uint CodeGenVersion = 6489;
+ private const uint CodeGenVersion = 6577;
private const string SharedTocFileName = "shared.toc";
private const string SharedDataFileName = "shared.data";