Blender
V5.3
source
blender
draw
engines
eevee
shaders
eevee_reverse_z_lib.bsl.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2022-2023 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
5
#pragma once
6
13
#include "
gpu_shader_compat.hh
"
14
15
namespace
reverse_z
{
16
17
/* Needs to be called at the end of the vertex entry point function. */
18
float4
transform
(
float4
hs_position)
19
{
20
/* Remapping from -1..1 to 1..-1. The scaling to 0..1 is handled by the backend. */
21
hs_position.
z
= -hs_position.
z
;
22
return
hs_position;
23
}
24
25
/* Needs to be called for every depth buffer read, but not for the HiZ.
26
* The HiZ buffer is already reversed back before downsample. */
27
template
<
typename
T>
T
read
(
T
depth_buffer_value)
28
{
29
/* Remapping from 0..1 to 1..0. The scaling to 0..1 is handled as normal by drw_screen_to_ndc. */
30
return
1.0f - depth_buffer_value;
31
}
32
template
float
read<float>
(
float
);
33
template
float4
read<float4>
(
float4
);
34
35
}
// namespace reverse_z
gpu_shader_compat.hh
T
#define T
Definition
mball_tessellate.cc:277
reverse_z
Definition
eevee_reverse_z_lib.bsl.hh:15
reverse_z::read
T read(T depth_buffer_value)
Definition
eevee_reverse_z_lib.bsl.hh:27
reverse_z::transform
float4 transform(float4 hs_position)
Definition
eevee_reverse_z_lib.bsl.hh:18
float4
Definition
sky_math.h:224
float4::z
float z
Definition
sky_math.h:225
Generated on
for Blender by
doxygen
1.18.0