diff options
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs')
| -rw-r--r-- | src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs | 35 |
1 files changed, 35 insertions, 0 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; + } } } |
