summaryrefslogtreecommitdiffstats
path: root/servers/rendering/renderer_viewport.cpp
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2023-08-03 14:10:01 +0200
committerclayjohn <claynjohn@gmail.com>2023-08-07 11:24:03 +0200
commit57eb762bae0a24a4fb33e825e57f1e100bd9d354 (patch)
treea8891dd7b4f5c95d39b947bb22360754f362c2a0 /servers/rendering/renderer_viewport.cpp
parent237bd0a615df8a0e57bc3d299894abece7b43a0c (diff)
downloadredot-engine-57eb762bae0a24a4fb33e825e57f1e100bd9d354.tar.gz
Add option to enable HDR rendering in 2D
This is needed to allow 2D to fully make use of 3D effects (e.g. glow), and can be used to substantially improve quality of 2D rendering at the cost of performance Additionally, the 2D rendering pipeline is done in linear space (we skip linear_to_srgb conversion in 3D tonemapping) so the entire Viewport can be kept linear. This is necessary for proper HDR screen support in the future.
Diffstat (limited to 'servers/rendering/renderer_viewport.cpp')
-rw-r--r--servers/rendering/renderer_viewport.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp
index 7a829826d2..75371de814 100644
--- a/servers/rendering/renderer_viewport.cpp
+++ b/servers/rendering/renderer_viewport.cpp
@@ -1163,6 +1163,17 @@ void RendererViewport::viewport_set_msaa_3d(RID p_viewport, RS::ViewportMSAA p_m
_configure_3d_render_buffers(viewport);
}
+void RendererViewport::viewport_set_use_hdr_2d(RID p_viewport, bool p_use_hdr_2d) {
+ Viewport *viewport = viewport_owner.get_or_null(p_viewport);
+ ERR_FAIL_COND(!viewport);
+
+ if (viewport->use_hdr_2d == p_use_hdr_2d) {
+ return;
+ }
+ viewport->use_hdr_2d = p_use_hdr_2d;
+ RSG::texture_storage->render_target_set_use_hdr(viewport->render_target, p_use_hdr_2d);
+}
+
void RendererViewport::viewport_set_screen_space_aa(RID p_viewport, RS::ViewportScreenSpaceAA p_mode) {
Viewport *viewport = viewport_owner.get_or_null(p_viewport);
ERR_FAIL_COND(!viewport);