Merge pull request #92524 from ChristopheClaustre/disable_camera_effects_when_debug_draw_is_active
Disable `camera_effects` when debug draw is active
This commit is contained in:
commit
191c33301d
|
@ -423,6 +423,7 @@ void RendererSceneRenderRD::_render_buffers_post_process_and_tonemap(const Rende
|
|||
|
||||
Size2i target_size = rb->get_target_size();
|
||||
bool can_use_effects = target_size.x >= 8 && target_size.y >= 8; // FIXME I think this should check internal size, we do all our post processing at this size...
|
||||
can_use_effects &= _debug_draw_can_use_effects(debug_draw);
|
||||
bool can_use_storage = _render_buffers_can_be_storage();
|
||||
|
||||
bool use_fsr = fsr && can_use_effects && rb->get_scaling_3d_mode() == RS::VIEWPORT_SCALING_3D_MODE_FSR;
|
||||
|
@ -699,7 +700,7 @@ void RendererSceneRenderRD::_post_process_subpass(RID p_source_texture, RID p_fr
|
|||
// FIXME: Our input it our internal_texture, shouldn't this be using internal_size ??
|
||||
// Seeing we don't support FSR in our mobile renderer right now target_size = internal_size...
|
||||
Size2i target_size = rb->get_target_size();
|
||||
bool can_use_effects = target_size.x >= 8 && target_size.y >= 8;
|
||||
bool can_use_effects = target_size.x >= 8 && target_size.y >= 8 && debug_draw == RS::VIEWPORT_DEBUG_DRAW_DISABLED;
|
||||
|
||||
RD::DrawListID draw_list = RD::get_singleton()->draw_list_switch_to_next_pass();
|
||||
|
||||
|
@ -764,6 +765,56 @@ void RendererSceneRenderRD::_disable_clear_request(const RenderDataRD *p_render_
|
|||
texture_storage->render_target_disable_clear_request(p_render_data->render_buffers->get_render_target());
|
||||
}
|
||||
|
||||
bool RendererSceneRenderRD::_debug_draw_can_use_effects(RS::ViewportDebugDraw p_debug_draw) {
|
||||
bool can_use_effects = true;
|
||||
switch (p_debug_draw) {
|
||||
// No debug draw, use camera effects
|
||||
case RS::VIEWPORT_DEBUG_DRAW_DISABLED:
|
||||
can_use_effects = true;
|
||||
break;
|
||||
// Modes that completely override rendering to draw debug information should disable camera effects.
|
||||
case RS::VIEWPORT_DEBUG_DRAW_UNSHADED:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_OVERDRAW:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_WIREFRAME:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_VOXEL_GI_ALBEDO:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_CLUSTER_OMNI_LIGHTS:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_CLUSTER_SPOT_LIGHTS:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_CLUSTER_DECALS:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_CLUSTER_REFLECTION_PROBES:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_INTERNAL_BUFFER:
|
||||
can_use_effects = false;
|
||||
break;
|
||||
// Modes that draws information over part of the viewport needs camera effects because we see partially the normal draw mode.
|
||||
case RS::VIEWPORT_DEBUG_DRAW_SHADOW_ATLAS:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_DECAL_ATLAS:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_MOTION_VECTORS:
|
||||
// Modes that draws a buffer over viewport needs camera effects because if the buffer is not available it will be equivalent to normal draw mode.
|
||||
case RS::VIEWPORT_DEBUG_DRAW_NORMAL_BUFFER:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_SSAO:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_SSIL:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_SDFGI:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_GI_BUFFER:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_OCCLUDERS:
|
||||
can_use_effects = true;
|
||||
break;
|
||||
// Other debug draw modes keep camera effects.
|
||||
case RS::VIEWPORT_DEBUG_DRAW_LIGHTING:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_VOXEL_GI_LIGHTING:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_VOXEL_GI_EMISSION:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_SCENE_LUMINANCE:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_PSSM_SPLITS:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_SDFGI_PROBES:
|
||||
case RS::VIEWPORT_DEBUG_DRAW_DISABLE_LOD:
|
||||
can_use_effects = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return can_use_effects;
|
||||
}
|
||||
|
||||
void RendererSceneRenderRD::_render_buffers_debug_draw(const RenderDataRD *p_render_data) {
|
||||
RendererRD::LightStorage *light_storage = RendererRD::LightStorage::get_singleton();
|
||||
RendererRD::TextureStorage *texture_storage = RendererRD::TextureStorage::get_singleton();
|
||||
|
|
|
@ -117,6 +117,7 @@ protected:
|
|||
RendererRD::GI gi;
|
||||
|
||||
virtual void _update_shader_quality_settings() {}
|
||||
static bool _debug_draw_can_use_effects(RS::ViewportDebugDraw p_debug_draw);
|
||||
|
||||
private:
|
||||
RS::ViewportDebugDraw debug_draw = RS::VIEWPORT_DEBUG_DRAW_DISABLED;
|
||||
|
|
Loading…
Reference in New Issue