Skip to content

Commit

Permalink
fix(state): ignore all null render targets
Browse files Browse the repository at this point in the history
  • Loading branch information
clshortfuse committed Jan 5, 2025
1 parent 56d09d2 commit ec3ed1c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/utils/state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#pragma once

#include <algorithm>
#include <include/reshade.hpp>
#include <memory>
#include <optional>
Expand All @@ -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<uint32_t>(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<uint32_t>(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) {
Expand Down

0 comments on commit ec3ed1c

Please sign in to comment.