diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2023-02-21 19:21:57 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-21 19:21:57 -0300 |
| commit | c3a5716a95ea93cba9488189fb36d594db5083bc (patch) | |
| tree | de4a15d2b88bf069193c30f09f19bd7ab139135a /Ryujinx.Graphics.Vulkan/Shaders/ColorCopyWideningComputeShaderSource.comp | |
| parent | 1f1e2a7f03aad988cb04045eee18a360a807d13f (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/ColorCopyWideningComputeShaderSource.comp')
| -rw-r--r-- | Ryujinx.Graphics.Vulkan/Shaders/ColorCopyWideningComputeShaderSource.comp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Vulkan/Shaders/ColorCopyWideningComputeShaderSource.comp b/Ryujinx.Graphics.Vulkan/Shaders/ColorCopyWideningComputeShaderSource.comp new file mode 100644 index 00000000..a9be454f --- /dev/null +++ b/Ryujinx.Graphics.Vulkan/Shaders/ColorCopyWideningComputeShaderSource.comp @@ -0,0 +1,31 @@ +#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 imageSz = imageSize(dst); + + if (int(coords.x) >= imageSz.x || int(coords.y) >= imageSz.y) + { + return; + } + + uvec2 srcCoords = uvec2(coords.x << ratio, coords.y); + + uint r = texelFetchOffset(src, ivec2(srcCoords), 0, ivec2(0, 0)).r; + uint g = texelFetchOffset(src, ivec2(srcCoords), 0, ivec2(1, 0)).r; + uint b = texelFetchOffset(src, ivec2(srcCoords), 0, ivec2(2, 0)).r; + uint a = texelFetchOffset(src, ivec2(srcCoords), 0, ivec2(3, 0)).r; + + imageStore(dst, ivec2(coords), uvec4(r, g, b, a)); +}
\ No newline at end of file |
