Ryujinx/src/Ryujinx.Graphics.Vulkan
riperiperi 76b53e018a
GPU: Add fallback when textureGatherOffsets is not supported (#5792)
* GPU: Add fallback when textureGatherOffsets is not supported.

This PR adds a fallback for GPUs or APIs that don't support an equivalent to the method `textureGatherOffsets`, where each of the 4 gathered texels has an individual offset. This is done by reusing the existing code to handle non-const offsets for texture instructions, though it has also been corrected as there were a few implementation issues.

MoltenVK reports support for this capability, and it didn't error when we initially released the MacOS build, but that has since changed. MVK still reports support, but spirv-cross has been fixed in a way that it _attempts_ to use this capability, but the metal compiler errors since it doesn't exist.

Some other fixes:
- textureGatherOffsets emulation has been changed significantly. It now uses 4 texture sample instructions (not gather), calculates a base texel (i=0 j=0) and adds the offsets onto it before converting into a tex coord. The final result is offset into a texel center, so it shouldn't be subject to interpolation, though this isn't perfect and could have some error with floating point formats with linear sampling. It is subject to texture wrap mode as it should be, which is why texelFetch was not used.
  - Maybe gather should be used here with component `w` (i=0, j=0), though this multiplies number of texels fetched by 4... The way it was doing this before _was_ wrong_, but doing it right would avoid issues with texel center precision.
- textureGatherOffset (singular) now performs textureGather with the offset applied to the coords, rather than the slower fallback where each texel is fetched individually.

* Increment shader cache version, remove unused arg

* Use base texture size for gather coord offset.

Implicit LOD for gather is not supported.

* Use 4 texture gathers for offsets emulation

Avoids issues with interpolation at cost of performance

(not sure how bad this is)

* Address Feedback
2023-10-20 15:05:09 +02:00
..
Effects Move support buffer update out of the backends (#5411) 2023-07-11 14:07:41 -03:00
MoltenVK [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
Queries Vulkan: Buffer Mirrors for MacOS performance (#4899) 2023-08-14 14:18:47 -03:00
Shaders Vulkan: Device Local and higher invocation count for buffer conversions (#5623) 2023-09-02 17:58:15 -03:00
Auto.cs Vulkan: Buffer Mirrors for MacOS performance (#4899) 2023-08-14 14:18:47 -03:00
AutoFlushCounter.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
BackgroundResources.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
BitMap.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
BitMapStruct.cs Vulkan: Buffer Mirrors for MacOS performance (#4899) 2023-08-14 14:18:47 -03:00
BufferAllocationType.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
BufferHolder.cs Replace ReaderWriterLock with ReaderWriterLockSlim (#5785) 2023-10-12 18:11:15 +02:00
BufferManager.cs Vulkan: Buffer Mirrors for MacOS performance (#4899) 2023-08-14 14:18:47 -03:00
BufferMirrorRangeList.cs Vulkan: Buffer Mirrors for MacOS performance (#4899) 2023-08-14 14:18:47 -03:00
BufferState.cs Vulkan: Buffer Mirrors for MacOS performance (#4899) 2023-08-14 14:18:47 -03:00
BufferUsageBitmap.cs Vulkan: Buffer Mirrors for MacOS performance (#4899) 2023-08-14 14:18:47 -03:00
CacheByRange.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
CommandBufferPool.cs Reduce the amount of descriptor pool allocations on Vulkan (#5673) 2023-09-26 02:00:02 +02:00
CommandBufferScoped.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
Constants.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
DescriptorSetCollection.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
DescriptorSetManager.cs Reduce the amount of descriptor pool allocations on Vulkan (#5673) 2023-09-26 02:00:02 +02:00
DescriptorSetUpdater.cs Reduce the amount of descriptor pool allocations on Vulkan (#5673) 2023-09-26 02:00:02 +02:00
DisposableBuffer.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
DisposableBufferView.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
DisposableFramebuffer.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
DisposableImage.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
DisposableImageView.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
DisposableMemory.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
DisposablePipeline.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
DisposableRenderPass.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
DisposableSampler.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
EnumConversion.cs Vulkan: Buffer Mirrors for MacOS performance (#4899) 2023-08-14 14:18:47 -03:00
FenceHelper.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
FenceHolder.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
FormatCapabilities.cs Implement scaled vertex format emulation (#5564) 2023-08-16 08:30:33 -03:00
FormatConverter.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
FormatTable.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
FramebufferParams.cs Fix some Vulkan validation errors (mostly related to barriers) (#5603) 2023-09-14 19:58:11 +02:00
HardwareCapabilities.cs Fix some Vulkan validation errors (mostly related to barriers) (#5603) 2023-09-14 19:58:11 +02:00
HashTableSlim.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
HelperShader.cs Vulkan: Device Local and higher invocation count for buffer conversions (#5623) 2023-09-02 17:58:15 -03:00
HostMemoryAllocator.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
IdList.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
IndexBufferPattern.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
IndexBufferState.cs Vulkan: Buffer Mirrors for MacOS performance (#4899) 2023-08-14 14:18:47 -03:00
MemoryAllocation.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
MemoryAllocator.cs Make Vulkan memory allocator actually thread safe (#5575) 2023-09-26 01:50:06 +02:00
MemoryAllocatorBlockList.cs Make Vulkan memory allocator actually thread safe (#5575) 2023-09-26 01:50:06 +02:00
MultiFenceHolder.cs Vulkan: Buffer Mirrors for MacOS performance (#4899) 2023-08-14 14:18:47 -03:00
NativeArray.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
PersistentFlushBuffer.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
PipelineBase.cs Fix some Vulkan validation errors (mostly related to barriers) (#5603) 2023-09-14 19:58:11 +02:00
PipelineConverter.cs Fix some Vulkan validation errors (mostly related to barriers) (#5603) 2023-09-14 19:58:11 +02:00
PipelineDynamicState.cs Fix some Vulkan validation errors (mostly related to barriers) (#5603) 2023-09-14 19:58:11 +02:00
PipelineFull.cs Implement support for masked stencil clears on Vulkan (#5589) 2023-08-18 05:25:54 +00:00
PipelineHelperShader.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
PipelineLayoutCache.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
PipelineLayoutCacheEntry.cs Reduce the amount of descriptor pool allocations on Vulkan (#5673) 2023-09-26 02:00:02 +02:00
PipelineLayoutFactory.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
PipelineState.cs Fix vote and shuffle shader instructions on AMD GPUs (#5540) 2023-08-16 21:31:07 -03:00
PipelineUid.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
ResourceBindingSegment.cs Delete ResourceAccess (#5626) 2023-09-05 22:59:21 +02:00
ResourceLayoutBuilder.cs Delete ResourceAccess (#5626) 2023-09-05 22:59:21 +02:00
Ryujinx.Graphics.Vulkan.csproj Implement support for masked stencil clears on Vulkan (#5589) 2023-08-18 05:25:54 +00:00
SamplerHolder.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
SemaphoreHolder.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
Shader.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
ShaderCollection.cs Reduce the amount of descriptor pool allocations on Vulkan (#5673) 2023-09-26 02:00:02 +02:00
SpecInfo.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
StagingBuffer.cs Vulkan: Periodically free regions of the staging buffer (#5572) 2023-08-16 23:06:46 +02:00
SyncManager.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
TextureBuffer.cs Vulkan: Buffer Mirrors for MacOS performance (#4899) 2023-08-14 14:18:47 -03:00
TextureCopy.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
TextureStorage.cs Vulkan: Fix barriers on macOS (#5700) 2023-09-23 19:32:36 -03:00
TextureView.cs Fix some Vulkan validation errors (mostly related to barriers) (#5603) 2023-09-14 19:58:11 +02:00
Vendor.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
VertexBufferState.cs Vulkan: Buffer Mirrors for MacOS performance (#4899) 2023-08-14 14:18:47 -03:00
VertexBufferUpdater.cs [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) 2023-07-01 12:31:42 +02:00
VulkanConfiguration.cs Fix some Vulkan validation errors (#5452) 2023-07-14 09:08:52 +02:00
VulkanDebugMessenger.cs Fix some Vulkan validation errors (#5452) 2023-07-14 09:08:52 +02:00
VulkanException.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
VulkanInitialization.cs Fix vote and shuffle shader instructions on AMD GPUs (#5540) 2023-08-16 21:31:07 -03:00
VulkanInstance.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
VulkanPhysicalDevice.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
VulkanRenderer.cs GPU: Add fallback when textureGatherOffsets is not supported (#5792) 2023-10-20 15:05:09 +02:00
Window.cs Fix some Vulkan validation errors (mostly related to barriers) (#5603) 2023-09-14 19:58:11 +02:00
WindowBase.cs Implement color space passthrough option (#5531) 2023-08-07 18:54:05 +01:00