Skip to content

Commit 267d10b

Browse files
committed
Make it possible to prevent effect rendering altogether by calling "render_effects" with no render target view
1 parent 0c246da commit 267d10b

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

source/runtime.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -3364,27 +3364,15 @@ void reshade::runtime::update_effects()
33643364
void reshade::runtime::render_effects(api::command_list *cmd_list, api::resource_view rtv, api::resource_view rtv_srgb)
33653365
{
33663366
// Cannot render effects twice in a frame or while they are still loading
3367-
if (is_loading() || _effects_rendered_this_frame || rtv == 0)
3367+
if (is_loading() || _effects_rendered_this_frame)
33683368
return;
33693369

33703370
_effects_rendered_this_frame = true;
33713371

3372-
if (rtv_srgb == 0)
3373-
rtv_srgb = rtv;
3374-
33753372
// Nothing to do here if effects are disabled globally
33763373
if (!_effects_enabled || _techniques.empty())
33773374
return;
33783375

3379-
const api::resource back_buffer_resource = _device->get_resource_from_view(rtv);
3380-
3381-
#if RESHADE_ADDON
3382-
// Ensure format of the effect color resource matches that of the input back buffer resource (so that the copy to the effect color resource succeeds)
3383-
// TODO: Technically would need to recompile effects as well to update 'BUFFER_COLOR_BIT_DEPTH' etc.
3384-
if (!_is_in_present_call && !update_effect_color_tex(_device->get_resource_desc(back_buffer_resource).texture.format))
3385-
return;
3386-
#endif
3387-
33883376
#ifdef NDEBUG
33893377
// Lock input so it cannot be modified by other threads while we are reading it here
33903378
// TODO: This does not catch input happening between now and 'on_present'
@@ -3613,7 +3601,19 @@ void reshade::runtime::render_effects(api::command_list *cmd_list, api::resource
36133601
}
36143602
}
36153603

3604+
if (rtv == 0)
3605+
return;
3606+
if (rtv_srgb == 0)
3607+
rtv_srgb = rtv;
3608+
3609+
const api::resource back_buffer_resource = _device->get_resource_from_view(rtv);
3610+
36163611
#if RESHADE_ADDON
3612+
// Ensure format of the effect color resource matches that of the input back buffer resource (so that the copy to the effect color resource succeeds)
3613+
// TODO: Technically would need to recompile effects as well to update 'BUFFER_COLOR_BIT_DEPTH' etc.
3614+
if (!_is_in_present_call && !update_effect_color_tex(_device->get_resource_desc(back_buffer_resource).texture.format))
3615+
return;
3616+
36173617
invoke_addon_event<addon_event::reshade_begin_effects>(this, cmd_list, rtv, rtv_srgb);
36183618
#endif
36193619

0 commit comments

Comments
 (0)