2022-04-23 10:59:50 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2021-11-19 03:17:02 +01:00
|
|
|
|
|
|
|
#version 450
|
2021-11-20 06:17:01 +01:00
|
|
|
#extension GL_ARB_shader_stencil_export : require
|
2021-11-19 03:17:02 +01:00
|
|
|
|
|
|
|
layout(binding = 0) uniform sampler2D color_texture;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
ivec2 coord = ivec2(gl_FragCoord.xy);
|
2021-11-22 00:21:42 +01:00
|
|
|
uvec4 color = uvec4(texelFetch(color_texture, coord, 0).abgr * (exp2(8) - 1.0f));
|
2021-11-21 20:52:39 +01:00
|
|
|
uvec4 bytes = color << uvec4(24, 16, 8, 0);
|
|
|
|
uint depth_stencil_unorm = bytes.x | bytes.y | bytes.z | bytes.w;
|
2021-11-19 03:17:02 +01:00
|
|
|
|
2021-11-21 20:52:39 +01:00
|
|
|
gl_FragDepth = float(depth_stencil_unorm & 0x00FFFFFFu) / (exp2(24.0) - 1.0f);
|
|
|
|
gl_FragStencilRefARB = int(depth_stencil_unorm >> 24);
|
2021-11-19 03:17:02 +01:00
|
|
|
}
|