1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00
OpenDX/src/dxvk/shaders/dxvk_unpack_d24s8.comp
2019-03-26 16:05:27 +01:00

36 lines
1.0 KiB
Plaintext

#version 450
layout(
local_size_x = 64,
local_size_y = 1,
local_size_z = 1) in;
layout(binding = 0, r32ui) writeonly uniform uimageBuffer u_depth;
layout(binding = 1, r8ui) writeonly uniform uimageBuffer u_stencil;
layout(binding = 2)
readonly buffer s_buffer_t {
uint data[];
} s_buffer;
layout(push_constant)
uniform u_info_t {
uvec2 dst_extent;
uvec2 src_extent;
} u_info;
void main() {
if (all(lessThan(gl_GlobalInvocationID.xy, u_info.dst_extent))) {
uint src_index = gl_GlobalInvocationID.x
+ gl_GlobalInvocationID.y * u_info.src_extent.x
+ gl_GlobalInvocationID.z * u_info.src_extent.y;
uint dst_index = gl_GlobalInvocationID.x
+ gl_GlobalInvocationID.y * u_info.dst_extent.x
+ gl_GlobalInvocationID.z * u_info.dst_extent.y;
uint src_data = s_buffer.data[src_index];
imageStore(u_depth, int(dst_index), uvec4(src_data & 0xFFFFFF));
imageStore(u_stencil, int(dst_index), uvec4(src_data >> 24));
}
}