Add debug markers to render passes.
This commit is contained in:
@@ -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(); }
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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] =
|
||||
|
||||
Reference in New Issue
Block a user