summaryrefslogtreecommitdiff
path: root/servers/rendering
diff options
context:
space:
mode:
authorBastiaan Olij <mux213@gmail.com>2023-03-31 11:28:53 +1100
committerRĂ©mi Verschelde <rverschelde@gmail.com>2023-05-12 12:07:01 +0200
commita5cb7a5eb5134957ccc9bff5b6a2f78aa54078d6 (patch)
tree4b431964a325f41acaade7bd1fc85fe10f9a4e87 /servers/rendering
parent0277f57b6fdeafb18478bd404b8c2610bedc60d1 (diff)
Expose viewports render targer RID
(cherry picked from commit ab60d3b65ce990a44fe595ec0860c0ae9ce9358d)
Diffstat (limited to 'servers/rendering')
-rw-r--r--servers/rendering/renderer_viewport.cpp7
-rw-r--r--servers/rendering/renderer_viewport.h1
-rw-r--r--servers/rendering/rendering_server_default.h1
3 files changed, 9 insertions, 0 deletions
diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp
index f609fa6023..8813c2e651 100644
--- a/servers/rendering/renderer_viewport.cpp
+++ b/servers/rendering/renderer_viewport.cpp
@@ -962,6 +962,13 @@ void RendererViewport::viewport_set_update_mode(RID p_viewport, RS::ViewportUpda
viewport->update_mode = p_mode;
}
+RID RendererViewport::viewport_get_render_target(RID p_viewport) const {
+ const Viewport *viewport = viewport_owner.get_or_null(p_viewport);
+ ERR_FAIL_COND_V(!viewport, RID());
+
+ return viewport->render_target;
+}
+
RID RendererViewport::viewport_get_texture(RID p_viewport) const {
const Viewport *viewport = viewport_owner.get_or_null(p_viewport);
ERR_FAIL_COND_V(!viewport, RID());
diff --git a/servers/rendering/renderer_viewport.h b/servers/rendering/renderer_viewport.h
index c24275de6e..2f9537a47c 100644
--- a/servers/rendering/renderer_viewport.h
+++ b/servers/rendering/renderer_viewport.h
@@ -231,6 +231,7 @@ public:
void viewport_set_clear_mode(RID p_viewport, RS::ViewportClearMode p_clear_mode);
+ RID viewport_get_render_target(RID p_viewport) const;
RID viewport_get_texture(RID p_viewport) const;
RID viewport_get_occluder_debug_texture(RID p_viewport) const;
diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h
index a3bdf7d146..3e30ae0313 100644
--- a/servers/rendering/rendering_server_default.h
+++ b/servers/rendering/rendering_server_default.h
@@ -606,6 +606,7 @@ public:
FUNC2(viewport_set_update_mode, RID, ViewportUpdateMode)
+ FUNC1RC(RID, viewport_get_render_target, RID)
FUNC1RC(RID, viewport_get_texture, RID)
FUNC2(viewport_set_disable_2d, RID, bool)