mirror of
https://github.com/godotengine/godot.git
synced 2024-11-25 13:43:15 +00:00
Merge pull request #68212 from dsnopek/rt-override-one-method
Collapse three seperate texture storage methods into render_target_set_override()
This commit is contained in:
commit
c1fd7a0c8b
@ -593,11 +593,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;
|
||||
|
@ -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(); }
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user