Reset recording renderer state on clear

This commit is contained in:
2026-06-02 17:53:17 +02:00
parent 9b00acec6f
commit 860e5ad31e
5 changed files with 70 additions and 4 deletions

View File

@@ -594,6 +594,15 @@ bool RecordingCommandContext::in_render_pass() const noexcept
return in_render_pass_;
}
void RecordingCommandContext::reset() noexcept
{
active_target_ = TextureDesc {};
active_mesh_ = MeshDesc {};
in_render_pass_ = false;
shader_bound_ = false;
mesh_bound_ = false;
}
RecordingRenderTrace::RecordingRenderTrace(std::vector<RecordedRenderCommand>& commands) noexcept
: commands_(&commands)
{
@@ -643,6 +652,11 @@ pp::foundation::Status RecordingRenderTrace::end_scope() noexcept
return pp::foundation::Status::success();
}
void RecordingRenderTrace::reset() noexcept
{
scope_depth_ = 0U;
}
RecordingRenderDevice::RecordingRenderDevice() noexcept
: context_(commands_)
, trace_(commands_)
@@ -757,6 +771,8 @@ std::span<const RecordedRenderCommand> RecordingRenderDevice::commands() const n
void RecordingRenderDevice::clear() noexcept
{
commands_.clear();
context_.reset();
trace_.reset();
}
const char* recorded_render_command_kind_name(RecordedRenderCommandKind kind) noexcept

View File

@@ -172,6 +172,7 @@ public:
void end_render_pass() noexcept override;
[[nodiscard]] bool in_render_pass() const noexcept;
void reset() noexcept;
private:
std::vector<RecordedRenderCommand>* commands_ = nullptr;
@@ -188,6 +189,7 @@ public:
[[nodiscard]] pp::foundation::Status marker(const char* component, const char* name) noexcept override;
[[nodiscard]] pp::foundation::Status begin_scope(const char* component, const char* name) noexcept override;
[[nodiscard]] pp::foundation::Status end_scope() noexcept override;
void reset() noexcept;
private:
std::vector<RecordedRenderCommand>* commands_ = nullptr;