Fix: Viewport Compositor depth has low precision

The depth pass of the Viewport Compositor has low precision if the
precision of the node tree is set to Auto. To fix this, we always
expose the depth pass in full precision.
This commit is contained in:
Omar Emara
2024-03-08 11:55:23 +02:00
parent e0c6db81ea
commit 8cf8b54332
@@ -762,6 +762,11 @@ class RenderLayerOperation : public NodeOperation {
const int input_unit = GPU_shader_get_sampler_binding(shader, "input_tx");
GPU_texture_bind(pass_texture, input_unit);
/* Depth passes always need to be stored in full precision. */
if (GPU_texture_has_depth_format(pass_texture)) {
result.set_precision(ResultPrecision::Full);
}
const int2 compositing_region_size = context().get_compositing_region_size();
result.allocate_texture(Domain(compositing_region_size));
result.bind_as_image(shader, "output_img");