Fix: Vulkan: Incorrect Depth Retargetting
Vulkan has different depth limits then opengl. We fix this by retargetting the opengl limits into the limits that vulkan supports. This is done in the vertex shader, or in the geometry shader. When viewport index or layer isn't supported a geometry shader is added to workaround these missing features. In this case the depth range was could be done twice (vertex shader and geometry shader). Pull Request: https://projects.blender.org/blender/blender/pulls/126634
This commit is contained in:
@@ -883,7 +883,11 @@ std::string VKShader::vertex_interface_declare(const shader::ShaderCreateInfo &i
|
||||
|
||||
/* Retarget depth from -1..1 to 0..1. This will be done by geometry stage, when geometry shaders
|
||||
* are used. */
|
||||
const bool has_geometry_stage = bool(info.builtins_ & BuiltinBits::BARYCENTRIC_COORD) ||
|
||||
const bool has_geometry_stage = bool(info.builtins_ & (BuiltinBits::BARYCENTRIC_COORD)) ||
|
||||
(bool(info.builtins_ & (BuiltinBits::LAYER)) &&
|
||||
workarounds.shader_output_layer) ||
|
||||
(bool(info.builtins_ & (BuiltinBits::VIEWPORT_INDEX)) &&
|
||||
workarounds.shader_output_viewport_index) ||
|
||||
!info.geometry_source_.is_empty();
|
||||
const bool retarget_depth = !has_geometry_stage;
|
||||
if (retarget_depth) {
|
||||
|
||||
Reference in New Issue
Block a user