From 396436568be7f7ddcf17ced14aa426a8a65e65d0 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Wed, 2 Aug 2023 10:05:22 -0700 Subject: [PATCH 1/4] [Impeller] conditionally compile command label. --- impeller/entity/contents/atlas_contents.cc | 4 ++-- .../entity/contents/checkerboard_contents.cc | 2 +- impeller/entity/contents/clip_contents.cc | 8 ++++---- .../entity/contents/conical_gradient_contents.cc | 4 ++-- .../contents/filters/blend_filter_contents.cc | 16 ++++++++-------- .../filters/border_mask_blur_filter_contents.cc | 2 +- .../filters/color_matrix_filter_contents.cc | 2 +- .../filters/gaussian_blur_filter_contents.cc | 4 ++-- .../filters/linear_to_srgb_filter_contents.cc | 2 +- .../filters/morphology_filter_contents.cc | 2 +- .../filters/srgb_to_linear_filter_contents.cc | 2 +- .../filters/yuv_to_rgb_filter_contents.cc | 2 +- .../contents/framebuffer_blend_contents.cc | 2 +- .../entity/contents/linear_gradient_contents.cc | 4 ++-- .../entity/contents/radial_gradient_contents.cc | 4 ++-- .../entity/contents/runtime_effect_contents.cc | 2 +- impeller/entity/contents/solid_color_contents.cc | 2 +- .../entity/contents/solid_rrect_blur_contents.cc | 2 +- .../entity/contents/sweep_gradient_contents.cc | 4 ++-- impeller/entity/contents/text_contents.cc | 2 +- impeller/entity/contents/texture_contents.cc | 7 ++++--- .../entity/contents/tiled_texture_contents.cc | 7 ++++++- impeller/entity/contents/vertices_contents.cc | 4 ++-- impeller/entity/geometry/point_field_geometry.cc | 4 ++-- impeller/playground/imgui/imgui_impl_impeller.cc | 4 ++-- .../renderer/backend/gles/render_pass_gles.cc | 2 ++ .../renderer/backend/metal/compute_pass_mtl.mm | 2 ++ .../renderer/backend/metal/render_pass_mtl.mm | 2 ++ .../renderer/backend/vulkan/render_pass_vk.cc | 2 ++ impeller/renderer/command.h | 10 ++++++++++ impeller/renderer/compute_command.h | 3 +++ impeller/renderer/compute_tessellator.cc | 4 ++-- impeller/scene/scene_encoder.cc | 2 +- 33 files changed, 76 insertions(+), 49 deletions(-) diff --git a/impeller/entity/contents/atlas_contents.cc b/impeller/entity/contents/atlas_contents.cc index bfdfd16aa127a..8102fb324ffcc 100644 --- a/impeller/entity/contents/atlas_contents.cc +++ b/impeller/entity/contents/atlas_contents.cc @@ -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(); diff --git a/impeller/entity/contents/checkerboard_contents.cc b/impeller/entity/contents/checkerboard_contents.cc index 0c80a632b0cfd..9d8c91da79d38 100644 --- a/impeller/entity/contents/checkerboard_contents.cc +++ b/impeller/entity/contents/checkerboard_contents.cc @@ -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; diff --git a/impeller/entity/contents/clip_contents.cc b/impeller/entity/contents/clip_contents.cc index 20c2ab2ded837..5f66f4d62cea7 100644 --- a/impeller/entity/contents/clip_contents.cc +++ b/impeller/entity/contents/clip_contents.cc @@ -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; diff --git a/impeller/entity/contents/conical_gradient_contents.cc b/impeller/entity/contents/conical_gradient_contents.cc index b3705bf858b87..db9172b6c8175 100644 --- a/impeller/entity/contents/conical_gradient_contents.cc +++ b/impeller/entity/contents/conical_gradient_contents.cc @@ -94,7 +94,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 = @@ -162,7 +162,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); diff --git a/impeller/entity/contents/filters/blend_filter_contents.cc b/impeller/entity/contents/filters/blend_filter_contents.cc index 11f175bc0b593..59d7d610534f5 100644 --- a/impeller/entity/contents/filters/blend_filter_contents.cc +++ b/impeller/entity/contents/filters/blend_filter_contents.cc @@ -132,8 +132,8 @@ static std::optional 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 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 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 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 input) { diff --git a/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc b/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc index 5ede46259dda1..2da237445980b 100644 --- a/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc +++ b/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc @@ -109,7 +109,7 @@ std::optional 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); diff --git a/impeller/entity/contents/filters/color_matrix_filter_contents.cc b/impeller/entity/contents/filters/color_matrix_filter_contents.cc index 600d7a4df5bba..24d0389bb0947 100644 --- a/impeller/entity/contents/filters/color_matrix_filter_contents.cc +++ b/impeller/entity/contents/filters/color_matrix_filter_contents.cc @@ -55,7 +55,7 @@ std::optional 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); diff --git a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc index 0226507dbc8b6..2f40847ab24a8 100644 --- a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc +++ b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc @@ -228,8 +228,8 @@ std::optional 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); diff --git a/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc b/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc index 54a54854a8b4d..e75c269105f88 100644 --- a/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc +++ b/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc @@ -46,7 +46,7 @@ std::optional 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); diff --git a/impeller/entity/contents/filters/morphology_filter_contents.cc b/impeller/entity/contents/filters/morphology_filter_contents.cc index 16b5cc5daf5b5..e5db46d53f64d 100644 --- a/impeller/entity/contents/filters/morphology_filter_contents.cc +++ b/impeller/entity/contents/filters/morphology_filter_contents.cc @@ -116,7 +116,7 @@ std::optional 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); diff --git a/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc b/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc index da5181681497d..84568a0a2f25f 100644 --- a/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc +++ b/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc @@ -46,7 +46,7 @@ std::optional 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); diff --git a/impeller/entity/contents/filters/yuv_to_rgb_filter_contents.cc b/impeller/entity/contents/filters/yuv_to_rgb_filter_contents.cc index fa10a460ee1e6..5b944ca68e023 100644 --- a/impeller/entity/contents/filters/yuv_to_rgb_filter_contents.cc +++ b/impeller/entity/contents/filters/yuv_to_rgb_filter_contents.cc @@ -74,7 +74,7 @@ std::optional 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); diff --git a/impeller/entity/contents/framebuffer_blend_contents.cc b/impeller/entity/contents/framebuffer_blend_contents.cc index 6e8adafbec76a..eebda2654bd50 100644 --- a/impeller/entity/contents/framebuffer_blend_contents.cc +++ b/impeller/entity/contents/framebuffer_blend_contents.cc @@ -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(); diff --git a/impeller/entity/contents/linear_gradient_contents.cc b/impeller/entity/contents/linear_gradient_contents.cc index b071bf889300f..b35ee0d9084e8 100644 --- a/impeller/entity/contents/linear_gradient_contents.cc +++ b/impeller/entity/contents/linear_gradient_contents.cc @@ -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 = diff --git a/impeller/entity/contents/radial_gradient_contents.cc b/impeller/entity/contents/radial_gradient_contents.cc index 2527b54898258..9000e14d70717 100644 --- a/impeller/entity/contents/radial_gradient_contents.cc +++ b/impeller/entity/contents/radial_gradient_contents.cc @@ -93,7 +93,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 = @@ -154,7 +154,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); diff --git a/impeller/entity/contents/runtime_effect_contents.cc b/impeller/entity/contents/runtime_effect_contents.cc index ba2dff69c4e43..db5bfb8e22c9f 100644 --- a/impeller/entity/contents/runtime_effect_contents.cc +++ b/impeller/entity/contents/runtime_effect_contents.cc @@ -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); diff --git a/impeller/entity/contents/solid_color_contents.cc b/impeller/entity/contents/solid_color_contents.cc index b90f3ffbe263f..47ea391b84ea5 100644 --- a/impeller/entity/contents/solid_color_contents.cc +++ b/impeller/entity/contents/solid_color_contents.cc @@ -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 = diff --git a/impeller/entity/contents/solid_rrect_blur_contents.cc b/impeller/entity/contents/solid_rrect_blur_contents.cc index 6dfed48ee2351..ec8bc3e61d9ce 100644 --- a/impeller/entity/contents/solid_rrect_blur_contents.cc +++ b/impeller/entity/contents/solid_rrect_blur_contents.cc @@ -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); diff --git a/impeller/entity/contents/sweep_gradient_contents.cc b/impeller/entity/contents/sweep_gradient_contents.cc index c730bb3d70452..69ba5e354f9bf 100644 --- a/impeller/entity/contents/sweep_gradient_contents.cc +++ b/impeller/entity/contents/sweep_gradient_contents.cc @@ -99,7 +99,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); @@ -161,7 +161,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); diff --git a/impeller/entity/contents/text_contents.cc b/impeller/entity/contents/text_contents.cc index 9f28e9e97994a..09635ab5dfc1a 100644 --- a/impeller/entity/contents/text_contents.cc +++ b/impeller/entity/contents/text_contents.cc @@ -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) { diff --git a/impeller/entity/contents/texture_contents.cc b/impeller/entity/contents/texture_contents.cc index 1dbc8a5a2b50b..244542e16e673 100644 --- a/impeller/entity/contents/texture_contents.cc +++ b/impeller/entity/contents/texture_contents.cc @@ -138,9 +138,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); diff --git a/impeller/entity/contents/tiled_texture_contents.cc b/impeller/entity/contents/tiled_texture_contents.cc index 8ef9b6d78cb99..bf2bda327ba17 100644 --- a/impeller/entity/contents/tiled_texture_contents.cc +++ b/impeller/entity/contents/tiled_texture_contents.cc @@ -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); diff --git a/impeller/entity/contents/vertices_contents.cc b/impeller/entity/contents/vertices_contents.cc index 353e28e112ee7..8567516b02fb0 100644 --- a/impeller/entity/contents/vertices_contents.cc +++ b/impeller/entity/contents/vertices_contents.cc @@ -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(); diff --git a/impeller/entity/geometry/point_field_geometry.cc b/impeller/entity/geometry/point_field_geometry.cc index 83c763fe0e78e..81fe3885d916b 100644 --- a/impeller/entity/geometry/point_field_geometry.cc +++ b/impeller/entity/geometry/point_field_geometry.cc @@ -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; diff --git a/impeller/playground/imgui/imgui_impl_impeller.cc b/impeller/playground/imgui/imgui_impl_impeller.cc index dd5e92ca96f42..2f3feb5574d09 100644 --- a/impeller/playground/imgui/imgui_impl_impeller.cc +++ b/impeller/playground/imgui/imgui_impl_impeller.cc @@ -238,8 +238,8 @@ 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); diff --git a/impeller/renderer/backend/gles/render_pass_gles.cc b/impeller/renderer/backend/gles/render_pass_gles.cc index 2cdadb4fc3cd7..c73aec76ac9b3 100644 --- a/impeller/renderer/backend/gles/render_pass_gles.cc +++ b/impeller/renderer/backend/gles/render_pass_gles.cc @@ -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); diff --git a/impeller/renderer/backend/metal/compute_pass_mtl.mm b/impeller/renderer/backend/metal/compute_pass_mtl.mm index 5cdf4a5c3d9fd..0157ec5b38a16 100644 --- a/impeller/renderer/backend/metal/compute_pass_mtl.mm +++ b/impeller/renderer/backend/metal/compute_pass_mtl.mm @@ -219,12 +219,14 @@ static bool Bind(ComputePassBindingsCache& pass, 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) diff --git a/impeller/renderer/backend/metal/render_pass_mtl.mm b/impeller/renderer/backend/metal/render_pass_mtl.mm index dc5e4fa621639..92152faa591eb 100644 --- a/impeller/renderer/backend/metal/render_pass_mtl.mm +++ b/impeller/renderer/backend/metal/render_pass_mtl.mm @@ -448,12 +448,14 @@ static bool Bind(PassBindingsCache& pass, 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()) { diff --git a/impeller/renderer/backend/vulkan/render_pass_vk.cc b/impeller/renderer/backend/vulkan/render_pass_vk.cc index c7d84b4afea9c..fefa58e5e0ccc 100644 --- a/impeller/renderer/backend/vulkan/render_pass_vk.cc +++ b/impeller/renderer/backend/vulkan/render_pass_vk.cc @@ -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(); diff --git a/impeller/renderer/command.h b/impeller/renderer/command.h index e44633f2365b7..a20559f3856a7 100644 --- a/impeller/renderer/command.h +++ b/impeller/renderer/command.h @@ -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 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. diff --git a/impeller/renderer/compute_command.h b/impeller/renderer/compute_command.h index 467777d22deda..3320e8a2ff912 100644 --- a/impeller/renderer/compute_command.h +++ b/impeller/renderer/compute_command.h @@ -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, diff --git a/impeller/renderer/compute_tessellator.cc b/impeller/renderer/compute_tessellator.cc index 149380adc15f4..16a8d1015c488 100644 --- a/impeller/renderer/compute_tessellator.cc +++ b/impeller/renderer/compute_tessellator.cc @@ -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{ diff --git a/impeller/scene/scene_encoder.cc b/impeller/scene/scene_encoder.cc index 662820a606cbd..e0572ffdb6971 100644 --- a/impeller/scene/scene_encoder.cc +++ b/impeller/scene/scene_encoder.cc @@ -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. From c89c39c2ba48ee5e373cde38e47959f805bf4ecc Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Wed, 2 Aug 2023 10:06:33 -0700 Subject: [PATCH 2/4] ++ --- impeller/playground/imgui/imgui_impl_impeller.cc | 5 +++-- impeller/renderer/backend/gles/render_pass_gles.cc | 2 +- impeller/renderer/backend/metal/render_pass_mtl.mm | 2 +- impeller/renderer/backend/vulkan/render_pass_vk.cc | 2 +- impeller/renderer/compute_command.h | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/impeller/playground/imgui/imgui_impl_impeller.cc b/impeller/playground/imgui/imgui_impl_impeller.cc index 2f3feb5574d09..ada5f83dfa35c 100644 --- a/impeller/playground/imgui/imgui_impl_impeller.cc +++ b/impeller/playground/imgui/imgui_impl_impeller.cc @@ -238,8 +238,9 @@ void ImGui_ImplImpeller_RenderDrawData(ImDrawData* draw_data, } impeller::Command cmd; - DEBUG_COMMAND_INFO(cmd, 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); diff --git a/impeller/renderer/backend/gles/render_pass_gles.cc b/impeller/renderer/backend/gles/render_pass_gles.cc index c73aec76ac9b3..65ce6c2108189 100644 --- a/impeller/renderer/backend/gles/render_pass_gles.cc +++ b/impeller/renderer/backend/gles/render_pass_gles.cc @@ -252,7 +252,7 @@ struct RenderPassData { } else { pop_cmd_debug_marker.Release(); } -#endif // IMPELLER_DEBUG +#endif // IMPELLER_DEBUG const auto& pipeline = PipelineGLES::Cast(*command.pipeline); diff --git a/impeller/renderer/backend/metal/render_pass_mtl.mm b/impeller/renderer/backend/metal/render_pass_mtl.mm index 92152faa591eb..60db24acc3c62 100644 --- a/impeller/renderer/backend/metal/render_pass_mtl.mm +++ b/impeller/renderer/backend/metal/render_pass_mtl.mm @@ -455,7 +455,7 @@ static bool Bind(PassBindingsCache& pass, } else { auto_pop_debug_marker.Release(); } -#endif // IMPELLER_DEBUG +#endif // IMPELLER_DEBUG const auto& pipeline_desc = command.pipeline->GetDescriptor(); if (target_sample_count != pipeline_desc.GetSampleCount()) { diff --git a/impeller/renderer/backend/vulkan/render_pass_vk.cc b/impeller/renderer/backend/vulkan/render_pass_vk.cc index fefa58e5e0ccc..5cb38fecc9f9f 100644 --- a/impeller/renderer/backend/vulkan/render_pass_vk.cc +++ b/impeller/renderer/backend/vulkan/render_pass_vk.cc @@ -460,7 +460,7 @@ static bool EncodeCommand(const Context& context, } else { pop_marker.Release(); } -#endif // IMPELLER_DEBUG +#endif // IMPELLER_DEBUG const auto& cmd_buffer = encoder.GetCommandBuffer(); diff --git a/impeller/renderer/compute_command.h b/impeller/renderer/compute_command.h index 3320e8a2ff912..caa0cf0e60dc3 100644 --- a/impeller/renderer/compute_command.h +++ b/impeller/renderer/compute_command.h @@ -56,7 +56,7 @@ struct ComputeCommand : public ResourceBinder { /// The debugging label to use for the command. /// std::string label; -#endif // IMPELLER_DEBUG +#endif // IMPELLER_DEBUG // |ResourceBinder| bool BindResource(ShaderStage stage, From 5a4f5d0088f96ede55024e33dc25058e79f973fa Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Wed, 2 Aug 2023 10:43:18 -0700 Subject: [PATCH 3/4] ++ --- impeller/renderer/compute_unittests.cc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/impeller/renderer/compute_unittests.cc b/impeller/renderer/compute_unittests.cc index 67517a4ebaafa..bcaeff41bb924 100644 --- a/impeller/renderer/compute_unittests.cc +++ b/impeller/renderer/compute_unittests.cc @@ -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 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>( @@ -252,7 +249,6 @@ TEST_P(ComputeTest, CanComputePrefixSumLargeInteractive) { pass->SetGridSize(ISize(kCount, 1)); ComputeCommand cmd; - cmd.label = "Compute"; cmd.pipeline = compute_pipeline; CS::InputData 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}; From 55f04c84286500a7b2c032a3ac53f3b03317b0a2 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Wed, 2 Aug 2023 11:28:36 -0700 Subject: [PATCH 4/4] ++ --- impeller/entity/entity_unittests.cc | 3 ++- .../renderer/compute_subgroup_unittests.cc | 6 ++--- impeller/renderer/renderer_unittests.cc | 24 +++++++++---------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/impeller/entity/entity_unittests.cc b/impeller/entity/entity_unittests.cc index 2b5dc770f367b..35194d5541d0a 100644 --- a/impeller/entity/entity_unittests.cc +++ b/impeller/entity/entity_unittests.cc @@ -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; diff --git a/impeller/renderer/compute_subgroup_unittests.cc b/impeller/renderer/compute_subgroup_unittests.cc index 84bc953ddc3e1..8c9cc4fba14ec 100644 --- a/impeller/renderer/compute_subgroup_unittests.cc +++ b/impeller/renderer/compute_subgroup_unittests.cc @@ -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; diff --git a/impeller/renderer/renderer_unittests.cc b/impeller/renderer/renderer_unittests.cc index d41ca97f82cc4..0273d32c4c58b 100644 --- a/impeller/renderer/renderer_unittests.cc +++ b/impeller/renderer/renderer_unittests.cc @@ -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 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 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 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 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;