diff --git a/src/utils/state.hpp b/src/utils/state.hpp index 3d3dc50f..6f5a4807 100644 --- a/src/utils/state.hpp +++ b/src/utils/state.hpp @@ -5,6 +5,7 @@ #pragma once +#include #include #include #include @@ -28,7 +29,17 @@ struct CommandListState { void Apply(reshade::api::command_list* cmd_list) const { if (!render_targets.empty() || depth_stencil != 0) { - cmd_list->bind_render_targets_and_depth_stencil(static_cast(render_targets.size()), render_targets.data(), depth_stencil); + bool has_rtv = std::ranges::any_of(render_targets, [](auto rtv) { + return rtv.handle != 0u; + }); + if (has_rtv) { + cmd_list->bind_render_targets_and_depth_stencil( + static_cast(render_targets.size()), + render_targets.data(), + depth_stencil); + } else if (depth_stencil != 0) { + cmd_list->bind_render_targets_and_depth_stencil(0, nullptr, depth_stencil); + } } for (const auto& [stages, pipeline] : pipelines) {