aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Vulkan/Shaders/ColorCopyWideningComputeShaderSource.comp
blob: a9be454fab48475a22b16b9a9231447a2c85c316 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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));
}