// Copyright 2023 Citra Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. #version 450 core layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; layout(binding = 0) uniform highp sampler2D depth; layout(binding = 1) uniform lowp usampler2D stencil; layout(binding = 2) writeonly buffer OutputBuffer{ uint pixels[]; } staging; layout(push_constant, std140) uniform ComputeInfo { mediump ivec2 src_offset; mediump ivec2 dst_offset; mediump ivec2 extent; }; void main() { ivec2 rect = ivec2(gl_NumWorkGroups.xy) * ivec2(8); ivec2 dst_coord = ivec2(gl_GlobalInvocationID.xy); ivec2 tex_icoord = src_offset + dst_coord; highp vec2 tex_coord = vec2(tex_icoord) / vec2(extent); highp uint depth_val = uint(texture(depth, tex_coord).x * (exp2(24.0) - 1.0)); lowp uint stencil_val = texture(stencil, tex_coord).x; highp uint value = stencil_val | (depth_val << 8); staging.pixels[dst_coord.y * rect.x + dst_coord.x] = value; }