From c3a5716a95ea93cba9488189fb36d594db5083bc Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 21 Feb 2023 19:21:57 -0300 Subject: Add copy dependency for some incompatible texture formats (#4380) * Add copy dependency for some incompatible texture formats * Simplify compatibility check --- .../ColorCopyShorteningComputeShaderSource.comp | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Ryujinx.Graphics.Vulkan/Shaders/ColorCopyShorteningComputeShaderSource.comp (limited to 'Ryujinx.Graphics.Vulkan/Shaders/ColorCopyShorteningComputeShaderSource.comp') diff --git a/Ryujinx.Graphics.Vulkan/Shaders/ColorCopyShorteningComputeShaderSource.comp b/Ryujinx.Graphics.Vulkan/Shaders/ColorCopyShorteningComputeShaderSource.comp new file mode 100644 index 00000000..78cc1cc6 --- /dev/null +++ b/Ryujinx.Graphics.Vulkan/Shaders/ColorCopyShorteningComputeShaderSource.comp @@ -0,0 +1,36 @@ +#version 450 core + +layout (std140, binding = 0) uniform ratio_in +{ + int ratio; +}; + +layout (set = 2, binding = 0) uniform usampler2D src; +layout (set = 3, binding = 0) writeonly uniform uimage2D dst; + +layout (local_size_x = 32, local_size_y = 32, local_size_z = 1) in; + +void main() +{ + uvec2 coords = gl_GlobalInvocationID.xy; + ivec2 textureSz = textureSize(src, 0); + + if (int(coords.x) >= textureSz.x || int(coords.y) >= textureSz.y) + { + return; + } + + uint coordsShifted = coords.x << ratio; + + uvec2 dstCoords0 = uvec2(coordsShifted, coords.y); + uvec2 dstCoords1 = uvec2(coordsShifted + 1, coords.y); + uvec2 dstCoords2 = uvec2(coordsShifted + 2, coords.y); + uvec2 dstCoords3 = uvec2(coordsShifted + 3, coords.y); + + uvec4 rgba = texelFetch(src, ivec2(coords), 0); + + imageStore(dst, ivec2(dstCoords0), rgba.rrrr); + imageStore(dst, ivec2(dstCoords1), rgba.gggg); + imageStore(dst, ivec2(dstCoords2), rgba.bbbb); + imageStore(dst, ivec2(dstCoords3), rgba.aaaa); +} \ No newline at end of file -- cgit v1.2.3