Add debug markers to render passes.

This commit is contained in:
Chinmay Garde
2021-06-20 03:19:22 -07:00
committed by Dan Field
parent c23d48d7a5
commit d4377191ed
5 changed files with 13 additions and 1 deletions

View File

@@ -6,6 +6,7 @@
#include <map>
#include <memory>
#include <string>
#include "flutter/fml/macros.h"
#include "impeller/compositor/buffer_view.h"
@@ -28,6 +29,7 @@ struct Command {
Bindings fragment_bindings;
BufferView index_buffer;
size_t index_count = 0u;
std::string label;
constexpr operator bool() const { return pipeline && pipeline->IsValid(); }
};

View File

@@ -4,6 +4,7 @@
#pragma once
#include <algorithm>
#include <memory>
#include <type_traits>

View File

@@ -102,7 +102,7 @@ bool HostBuffer::Reserve(size_t reserved) {
// If new length is zero, a minimum non-zero sized allocation is returned.
// So this check will not trip and this routine will indicate success as
// expected.
FML_LOG(ERROR) << "Allocation failed. Out of memory.";
FML_LOG(ERROR) << "Allocation failed. Out of host memory.";
return false;
}

View File

@@ -216,7 +216,15 @@ bool RenderPass::EncodeCommands(Allocator& allocator,
}
return true;
};
fml::closure pop_debug_marker = [pass]() { [pass popDebugGroup]; };
for (const auto& command : commands_) {
fml::ScopedCleanupClosure auto_pop_debug_marker(pop_debug_marker);
if (!command.label.empty()) {
[pass pushDebugGroup:@(command.label.c_str())];
} else {
auto_pop_debug_marker.Release();
}
[pass setRenderPipelineState:command.pipeline->GetMTLRenderPipelineState()];
[pass setDepthStencilState:command.pipeline->GetMTLDepthStencilState()];
[pass setFrontFacingWinding:MTLWindingClockwise];

View File

@@ -47,6 +47,7 @@ bool EntityRenderer::OnRender(RenderPass& pass) {
});
Command cmd;
cmd.label = "Simple Box";
cmd.pipeline = box_primitive_->GetPipeline();
cmd.vertex_bindings
.buffers[shader::BoxVertexInfo::kUniformUniformBuffer.location] =