summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2022-11-03 08:47:28 -0500
committerDavid Snopek <dsnopek@gmail.com>2022-11-03 13:03:30 -0500
commit7fb8b931d7547fe1f02febc9cca636ef187d2942 (patch)
tree922df3a645c87ee6fb6aa09b23e9db1cfd1404fb /servers
parentc0de8d32d51d579e6dc1a5aac3fbcd6c7104eb61 (diff)
Collapse three seperate texture storage methods into render_target_set_override()
Diffstat (limited to 'servers')
-rw-r--r--servers/rendering/dummy/storage/texture_storage.h4
-rw-r--r--servers/rendering/renderer_rd/storage_rd/texture_storage.cpp20
-rw-r--r--servers/rendering/renderer_rd/storage_rd/texture_storage.h4
-rw-r--r--servers/rendering/renderer_viewport.cpp11
-rw-r--r--servers/rendering/storage/texture_storage.h4
5 files changed, 12 insertions, 31 deletions
diff --git a/servers/rendering/dummy/storage/texture_storage.h b/servers/rendering/dummy/storage/texture_storage.h
index 98acd5ad74..ad28dd68c3 100644
--- a/servers/rendering/dummy/storage/texture_storage.h
+++ b/servers/rendering/dummy/storage/texture_storage.h
@@ -184,11 +184,9 @@ public:
virtual void render_target_set_vrs_texture(RID p_render_target, RID p_texture) override {}
virtual RID render_target_get_vrs_texture(RID p_render_target) const override { return RID(); }
- virtual void render_target_set_override_color(RID p_render_target, RID p_texture) override {}
+ virtual void render_target_set_override(RID p_render_target, RID p_color_texture, RID p_depth_texture, RID p_velocity_texture) override {}
virtual RID render_target_get_override_color(RID p_render_target) const override { return RID(); }
- virtual void render_target_set_override_depth(RID p_render_target, RID p_texture) override {}
virtual RID render_target_get_override_depth(RID p_render_target) const override { return RID(); }
- virtual void render_target_set_override_velocity(RID p_render_target, RID p_texture) override {}
virtual RID render_target_get_override_velocity(RID p_render_target) const override { return RID(); }
virtual RID render_target_get_texture(RID p_render_target) override { return RID(); }
diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp
index bc70c57b69..3785c3899b 100644
--- a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp
@@ -2594,11 +2594,13 @@ RID TextureStorage::render_target_get_texture(RID p_render_target) {
return rt->texture;
}
-void TextureStorage::render_target_set_override_color(RID p_render_target, RID p_texture) {
+void TextureStorage::render_target_set_override(RID p_render_target, RID p_color_texture, RID p_depth_texture, RID p_velocity_texture) {
RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
ERR_FAIL_COND(!rt);
- rt->overridden.color = p_texture;
+ rt->overridden.color = p_color_texture;
+ rt->overridden.depth = p_depth_texture;
+ rt->overridden.velocity = p_velocity_texture;
}
RID TextureStorage::render_target_get_override_color(RID p_render_target) const {
@@ -2608,13 +2610,6 @@ RID TextureStorage::render_target_get_override_color(RID p_render_target) const
return rt->overridden.color;
}
-void TextureStorage::render_target_set_override_depth(RID p_render_target, RID p_texture) {
- RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
- ERR_FAIL_COND(!rt);
-
- rt->overridden.depth = p_texture;
-}
-
RID TextureStorage::render_target_get_override_depth(RID p_render_target) const {
RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
ERR_FAIL_COND_V(!rt, RID());
@@ -2641,13 +2636,6 @@ RID TextureStorage::render_target_get_override_depth_slice(RID p_render_target,
}
}
-void TextureStorage::render_target_set_override_velocity(RID p_render_target, RID p_texture) {
- RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
- ERR_FAIL_COND(!rt);
-
- rt->overridden.velocity = p_texture;
-}
-
RID TextureStorage::render_target_get_override_velocity(RID p_render_target) const {
RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
ERR_FAIL_COND_V(!rt, RID());
diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.h b/servers/rendering/renderer_rd/storage_rd/texture_storage.h
index 00b4e50737..72d4c90159 100644
--- a/servers/rendering/renderer_rd/storage_rd/texture_storage.h
+++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.h
@@ -718,12 +718,10 @@ public:
virtual void render_target_set_vrs_texture(RID p_render_target, RID p_texture) override;
virtual RID render_target_get_vrs_texture(RID p_render_target) const override;
- virtual void render_target_set_override_color(RID p_render_target, RID p_texture) override;
+ virtual void render_target_set_override(RID p_render_target, RID p_color_texture, RID p_depth_texture, RID p_velocity_texture) override;
virtual RID render_target_get_override_color(RID p_render_target) const override;
- virtual void render_target_set_override_depth(RID p_render_target, RID p_texture) override;
virtual RID render_target_get_override_depth(RID p_render_target) const override;
RID render_target_get_override_depth_slice(RID p_render_target, const uint32_t p_layer) const;
- virtual void render_target_set_override_velocity(RID p_render_target, RID p_texture) override;
virtual RID render_target_get_override_velocity(RID p_render_target) const override;
RID render_target_get_override_velocity_slice(RID p_render_target, const uint32_t p_layer) const;
diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp
index f887264696..2836889de5 100644
--- a/servers/rendering/renderer_viewport.cpp
+++ b/servers/rendering/renderer_viewport.cpp
@@ -669,9 +669,10 @@ void RendererViewport::draw_viewports() {
// This usually is a result of the player taking off their headset and OpenXR telling us to skip
// rendering frames.
if (xr_interface->pre_draw_viewport(vp->render_target)) {
- RSG::texture_storage->render_target_set_override_color(vp->render_target, xr_interface->get_color_texture());
- RSG::texture_storage->render_target_set_override_depth(vp->render_target, xr_interface->get_depth_texture());
- RSG::texture_storage->render_target_set_override_velocity(vp->render_target, xr_interface->get_velocity_texture());
+ RSG::texture_storage->render_target_set_override(vp->render_target,
+ xr_interface->get_color_texture(),
+ xr_interface->get_depth_texture(),
+ xr_interface->get_velocity_texture());
// render...
RSG::scene->set_debug_draw_mode(vp->debug_draw);
@@ -699,9 +700,7 @@ void RendererViewport::draw_viewports() {
}
}
} else {
- RSG::texture_storage->render_target_set_override_color(vp->render_target, RID()); // TODO if fullscreen output, we can set this to our texture chain
- RSG::texture_storage->render_target_set_override_depth(vp->render_target, RID());
- RSG::texture_storage->render_target_set_override_velocity(vp->render_target, RID());
+ RSG::texture_storage->render_target_set_override(vp->render_target, RID(), RID(), RID());
RSG::scene->set_debug_draw_mode(vp->debug_draw);
diff --git a/servers/rendering/storage/texture_storage.h b/servers/rendering/storage/texture_storage.h
index 635f44786c..3207181471 100644
--- a/servers/rendering/storage/texture_storage.h
+++ b/servers/rendering/storage/texture_storage.h
@@ -160,11 +160,9 @@ public:
virtual RID render_target_get_vrs_texture(RID p_render_target) const = 0;
// override color, depth and velocity buffers (depth and velocity only for 3D)
- virtual void render_target_set_override_color(RID p_render_target, RID p_texture) = 0;
+ virtual void render_target_set_override(RID p_render_target, RID p_color_texture, RID p_depth_texture, RID p_velocity_texture) = 0;
virtual RID render_target_get_override_color(RID p_render_target) const = 0;
- virtual void render_target_set_override_depth(RID p_render_target, RID p_texture) = 0;
virtual RID render_target_get_override_depth(RID p_render_target) const = 0;
- virtual void render_target_set_override_velocity(RID p_render_target, RID p_texture) = 0;
virtual RID render_target_get_override_velocity(RID p_render_target) const = 0;
// get textures