aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Vulkan/Shaders/ColorCopyShorteningComputeShaderSource.comp
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-02-21 19:21:57 -0300
committerGitHub <noreply@github.com>2023-02-21 19:21:57 -0300
commitc3a5716a95ea93cba9488189fb36d594db5083bc (patch)
treede4a15d2b88bf069193c30f09f19bd7ab139135a /Ryujinx.Graphics.Vulkan/Shaders/ColorCopyShorteningComputeShaderSource.comp
parent1f1e2a7f03aad988cb04045eee18a360a807d13f (diff)
Add copy dependency for some incompatible texture formats (#4380)
* Add copy dependency for some incompatible texture formats * Simplify compatibility check
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/Shaders/ColorCopyShorteningComputeShaderSource.comp')
-rw-r--r--Ryujinx.Graphics.Vulkan/Shaders/ColorCopyShorteningComputeShaderSource.comp36
1 files changed, 36 insertions, 0 deletions
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