[Impeller] Conditionally set command debug info. (flutter/engine#44274)
If IMPELLER_DEBUG is not defined (release mode), then remove the cmd label strings and additional encoding debug info.
This commit is contained in:
@@ -330,7 +330,7 @@ bool AtlasTextureContents::Render(const ContentContext& renderer,
|
||||
}
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "AtlasTexture";
|
||||
DEBUG_COMMAND_INFO(cmd, "AtlasTexture");
|
||||
|
||||
auto& host_buffer = pass.GetTransientsBuffer();
|
||||
|
||||
@@ -418,7 +418,7 @@ bool AtlasColorContents::Render(const ContentContext& renderer,
|
||||
}
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "AtlasColors";
|
||||
DEBUG_COMMAND_INFO(cmd, "AtlasColors");
|
||||
|
||||
auto& host_buffer = pass.GetTransientsBuffer();
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ bool CheckerboardContents::Render(const ContentContext& renderer,
|
||||
using FS = CheckerboardPipeline::FragmentShader;
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Checkerboard";
|
||||
DEBUG_COMMAND_INFO(cmd, "Checkerboard");
|
||||
|
||||
auto options = OptionsFromPass(pass);
|
||||
options.blend_mode = BlendMode::kSourceOver;
|
||||
|
||||
@@ -93,7 +93,7 @@ bool ClipContents::Render(const ContentContext& renderer,
|
||||
|
||||
if (clip_op_ == Entity::ClipOperation::kDifference) {
|
||||
{
|
||||
cmd.label = "Difference Clip (Increment)";
|
||||
DEBUG_COMMAND_INFO(cmd, "Difference Clip (Increment)");
|
||||
|
||||
auto points = Rect(Size(pass.GetRenderTargetSize())).GetPoints();
|
||||
auto vertices =
|
||||
@@ -111,14 +111,14 @@ bool ClipContents::Render(const ContentContext& renderer,
|
||||
}
|
||||
|
||||
{
|
||||
cmd.label = "Difference Clip (Punch)";
|
||||
DEBUG_COMMAND_INFO(cmd, "Difference Clip (Punch)");
|
||||
|
||||
cmd.stencil_reference = entity.GetStencilDepth() + 1;
|
||||
options.stencil_compare = CompareFunction::kEqual;
|
||||
options.stencil_operation = StencilOperation::kDecrementClamp;
|
||||
}
|
||||
} else {
|
||||
cmd.label = "Intersect Clip";
|
||||
DEBUG_COMMAND_INFO(cmd, "Intersect Clip");
|
||||
options.stencil_compare = CompareFunction::kEqual;
|
||||
options.stencil_operation = StencilOperation::kIncrementClamp;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ bool ClipRestoreContents::Render(const ContentContext& renderer,
|
||||
using VS = ClipPipeline::VertexShader;
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Restore Clip";
|
||||
DEBUG_COMMAND_INFO(cmd, "Restore Clip");
|
||||
auto options = OptionsFromPass(pass);
|
||||
options.blend_mode = BlendMode::kDestination;
|
||||
options.stencil_compare = CompareFunction::kLess;
|
||||
|
||||
@@ -99,7 +99,7 @@ bool ConicalGradientContents::RenderSSBO(const ContentContext& renderer,
|
||||
frame_info.matrix = GetInverseEffectTransform();
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "ConicalGradientSSBOFill";
|
||||
DEBUG_COMMAND_INFO(cmd, "ConicalGradientSSBOFill");
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
auto geometry_result =
|
||||
@@ -167,7 +167,7 @@ bool ConicalGradientContents::RenderTexture(const ContentContext& renderer,
|
||||
frame_info.matrix = GetInverseEffectTransform();
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "ConicalGradientFill";
|
||||
DEBUG_COMMAND_INFO(cmd, "ConicalGradientFill");
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
auto options = OptionsFromPassAndEntity(pass, entity);
|
||||
|
||||
@@ -132,8 +132,8 @@ static std::optional<Entity> AdvancedBlend(
|
||||
std::invoke(pipeline_proc, renderer, options);
|
||||
|
||||
Command cmd;
|
||||
cmd.label =
|
||||
SPrintF("Advanced Blend Filter (%s)", BlendModeToString(blend_mode));
|
||||
DEBUG_COMMAND_INFO(cmd, SPrintF("Advanced Blend Filter (%s)",
|
||||
BlendModeToString(blend_mode)));
|
||||
cmd.BindVertices(vtx_buffer);
|
||||
cmd.pipeline = std::move(pipeline);
|
||||
|
||||
@@ -249,8 +249,8 @@ std::optional<Entity> BlendFilterContents::CreateForegroundAdvancedBlend(
|
||||
auto vtx_buffer = vtx_builder.CreateVertexBuffer(host_buffer);
|
||||
|
||||
Command cmd;
|
||||
cmd.label = SPrintF("Foreground Advanced Blend Filter (%s)",
|
||||
BlendModeToString(blend_mode));
|
||||
DEBUG_COMMAND_INFO(cmd, SPrintF("Foreground Advanced Blend Filter (%s)",
|
||||
BlendModeToString(blend_mode)));
|
||||
cmd.BindVertices(vtx_buffer);
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
auto options = OptionsFromPass(pass);
|
||||
@@ -435,8 +435,8 @@ std::optional<Entity> BlendFilterContents::CreateForegroundPorterDuffBlend(
|
||||
auto vtx_buffer = vtx_builder.CreateVertexBuffer(host_buffer);
|
||||
|
||||
Command cmd;
|
||||
cmd.label = SPrintF("Foreground PorterDuff Blend Filter (%s)",
|
||||
BlendModeToString(blend_mode));
|
||||
DEBUG_COMMAND_INFO(cmd, SPrintF("Foreground PorterDuff Blend Filter (%s)",
|
||||
BlendModeToString(blend_mode)));
|
||||
cmd.BindVertices(vtx_buffer);
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
auto options = OptionsFromPass(pass);
|
||||
@@ -531,8 +531,8 @@ static std::optional<Entity> PipelineBlend(
|
||||
auto& host_buffer = pass.GetTransientsBuffer();
|
||||
|
||||
Command cmd;
|
||||
cmd.label =
|
||||
SPrintF("Pipeline Blend Filter (%s)", BlendModeToString(blend_mode));
|
||||
DEBUG_COMMAND_INFO(cmd, SPrintF("Pipeline Blend Filter (%s)",
|
||||
BlendModeToString(blend_mode)));
|
||||
auto options = OptionsFromPass(pass);
|
||||
|
||||
auto add_blend_command = [&](std::optional<Snapshot> input) {
|
||||
|
||||
@@ -109,7 +109,7 @@ std::optional<Entity> BorderMaskBlurFilterContents::RenderFilter(
|
||||
auto vtx_buffer = vtx_builder.CreateVertexBuffer(host_buffer);
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Border Mask Blur Filter";
|
||||
DEBUG_COMMAND_INFO(cmd, "Border Mask Blur Filter");
|
||||
auto options = OptionsFromPassAndEntity(pass, entity);
|
||||
|
||||
cmd.pipeline = renderer.GetBorderMaskBlurPipeline(options);
|
||||
|
||||
@@ -55,7 +55,7 @@ std::optional<Entity> ColorMatrixFilterContents::RenderFilter(
|
||||
const ContentContext& renderer,
|
||||
const Entity& entity, RenderPass& pass) -> bool {
|
||||
Command cmd;
|
||||
cmd.label = "Color Matrix Filter";
|
||||
DEBUG_COMMAND_INFO(cmd, "Color Matrix Filter");
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
auto options = OptionsFromPassAndEntity(pass, entity);
|
||||
|
||||
@@ -228,8 +228,8 @@ std::optional<Entity> DirectionalGaussianBlurFilterContents::RenderFilter(
|
||||
Point(input_snapshot->GetCoverage().value().size);
|
||||
|
||||
Command cmd;
|
||||
cmd.label = SPrintF("Gaussian Blur Filter (Radius=%.2f)",
|
||||
transformed_blur_radius_length);
|
||||
DEBUG_COMMAND_INFO(cmd, SPrintF("Gaussian Blur Filter (Radius=%.2f)",
|
||||
transformed_blur_radius_length));
|
||||
cmd.BindVertices(vtx_buffer);
|
||||
|
||||
auto options = OptionsFromPass(pass);
|
||||
|
||||
@@ -46,7 +46,7 @@ std::optional<Entity> LinearToSrgbFilterContents::RenderFilter(
|
||||
const ContentContext& renderer,
|
||||
const Entity& entity, RenderPass& pass) -> bool {
|
||||
Command cmd;
|
||||
cmd.label = "Linear to sRGB Filter";
|
||||
DEBUG_COMMAND_INFO(cmd, "Linear to sRGB Filter");
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
auto options = OptionsFromPassAndEntity(pass, entity);
|
||||
|
||||
@@ -116,7 +116,7 @@ std::optional<Entity> DirectionalMorphologyFilterContents::RenderFilter(
|
||||
Point(transformed_texture_width, transformed_texture_height);
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Morphology Filter";
|
||||
DEBUG_COMMAND_INFO(cmd, "Morphology Filter");
|
||||
auto options = OptionsFromPass(pass);
|
||||
options.blend_mode = BlendMode::kSource;
|
||||
cmd.pipeline = renderer.GetMorphologyFilterPipeline(options);
|
||||
|
||||
@@ -46,7 +46,7 @@ std::optional<Entity> SrgbToLinearFilterContents::RenderFilter(
|
||||
const ContentContext& renderer,
|
||||
const Entity& entity, RenderPass& pass) -> bool {
|
||||
Command cmd;
|
||||
cmd.label = "sRGB to Linear Filter";
|
||||
DEBUG_COMMAND_INFO(cmd, "sRGB to Linear Filter");
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
auto options = OptionsFromPassAndEntity(pass, entity);
|
||||
|
||||
@@ -74,7 +74,7 @@ std::optional<Entity> YUVToRGBFilterContents::RenderFilter(
|
||||
const ContentContext& renderer,
|
||||
const Entity& entity, RenderPass& pass) -> bool {
|
||||
Command cmd;
|
||||
cmd.label = "YUV to RGB Filter";
|
||||
DEBUG_COMMAND_INFO(cmd, "YUV to RGB Filter");
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
auto options = OptionsFromPassAndEntity(pass, entity);
|
||||
|
||||
@@ -78,7 +78,7 @@ bool FramebufferBlendContents::Render(const ContentContext& renderer,
|
||||
options.blend_mode = BlendMode::kSource;
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Framebuffer Advanced Blend Filter";
|
||||
DEBUG_COMMAND_INFO(cmd, "Framebuffer Advanced Blend Filter");
|
||||
cmd.BindVertices(vtx_buffer);
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ bool LinearGradientContents::RenderTexture(const ContentContext& renderer,
|
||||
frame_info.matrix = GetInverseEffectTransform();
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "LinearGradientFill";
|
||||
DEBUG_COMMAND_INFO(cmd, "LinearGradientFill");
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
auto options = OptionsFromPassAndEntity(pass, entity);
|
||||
@@ -161,7 +161,7 @@ bool LinearGradientContents::RenderSSBO(const ContentContext& renderer,
|
||||
frame_info.matrix = GetInverseEffectTransform();
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "LinearGradientSSBOFill";
|
||||
DEBUG_COMMAND_INFO(cmd, "LinearGradientSSBOFill");
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
auto geometry_result =
|
||||
|
||||
@@ -98,7 +98,7 @@ bool RadialGradientContents::RenderSSBO(const ContentContext& renderer,
|
||||
frame_info.matrix = GetInverseEffectTransform();
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "RadialGradientSSBOFill";
|
||||
DEBUG_COMMAND_INFO(cmd, "RadialGradientSSBOFill");
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
auto geometry_result =
|
||||
@@ -159,7 +159,7 @@ bool RadialGradientContents::RenderTexture(const ContentContext& renderer,
|
||||
frame_info.matrix = GetInverseEffectTransform();
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "RadialGradientFill";
|
||||
DEBUG_COMMAND_INFO(cmd, "RadialGradientFill");
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
auto options = OptionsFromPassAndEntity(pass, entity);
|
||||
|
||||
@@ -151,7 +151,7 @@ bool RuntimeEffectContents::Render(const ContentContext& renderer,
|
||||
}
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "RuntimeEffectContents";
|
||||
DEBUG_COMMAND_INFO(cmd, "RuntimeEffectContents");
|
||||
cmd.pipeline = pipeline;
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
cmd.BindVertices(geometry_result.vertex_buffer);
|
||||
|
||||
@@ -47,7 +47,7 @@ bool SolidColorContents::Render(const ContentContext& renderer,
|
||||
using VS = SolidFillPipeline::VertexShader;
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Solid Fill";
|
||||
DEBUG_COMMAND_INFO(cmd, "Solid Fill");
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
auto geometry_result =
|
||||
|
||||
@@ -87,7 +87,7 @@ bool SolidRRectBlurContents::Render(const ContentContext& renderer,
|
||||
}
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "RRect Shadow";
|
||||
DEBUG_COMMAND_INFO(cmd, "RRect Shadow");
|
||||
auto opts = OptionsFromPassAndEntity(pass, entity);
|
||||
opts.primitive_type = PrimitiveType::kTriangle;
|
||||
cmd.pipeline = renderer.GetRRectBlurPipeline(opts);
|
||||
|
||||
@@ -104,7 +104,7 @@ bool SweepGradientContents::RenderSSBO(const ContentContext& renderer,
|
||||
frame_info.matrix = GetInverseEffectTransform();
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "SweepGradientSSBOFill";
|
||||
DEBUG_COMMAND_INFO(cmd, "SweepGradientSSBOFill");
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
auto geometry_result =
|
||||
GetGeometry()->GetPositionBuffer(renderer, entity, pass);
|
||||
@@ -166,7 +166,7 @@ bool SweepGradientContents::RenderTexture(const ContentContext& renderer,
|
||||
frame_info.matrix = GetInverseEffectTransform();
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "SweepGradientFill";
|
||||
DEBUG_COMMAND_INFO(cmd, "SweepGradientFill");
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
auto options = OptionsFromPassAndEntity(pass, entity);
|
||||
|
||||
@@ -99,7 +99,7 @@ bool TextContents::Render(const ContentContext& renderer,
|
||||
|
||||
// Information shared by all glyph draw calls.
|
||||
Command cmd;
|
||||
cmd.label = "TextFrame";
|
||||
DEBUG_COMMAND_INFO(cmd, "TextFrame");
|
||||
auto opts = OptionsFromPassAndEntity(pass, entity);
|
||||
opts.primitive_type = PrimitiveType::kTriangle;
|
||||
if (type == GlyphAtlas::Type::kAlphaBitmap) {
|
||||
|
||||
@@ -143,9 +143,10 @@ bool TextureContents::Render(const ContentContext& renderer,
|
||||
frame_info.alpha = GetOpacity();
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Texture Fill";
|
||||
if (!label_.empty()) {
|
||||
cmd.label += ": " + label_;
|
||||
if (label_.empty()) {
|
||||
DEBUG_COMMAND_INFO(cmd, "Texture Fill");
|
||||
} else {
|
||||
DEBUG_COMMAND_INFO(cmd, "Texture Fill: " + label_);
|
||||
}
|
||||
|
||||
auto pipeline_options = OptionsFromPassAndEntity(pass, entity);
|
||||
|
||||
@@ -139,7 +139,12 @@ bool TiledTextureContents::Render(const ContentContext& renderer,
|
||||
frame_info.alpha = GetOpacityFactor();
|
||||
|
||||
Command cmd;
|
||||
cmd.label = uses_emulated_tile_mode ? "TiledTextureFill" : "TextureFill";
|
||||
if (uses_emulated_tile_mode) {
|
||||
DEBUG_COMMAND_INFO(cmd, "TiledTextureFill");
|
||||
} else {
|
||||
DEBUG_COMMAND_INFO(cmd, "TextureFill");
|
||||
}
|
||||
|
||||
cmd.stencil_reference = entity.GetStencilDepth();
|
||||
|
||||
auto options = OptionsFromPassAndEntity(pass, entity);
|
||||
|
||||
@@ -124,7 +124,7 @@ bool VerticesUVContents::Render(const ContentContext& renderer,
|
||||
}
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "VerticesUV";
|
||||
DEBUG_COMMAND_INFO(cmd, "VerticesUV");
|
||||
auto& host_buffer = pass.GetTransientsBuffer();
|
||||
auto geometry = parent_.GetGeometry();
|
||||
|
||||
@@ -178,7 +178,7 @@ bool VerticesColorContents::Render(const ContentContext& renderer,
|
||||
using FS = GeometryColorPipeline::FragmentShader;
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "VerticesColors";
|
||||
DEBUG_COMMAND_INFO(cmd, "VerticesColors");
|
||||
auto& host_buffer = pass.GetTransientsBuffer();
|
||||
auto geometry = parent_.GetGeometry();
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "impeller/geometry/sigma.h"
|
||||
#include "impeller/playground/playground.h"
|
||||
#include "impeller/playground/widgets.h"
|
||||
#include "impeller/renderer/command.h"
|
||||
#include "impeller/renderer/render_pass.h"
|
||||
#include "impeller/renderer/vertex_buffer_builder.h"
|
||||
#include "impeller/runtime_stage/runtime_stage.h"
|
||||
@@ -868,7 +869,7 @@ TEST_P(EntityTest, BlendingModeOptions) {
|
||||
}
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Blended Rectangle";
|
||||
DEBUG_COMMAND_INFO(cmd, "Blended Rectangle");
|
||||
auto options = OptionsFromPass(pass);
|
||||
options.blend_mode = blend_mode;
|
||||
options.primitive_type = PrimitiveType::kTriangle;
|
||||
|
||||
@@ -167,7 +167,7 @@ GeometryResult PointFieldGeometry::GetPositionBufferGPU(
|
||||
{
|
||||
using PS = PointsComputeShader;
|
||||
ComputeCommand cmd;
|
||||
cmd.label = "Points Geometry";
|
||||
DEBUG_COMMAND_INFO(cmd, "Points Geometry");
|
||||
cmd.pipeline = renderer.GetPointComputePipeline();
|
||||
|
||||
PS::FrameInfo frame_info;
|
||||
@@ -201,7 +201,7 @@ GeometryResult PointFieldGeometry::GetPositionBufferGPU(
|
||||
using UV = UvComputeShader;
|
||||
|
||||
ComputeCommand cmd;
|
||||
cmd.label = "UV Geometry";
|
||||
DEBUG_COMMAND_INFO(cmd, "UV Geometry");
|
||||
cmd.pipeline = renderer.GetUvComputePipeline();
|
||||
|
||||
UV::FrameInfo frame_info;
|
||||
|
||||
@@ -238,8 +238,9 @@ void ImGui_ImplImpeller_RenderDrawData(ImDrawData* draw_data,
|
||||
}
|
||||
|
||||
impeller::Command cmd;
|
||||
cmd.label = impeller::SPrintF("ImGui draw list %d (command %d)",
|
||||
draw_list_i, cmd_i);
|
||||
DEBUG_COMMAND_INFO(cmd,
|
||||
impeller::SPrintF("ImGui draw list %d (command %d)",
|
||||
draw_list_i, cmd_i));
|
||||
|
||||
cmd.viewport = viewport;
|
||||
cmd.scissor = impeller::IRect(clip_rect);
|
||||
|
||||
@@ -244,6 +244,7 @@ struct RenderPassData {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
fml::ScopedCleanupClosure pop_cmd_debug_marker(
|
||||
[&gl]() { gl.PopDebugGroup(); });
|
||||
if (!command.label.empty()) {
|
||||
@@ -251,6 +252,7 @@ struct RenderPassData {
|
||||
} else {
|
||||
pop_cmd_debug_marker.Release();
|
||||
}
|
||||
#endif // IMPELLER_DEBUG
|
||||
|
||||
const auto& pipeline = PipelineGLES::Cast(*command.pipeline);
|
||||
|
||||
|
||||
@@ -219,12 +219,14 @@ bool ComputePassMTL::EncodeCommands(const std::shared_ptr<Allocator>& allocator,
|
||||
|
||||
fml::closure pop_debug_marker = [encoder]() { [encoder popDebugGroup]; };
|
||||
for (const auto& command : commands_) {
|
||||
#ifdef IMPELLER_DEBUG
|
||||
fml::ScopedCleanupClosure auto_pop_debug_marker(pop_debug_marker);
|
||||
if (!command.label.empty()) {
|
||||
[encoder pushDebugGroup:@(command.label.c_str())];
|
||||
} else {
|
||||
auto_pop_debug_marker.Release();
|
||||
}
|
||||
#endif
|
||||
|
||||
pass_bindings.SetComputePipelineState(
|
||||
ComputePipelineMTL::Cast(*command.pipeline)
|
||||
|
||||
@@ -448,12 +448,14 @@ bool RenderPassMTL::EncodeCommands(const std::shared_ptr<Allocator>& allocator,
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
fml::ScopedCleanupClosure auto_pop_debug_marker(pop_debug_marker);
|
||||
if (!command.label.empty()) {
|
||||
[encoder pushDebugGroup:@(command.label.c_str())];
|
||||
} else {
|
||||
auto_pop_debug_marker.Release();
|
||||
}
|
||||
#endif // IMPELLER_DEBUG
|
||||
|
||||
const auto& pipeline_desc = command.pipeline->GetDescriptor();
|
||||
if (target_sample_count != pipeline_desc.GetSampleCount()) {
|
||||
|
||||
@@ -452,6 +452,7 @@ static bool EncodeCommand(const Context& context,
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
fml::ScopedCleanupClosure pop_marker(
|
||||
[&encoder]() { encoder.PopDebugGroup(); });
|
||||
if (!command.label.empty()) {
|
||||
@@ -459,6 +460,7 @@ static bool EncodeCommand(const Context& context,
|
||||
} else {
|
||||
pop_marker.Release();
|
||||
}
|
||||
#endif // IMPELLER_DEBUG
|
||||
|
||||
const auto& cmd_buffer = encoder.GetCommandBuffer();
|
||||
|
||||
|
||||
@@ -25,6 +25,12 @@
|
||||
|
||||
namespace impeller {
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
#define DEBUG_COMMAND_INFO(obj, arg) obj.label = arg;
|
||||
#else
|
||||
#define DEBUG_COMMAND_INFO(obj, arg)
|
||||
#endif // IMPELLER_DEBUG
|
||||
|
||||
template <class T>
|
||||
struct Resource {
|
||||
using ResourceType = T;
|
||||
@@ -116,10 +122,14 @@ struct Command : public ResourceBinder {
|
||||
/// packed in the index buffer.
|
||||
///
|
||||
IndexType index_type = IndexType::kUnknown;
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
//----------------------------------------------------------------------------
|
||||
/// The debugging label to use for the command.
|
||||
///
|
||||
std::string label;
|
||||
#endif // IMPELLER_DEBUG
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// The reference value to use in stenciling operations. Stencil configuration
|
||||
/// is part of pipeline setup and can be read from the pipelines descriptor.
|
||||
|
||||
@@ -50,10 +50,13 @@ struct ComputeCommand : public ResourceBinder {
|
||||
/// stage.
|
||||
///
|
||||
Bindings bindings;
|
||||
|
||||
#ifdef IMPELLER_DEBUG
|
||||
//----------------------------------------------------------------------------
|
||||
/// The debugging label to use for the command.
|
||||
///
|
||||
std::string label;
|
||||
#endif // IMPELLER_DEBUG
|
||||
|
||||
// |ResourceBinder|
|
||||
bool BindResource(ShaderStage stage,
|
||||
|
||||
@@ -133,7 +133,7 @@ TEST_P(ComputeSubgroupTest, PathPlayground) {
|
||||
using VS = SolidFillPipeline::VertexShader;
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Draw Stroke";
|
||||
DEBUG_COMMAND_INFO(cmd, "Draw Stroke");
|
||||
cmd.stencil_reference = 0;
|
||||
|
||||
ContentContextOptions options;
|
||||
@@ -337,7 +337,7 @@ TEST_P(ComputeSubgroupTest, LargePath) {
|
||||
using VS = SolidFillPipeline::VertexShader;
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Draw Stroke";
|
||||
DEBUG_COMMAND_INFO(cmd, "Draw Stroke");
|
||||
cmd.stencil_reference = 0;
|
||||
|
||||
ContentContextOptions options;
|
||||
@@ -421,7 +421,7 @@ TEST_P(ComputeSubgroupTest, QuadAndCubicInOnePath) {
|
||||
using VS = SolidFillPipeline::VertexShader;
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Draw Stroke";
|
||||
DEBUG_COMMAND_INFO(cmd, "Draw Stroke");
|
||||
cmd.stencil_reference = 0;
|
||||
|
||||
ContentContextOptions options;
|
||||
|
||||
@@ -122,7 +122,7 @@ ComputeTessellator::Status ComputeTessellator::Tessellate(
|
||||
pass->SetThreadGroupSize(ISize(line_count, 1));
|
||||
|
||||
ComputeCommand cmd;
|
||||
cmd.label = "Generate Polyline";
|
||||
DEBUG_COMMAND_INFO(cmd, "Generate Polyline");
|
||||
cmd.pipeline = compute_pipeline;
|
||||
|
||||
PS::BindConfig(cmd, pass->GetTransientsBuffer().EmplaceUniform(config));
|
||||
@@ -152,7 +152,7 @@ ComputeTessellator::Status ComputeTessellator::Tessellate(
|
||||
pass->SetThreadGroupSize(ISize(line_count, 1));
|
||||
|
||||
ComputeCommand cmd;
|
||||
cmd.label = "Compute Stroke";
|
||||
DEBUG_COMMAND_INFO(cmd, "Compute Stroke");
|
||||
cmd.pipeline = compute_pipeline;
|
||||
|
||||
SS::Config config{
|
||||
|
||||
@@ -56,7 +56,6 @@ TEST_P(ComputeTest, CanCreateComputePass) {
|
||||
pass->SetThreadGroupSize(ISize(kCount, 1));
|
||||
|
||||
ComputeCommand cmd;
|
||||
cmd.label = "Compute";
|
||||
cmd.pipeline = compute_pipeline;
|
||||
|
||||
CS::Info info{.count = kCount};
|
||||
@@ -135,7 +134,6 @@ TEST_P(ComputeTest, CanComputePrefixSum) {
|
||||
pass->SetThreadGroupSize(ISize(kCount, 1));
|
||||
|
||||
ComputeCommand cmd;
|
||||
cmd.label = "Compute";
|
||||
cmd.pipeline = compute_pipeline;
|
||||
|
||||
CS::InputData<kCount> input_data;
|
||||
@@ -201,7 +199,6 @@ TEST_P(ComputeTest, 1DThreadgroupSizingIsCorrect) {
|
||||
pass->SetThreadGroupSize(ISize(kCount, 1));
|
||||
|
||||
ComputeCommand cmd;
|
||||
cmd.label = "Compute";
|
||||
cmd.pipeline = compute_pipeline;
|
||||
|
||||
auto output_buffer = CreateHostVisibleDeviceBuffer<CS::OutputData<kCount>>(
|
||||
@@ -252,7 +249,6 @@ TEST_P(ComputeTest, CanComputePrefixSumLargeInteractive) {
|
||||
pass->SetGridSize(ISize(kCount, 1));
|
||||
|
||||
ComputeCommand cmd;
|
||||
cmd.label = "Compute";
|
||||
cmd.pipeline = compute_pipeline;
|
||||
|
||||
CS::InputData<kCount> input_data;
|
||||
@@ -328,7 +324,6 @@ TEST_P(ComputeTest, MultiStageInputAndOutput) {
|
||||
|
||||
{
|
||||
ComputeCommand cmd;
|
||||
cmd.label = "Compute1";
|
||||
cmd.pipeline = compute_pipeline_1;
|
||||
|
||||
CS1::BindInput(cmd,
|
||||
@@ -340,7 +335,6 @@ TEST_P(ComputeTest, MultiStageInputAndOutput) {
|
||||
|
||||
{
|
||||
ComputeCommand cmd;
|
||||
cmd.label = "Compute2";
|
||||
cmd.pipeline = compute_pipeline_2;
|
||||
|
||||
CS1::BindInput(cmd, output_buffer_1->AsBufferView());
|
||||
@@ -399,7 +393,6 @@ TEST_P(ComputeTest, CanCompute1DimensionalData) {
|
||||
pass->SetGridSize(ISize(kCount, 1));
|
||||
|
||||
ComputeCommand cmd;
|
||||
cmd.label = "Compute";
|
||||
cmd.pipeline = compute_pipeline;
|
||||
|
||||
CS::Info info{.count = kCount};
|
||||
@@ -480,7 +473,6 @@ TEST_P(ComputeTest, ReturnsEarlyWhenAnyGridDimensionIsZero) {
|
||||
pass->SetThreadGroupSize(ISize(0, 1));
|
||||
|
||||
ComputeCommand cmd;
|
||||
cmd.label = "Compute";
|
||||
cmd.pipeline = compute_pipeline;
|
||||
|
||||
CS::Info info{.count = kCount};
|
||||
|
||||
@@ -91,7 +91,7 @@ TEST_P(RendererTest, CanCreateBoxPrimitive) {
|
||||
assert(pipeline && pipeline->IsValid());
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Box";
|
||||
DEBUG_COMMAND_INFO(cmd, "Box");
|
||||
cmd.pipeline = pipeline;
|
||||
|
||||
cmd.BindVertices(vertex_buffer);
|
||||
@@ -185,7 +185,7 @@ TEST_P(RendererTest, CanRenderPerspectiveCube) {
|
||||
ImGui::End();
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Perspective Cube";
|
||||
DEBUG_COMMAND_INFO(cmd, "Perspective Cube");
|
||||
cmd.pipeline = pipeline;
|
||||
|
||||
cmd.BindVertices(vertex_buffer);
|
||||
@@ -246,7 +246,7 @@ TEST_P(RendererTest, CanRenderMultiplePrimitives) {
|
||||
|
||||
SinglePassCallback callback = [&](RenderPass& pass) {
|
||||
Command cmd;
|
||||
cmd.label = "Box";
|
||||
DEBUG_COMMAND_INFO(cmd, "Box");
|
||||
cmd.pipeline = box_pipeline;
|
||||
|
||||
cmd.BindVertices(vertex_buffer);
|
||||
@@ -360,7 +360,7 @@ TEST_P(RendererTest, CanRenderToTexture) {
|
||||
}
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Box";
|
||||
DEBUG_COMMAND_INFO(cmd, "Box");
|
||||
cmd.pipeline = box_pipeline;
|
||||
|
||||
cmd.BindVertices(vertex_buffer);
|
||||
@@ -426,7 +426,7 @@ TEST_P(RendererTest, CanRenderInstanced) {
|
||||
|
||||
Command cmd;
|
||||
cmd.pipeline = pipeline;
|
||||
cmd.label = "InstancedDraw";
|
||||
DEBUG_COMMAND_INFO(cmd, "InstancedDraw");
|
||||
|
||||
static constexpr size_t kInstancesCount = 5u;
|
||||
VS::InstanceInfo<kInstancesCount> instances;
|
||||
@@ -530,7 +530,7 @@ TEST_P(RendererTest, CanBlitTextureToTexture) {
|
||||
pass->SetLabel("Playground Render Pass");
|
||||
{
|
||||
Command cmd;
|
||||
cmd.label = "Image";
|
||||
DEBUG_COMMAND_INFO(cmd, "Image");
|
||||
cmd.pipeline = mipmaps_pipeline;
|
||||
|
||||
cmd.BindVertices(vertex_buffer);
|
||||
@@ -654,7 +654,7 @@ TEST_P(RendererTest, CanBlitTextureToBuffer) {
|
||||
pass->SetLabel("Playground Render Pass");
|
||||
{
|
||||
Command cmd;
|
||||
cmd.label = "Image";
|
||||
DEBUG_COMMAND_INFO(cmd, "Image");
|
||||
cmd.pipeline = mipmaps_pipeline;
|
||||
|
||||
cmd.BindVertices(vertex_buffer);
|
||||
@@ -774,7 +774,7 @@ TEST_P(RendererTest, CanGenerateMipmaps) {
|
||||
pass->SetLabel("Playground Render Pass");
|
||||
{
|
||||
Command cmd;
|
||||
cmd.label = "Image LOD";
|
||||
DEBUG_COMMAND_INFO(cmd, "Image LOD");
|
||||
cmd.pipeline = mipmaps_pipeline;
|
||||
|
||||
cmd.BindVertices(vertex_buffer);
|
||||
@@ -840,7 +840,7 @@ TEST_P(RendererTest, TheImpeller) {
|
||||
|
||||
Command cmd;
|
||||
cmd.pipeline = pipeline;
|
||||
cmd.label = "Impeller SDF scene";
|
||||
DEBUG_COMMAND_INFO(cmd, "Impeller SDF scene");
|
||||
VertexBufferBuilder<VS::PerVertexData> builder;
|
||||
builder.AddVertices({{Point()},
|
||||
{Point(0, size.height)},
|
||||
@@ -887,7 +887,7 @@ TEST_P(RendererTest, ArrayUniforms) {
|
||||
|
||||
Command cmd;
|
||||
cmd.pipeline = pipeline;
|
||||
cmd.label = "Google Dots";
|
||||
DEBUG_COMMAND_INFO(cmd, "Google Dots");
|
||||
VertexBufferBuilder<VS::PerVertexData> builder;
|
||||
builder.AddVertices({{Point()},
|
||||
{Point(0, size.height)},
|
||||
@@ -943,7 +943,7 @@ TEST_P(RendererTest, InactiveUniforms) {
|
||||
|
||||
Command cmd;
|
||||
cmd.pipeline = pipeline;
|
||||
cmd.label = "Inactive Uniform";
|
||||
DEBUG_COMMAND_INFO(cmd, "Inactive Uniform");
|
||||
VertexBufferBuilder<VS::PerVertexData> builder;
|
||||
builder.AddVertices({{Point()},
|
||||
{Point(0, size.height)},
|
||||
@@ -1205,7 +1205,7 @@ TEST_P(RendererTest, StencilMask) {
|
||||
assert(pipeline && pipeline->IsValid());
|
||||
|
||||
Command cmd;
|
||||
cmd.label = "Box";
|
||||
DEBUG_COMMAND_INFO(cmd, "Box");
|
||||
cmd.pipeline = pipeline;
|
||||
cmd.stencil_reference = stencil_reference_read;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ static void EncodeCommand(const SceneContext& scene_context,
|
||||
auto& host_buffer = render_pass.GetTransientsBuffer();
|
||||
|
||||
Command cmd;
|
||||
cmd.label = scene_command.label;
|
||||
DEBUG_COMMAND_INFO(cmd, scene_command.label);
|
||||
cmd.stencil_reference =
|
||||
0; // TODO(bdero): Configurable stencil ref per-command.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user