From f0b499de5dade1019b7ad8fbd060cc5ee75656a2 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Sat, 28 Oct 2023 19:34:20 -0700 Subject: [PATCH 01/20] [Impeller] add support for specialization constants. --- impeller/base/comparable.h | 22 +++ impeller/entity/BUILD.gn | 34 +---- impeller/entity/contents/content_context.cc | 137 ++++++++++++------ impeller/entity/contents/content_context.h | 116 +++++---------- .../contents/framebuffer_blend_contents.h | 22 ++- ...dvanced_blend.glsl => advanced_blend.frag} | 1 + .../blending/advanced_blend_color.frag | 14 -- .../blending/advanced_blend_colorburn.frag | 14 -- .../blending/advanced_blend_colordodge.frag | 14 -- .../blending/advanced_blend_darken.frag | 14 -- .../blending/advanced_blend_difference.frag | 14 -- .../blending/advanced_blend_exclusion.frag | 14 -- .../blending/advanced_blend_hardlight.frag | 14 -- .../shaders/blending/advanced_blend_hue.frag | 14 -- .../blending/advanced_blend_lighten.frag | 14 -- .../blending/advanced_blend_luminosity.frag | 14 -- .../blending/advanced_blend_multiply.frag | 14 -- .../blending/advanced_blend_overlay.frag | 14 -- .../blending/advanced_blend_saturation.frag | 14 -- .../blending/advanced_blend_screen.frag | 14 -- .../blending/advanced_blend_softlight.frag | 14 -- .../shaders/blending/blend_dispatch.glsl | 61 ++++++++ ...ffer_blend.glsl => framebuffer_blend.frag} | 1 + .../blending/{ios => }/framebuffer_blend.vert | 0 .../blending/ios/framebuffer_blend_color.frag | 14 -- .../ios/framebuffer_blend_colorburn.frag | 14 -- .../ios/framebuffer_blend_colordodge.frag | 14 -- .../ios/framebuffer_blend_darken.frag | 14 -- .../ios/framebuffer_blend_difference.frag | 14 -- .../ios/framebuffer_blend_exclusion.frag | 14 -- .../ios/framebuffer_blend_hardlight.frag | 14 -- .../blending/ios/framebuffer_blend_hue.frag | 14 -- .../ios/framebuffer_blend_lighten.frag | 14 -- .../ios/framebuffer_blend_luminosity.frag | 14 -- .../ios/framebuffer_blend_multiply.frag | 14 -- .../ios/framebuffer_blend_overlay.frag | 14 -- .../ios/framebuffer_blend_saturation.frag | 14 -- .../ios/framebuffer_blend_screen.frag | 14 -- .../ios/framebuffer_blend_softlight.frag | 14 -- .../backend/gles/pipeline_library_gles.cc | 31 +++- .../renderer/backend/gles/proc_table_gles.cc | 35 ++++- .../renderer/backend/gles/proc_table_gles.h | 10 +- .../backend/gles/shader_library_gles.h | 2 +- .../backend/metal/pipeline_library_mtl.h | 2 +- .../backend/metal/pipeline_library_mtl.mm | 20 ++- .../backend/metal/shader_function_mtl.h | 5 + .../backend/metal/shader_function_mtl.mm | 26 +++- .../backend/metal/shader_library_mtl.h | 2 +- .../backend/metal/shader_library_mtl.mm | 6 +- .../backend/vulkan/pipeline_library_vk.cc | 29 ++++ impeller/renderer/pipeline_builder.h | 4 +- impeller/renderer/pipeline_descriptor.cc | 14 +- impeller/renderer/pipeline_descriptor.h | 31 +++- impeller/renderer/shader_function.cc | 4 + impeller/renderer/shader_function.h | 3 + 55 files changed, 434 insertions(+), 604 deletions(-) rename impeller/entity/shaders/blending/{advanced_blend.glsl => advanced_blend.frag} (98%) delete mode 100644 impeller/entity/shaders/blending/advanced_blend_color.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_colorburn.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_colordodge.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_darken.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_difference.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_exclusion.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_hardlight.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_hue.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_lighten.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_luminosity.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_multiply.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_overlay.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_saturation.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_screen.frag delete mode 100644 impeller/entity/shaders/blending/advanced_blend_softlight.frag create mode 100644 impeller/entity/shaders/blending/blend_dispatch.glsl rename impeller/entity/shaders/blending/{ios/framebuffer_blend.glsl => framebuffer_blend.frag} (97%) rename impeller/entity/shaders/blending/{ios => }/framebuffer_blend.vert (100%) delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_color.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_colorburn.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_colordodge.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_darken.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_difference.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_exclusion.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_hardlight.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_hue.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_lighten.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_luminosity.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_multiply.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_overlay.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_saturation.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_screen.frag delete mode 100644 impeller/entity/shaders/blending/ios/framebuffer_blend_softlight.frag diff --git a/impeller/base/comparable.h b/impeller/base/comparable.h index 1937aebf2e0b3..5e54153f7d493 100644 --- a/impeller/base/comparable.h +++ b/impeller/base/comparable.h @@ -93,6 +93,28 @@ bool DeepCompareMap(const std::map>& lhs, return true; } +template +bool CompareUnorderedMap(const std::unordered_map& lhs, + const std::unordered_map& rhs) { + if (lhs.size() != rhs.size()) { + return false; + } + for (const auto& [key, value] : lhs) { + auto found = rhs.find(key); + if (found == rhs.end() || found->second != value) { + return false; + } + } + for (const auto& [key, value] : rhs) { + auto found = lhs.find(key); + if (found == rhs.end() || found->second != value) { + return false; + } + } + + return true; +} + } // namespace impeller namespace std { diff --git a/impeller/entity/BUILD.gn b/impeller/entity/BUILD.gn index fbf674c69a58a..4e1ce88280d4a 100644 --- a/impeller/entity/BUILD.gn +++ b/impeller/entity/BUILD.gn @@ -15,21 +15,7 @@ impeller_shaders("entity_shaders") { shaders = [ "shaders/blending/advanced_blend.vert", - "shaders/blending/advanced_blend_color.frag", - "shaders/blending/advanced_blend_colorburn.frag", - "shaders/blending/advanced_blend_colordodge.frag", - "shaders/blending/advanced_blend_darken.frag", - "shaders/blending/advanced_blend_difference.frag", - "shaders/blending/advanced_blend_exclusion.frag", - "shaders/blending/advanced_blend_hardlight.frag", - "shaders/blending/advanced_blend_hue.frag", - "shaders/blending/advanced_blend_lighten.frag", - "shaders/blending/advanced_blend_luminosity.frag", - "shaders/blending/advanced_blend_multiply.frag", - "shaders/blending/advanced_blend_overlay.frag", - "shaders/blending/advanced_blend_saturation.frag", - "shaders/blending/advanced_blend_screen.frag", - "shaders/blending/advanced_blend_softlight.frag", + "shaders/blending/advanced_blend.frag", "shaders/blending/blend.frag", "shaders/blending/blend.vert", "shaders/border_mask_blur.frag", @@ -115,22 +101,8 @@ impeller_shaders("framebuffer_blend_entity_shaders") { } shaders = [ - "shaders/blending/ios/framebuffer_blend.vert", - "shaders/blending/ios/framebuffer_blend_color.frag", - "shaders/blending/ios/framebuffer_blend_colorburn.frag", - "shaders/blending/ios/framebuffer_blend_colordodge.frag", - "shaders/blending/ios/framebuffer_blend_darken.frag", - "shaders/blending/ios/framebuffer_blend_difference.frag", - "shaders/blending/ios/framebuffer_blend_exclusion.frag", - "shaders/blending/ios/framebuffer_blend_hardlight.frag", - "shaders/blending/ios/framebuffer_blend_hue.frag", - "shaders/blending/ios/framebuffer_blend_lighten.frag", - "shaders/blending/ios/framebuffer_blend_luminosity.frag", - "shaders/blending/ios/framebuffer_blend_multiply.frag", - "shaders/blending/ios/framebuffer_blend_overlay.frag", - "shaders/blending/ios/framebuffer_blend_saturation.frag", - "shaders/blending/ios/framebuffer_blend_screen.frag", - "shaders/blending/ios/framebuffer_blend_softlight.frag", + "shaders/blending/framebuffer_blend.vert", + "shaders/blending/framebuffer_blend.frag", ] } diff --git a/impeller/entity/contents/content_context.cc b/impeller/entity/contents/content_context.cc index 560c9d804800e..08b70f7c67ea3 100644 --- a/impeller/entity/contents/content_context.cc +++ b/impeller/entity/contents/content_context.cc @@ -5,15 +5,15 @@ #include "impeller/entity/contents/content_context.h" #include -#include #include "impeller/base/strings.h" #include "impeller/core/formats.h" +#include "impeller/entity/contents/framebuffer_blend_contents.h" #include "impeller/entity/entity.h" #include "impeller/entity/render_target_cache.h" #include "impeller/renderer/command_buffer.h" +#include "impeller/renderer/pipeline_descriptor.h" #include "impeller/renderer/pipeline_library.h" -#include "impeller/renderer/render_pass.h" #include "impeller/renderer/render_target.h" #include "impeller/tessellator/tessellator.h" #include "impeller/typographer/typographer_context.h" @@ -155,8 +155,10 @@ void ContentContextOptions::ApplyToPipelineDescriptor( template static std::unique_ptr CreateDefaultPipeline( - const Context& context) { - auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context); + const Context& context, + const std::map& constants = {}) { + auto desc = + PipelineT::Builder::MakeDefaultPipelineDescriptor(context, constants); if (!desc.has_value()) { return nullptr; } @@ -217,53 +219,98 @@ ContentContext::ContentContext( } if (context_->GetCapabilities()->SupportsFramebufferFetch()) { - framebuffer_blend_color_pipelines_.CreateDefault(*context_, - options_trianglestrip); - framebuffer_blend_colorburn_pipelines_.CreateDefault(*context_, - options_trianglestrip); + framebuffer_blend_color_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kColor)}); + framebuffer_blend_colorburn_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kColorBurn)}); framebuffer_blend_colordodge_pipelines_.CreateDefault( - *context_, options_trianglestrip); - framebuffer_blend_darken_pipelines_.CreateDefault(*context_, - options_trianglestrip); + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kColorDodge)}); + framebuffer_blend_darken_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kDarken)}); framebuffer_blend_difference_pipelines_.CreateDefault( - *context_, options_trianglestrip); - framebuffer_blend_exclusion_pipelines_.CreateDefault(*context_, - options_trianglestrip); - framebuffer_blend_hardlight_pipelines_.CreateDefault(*context_, - options_trianglestrip); - framebuffer_blend_hue_pipelines_.CreateDefault(*context_, - options_trianglestrip); - framebuffer_blend_lighten_pipelines_.CreateDefault(*context_, - options_trianglestrip); + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kDifference)}); + framebuffer_blend_exclusion_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kExclusion)}); + framebuffer_blend_hardlight_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kHardLight)}); + framebuffer_blend_hue_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kHue)}); + framebuffer_blend_lighten_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kLighten)}); framebuffer_blend_luminosity_pipelines_.CreateDefault( - *context_, options_trianglestrip); - framebuffer_blend_multiply_pipelines_.CreateDefault(*context_, - options_trianglestrip); - framebuffer_blend_overlay_pipelines_.CreateDefault(*context_, - options_trianglestrip); + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kLuminosity)}); + framebuffer_blend_multiply_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kMultiply)}); + framebuffer_blend_overlay_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kOverlay)}); framebuffer_blend_saturation_pipelines_.CreateDefault( - *context_, options_trianglestrip); - framebuffer_blend_screen_pipelines_.CreateDefault(*context_, - options_trianglestrip); - framebuffer_blend_softlight_pipelines_.CreateDefault(*context_, - options_trianglestrip); + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kSaturation)}); + framebuffer_blend_screen_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kScreen)}); + framebuffer_blend_softlight_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kSoftLight)}); } - blend_color_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_colorburn_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_colordodge_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_darken_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_difference_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_exclusion_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_hardlight_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_hue_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_lighten_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_luminosity_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_multiply_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_overlay_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_saturation_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_screen_pipelines_.CreateDefault(*context_, options_trianglestrip); - blend_softlight_pipelines_.CreateDefault(*context_, options_trianglestrip); + blend_color_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kColor)}); + blend_colorburn_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kColorBurn)}); + blend_colordodge_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kColorDodge)}); + blend_darken_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kDarken)}); + blend_difference_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kDifference)}); + blend_exclusion_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kExclusion)}); + blend_hardlight_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kHardLight)}); + blend_hue_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kHue)}); + blend_lighten_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kLighten)}); + blend_luminosity_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kLuminosity)}); + blend_multiply_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kMultiply)}); + blend_overlay_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kOverlay)}); + blend_saturation_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kSaturation)}); + blend_screen_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kScreen)}); + blend_softlight_pipelines_.CreateDefault( + *context_, options_trianglestrip, + {static_cast(BlendSelectValues::kSoftLight)}); rrect_blur_pipelines_.CreateDefault(*context_, options_trianglestrip); texture_blend_pipelines_.CreateDefault(*context_, options); diff --git a/impeller/entity/contents/content_context.h b/impeller/entity/contents/content_context.h index de55d92e6838e..ded67be8cacb9 100644 --- a/impeller/entity/contents/content_context.h +++ b/impeller/entity/contents/content_context.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include #include @@ -75,39 +76,11 @@ #include "impeller/entity/radial_gradient_ssbo_fill.frag.h" #include "impeller/entity/sweep_gradient_ssbo_fill.frag.h" +#include "impeller/entity/advanced_blend.frag.h" #include "impeller/entity/advanced_blend.vert.h" -#include "impeller/entity/advanced_blend_color.frag.h" -#include "impeller/entity/advanced_blend_colorburn.frag.h" -#include "impeller/entity/advanced_blend_colordodge.frag.h" -#include "impeller/entity/advanced_blend_darken.frag.h" -#include "impeller/entity/advanced_blend_difference.frag.h" -#include "impeller/entity/advanced_blend_exclusion.frag.h" -#include "impeller/entity/advanced_blend_hardlight.frag.h" -#include "impeller/entity/advanced_blend_hue.frag.h" -#include "impeller/entity/advanced_blend_lighten.frag.h" -#include "impeller/entity/advanced_blend_luminosity.frag.h" -#include "impeller/entity/advanced_blend_multiply.frag.h" -#include "impeller/entity/advanced_blend_overlay.frag.h" -#include "impeller/entity/advanced_blend_saturation.frag.h" -#include "impeller/entity/advanced_blend_screen.frag.h" -#include "impeller/entity/advanced_blend_softlight.frag.h" +#include "impeller/entity/framebuffer_blend.frag.h" #include "impeller/entity/framebuffer_blend.vert.h" -#include "impeller/entity/framebuffer_blend_color.frag.h" -#include "impeller/entity/framebuffer_blend_colorburn.frag.h" -#include "impeller/entity/framebuffer_blend_colordodge.frag.h" -#include "impeller/entity/framebuffer_blend_darken.frag.h" -#include "impeller/entity/framebuffer_blend_difference.frag.h" -#include "impeller/entity/framebuffer_blend_exclusion.frag.h" -#include "impeller/entity/framebuffer_blend_hardlight.frag.h" -#include "impeller/entity/framebuffer_blend_hue.frag.h" -#include "impeller/entity/framebuffer_blend_lighten.frag.h" -#include "impeller/entity/framebuffer_blend_luminosity.frag.h" -#include "impeller/entity/framebuffer_blend_multiply.frag.h" -#include "impeller/entity/framebuffer_blend_overlay.frag.h" -#include "impeller/entity/framebuffer_blend_saturation.frag.h" -#include "impeller/entity/framebuffer_blend_screen.frag.h" -#include "impeller/entity/framebuffer_blend_softlight.frag.h" #ifdef IMPELLER_ENABLE_OPENGLES #include "impeller/entity/texture_fill_external.frag.h" @@ -192,93 +165,82 @@ using YUVToRGBFilterPipeline = RenderPipelineT; // Advanced blends -using BlendColorPipeline = RenderPipelineT; +using BlendColorPipeline = + RenderPipelineT; using BlendColorBurnPipeline = - RenderPipelineT; + RenderPipelineT; using BlendColorDodgePipeline = - RenderPipelineT; -using BlendDarkenPipeline = RenderPipelineT; + RenderPipelineT; +using BlendDarkenPipeline = + RenderPipelineT; using BlendDifferencePipeline = - RenderPipelineT; + RenderPipelineT; using BlendExclusionPipeline = - RenderPipelineT; + RenderPipelineT; using BlendHardLightPipeline = - RenderPipelineT; + RenderPipelineT; using BlendHuePipeline = - RenderPipelineT; + RenderPipelineT; using BlendLightenPipeline = - RenderPipelineT; + RenderPipelineT; using BlendLuminosityPipeline = - RenderPipelineT; + RenderPipelineT; using BlendMultiplyPipeline = - RenderPipelineT; + RenderPipelineT; using BlendOverlayPipeline = - RenderPipelineT; + RenderPipelineT; using BlendSaturationPipeline = - RenderPipelineT; -using BlendScreenPipeline = RenderPipelineT; + RenderPipelineT; +using BlendScreenPipeline = + RenderPipelineT; using BlendSoftLightPipeline = - RenderPipelineT; + RenderPipelineT; // Framebuffer Advanced Blends using FramebufferBlendColorPipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendColorBurnPipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendColorDodgePipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendDarkenPipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendDifferencePipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendExclusionPipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendHardLightPipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendHuePipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendLightenPipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendLuminosityPipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendMultiplyPipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendOverlayPipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendSaturationPipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendScreenPipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; using FramebufferBlendSoftLightPipeline = RenderPipelineT; + FramebufferBlendFragmentShader>; /// Geometry Pipelines using PointsComputeShaderPipeline = ComputePipelineBuilder; @@ -738,8 +700,10 @@ class ContentContext { } void CreateDefault(const Context& context, - const ContentContextOptions& options) { - auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context); + const ContentContextOptions& options, + const std::initializer_list& constants = {}) { + auto desc = + PipelineT::Builder::MakeDefaultPipelineDescriptor(context, constants); if (!desc.has_value()) { VALIDATION_LOG << "Failed to create default pipeline."; return; diff --git a/impeller/entity/contents/framebuffer_blend_contents.h b/impeller/entity/contents/framebuffer_blend_contents.h index db3b2ca628768..ac5b57229f3b0 100644 --- a/impeller/entity/contents/framebuffer_blend_contents.h +++ b/impeller/entity/contents/framebuffer_blend_contents.h @@ -4,17 +4,31 @@ #pragma once -#include #include -#include -#include "flutter/fml/macros.h" -#include "flutter/impeller/core/texture.h" #include "impeller/entity/contents/color_source_contents.h" #include "impeller/entity/entity.h" namespace impeller { +enum class BlendSelectValues { + kScreen = 0, + kOverlay, + kDarken, + kLighten, + kColorDodge, + kColorBurn, + kHardLight, + kSoftLight, + kDifference, + kExclusion, + kMultiply, + kHue, + kSaturation, + kColor, + kLuminosity, +}; + class FramebufferBlendContents final : public ColorSourceContents { public: FramebufferBlendContents(); diff --git a/impeller/entity/shaders/blending/advanced_blend.glsl b/impeller/entity/shaders/blending/advanced_blend.frag similarity index 98% rename from impeller/entity/shaders/blending/advanced_blend.glsl rename to impeller/entity/shaders/blending/advanced_blend.frag index 9a11dce29f789..513fc8fc9022a 100644 --- a/impeller/entity/shaders/blending/advanced_blend.glsl +++ b/impeller/entity/shaders/blending/advanced_blend.frag @@ -6,6 +6,7 @@ #include #include #include +#include "blend_dispatch.glsl" uniform BlendInfo { float16_t dst_input_alpha; diff --git a/impeller/entity/shaders/blending/advanced_blend_color.frag b/impeller/entity/shaders/blending/advanced_blend_color.frag deleted file mode 100644 index 20ca9499bbca5..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_color.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendColor(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_colorburn.frag b/impeller/entity/shaders/blending/advanced_blend_colorburn.frag deleted file mode 100644 index a57d5c550130c..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_colorburn.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendColorBurn(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_colordodge.frag b/impeller/entity/shaders/blending/advanced_blend_colordodge.frag deleted file mode 100644 index 8766c01fd0fbc..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_colordodge.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendColorDodge(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_darken.frag b/impeller/entity/shaders/blending/advanced_blend_darken.frag deleted file mode 100644 index 4f423b55596dc..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_darken.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendDarken(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_difference.frag b/impeller/entity/shaders/blending/advanced_blend_difference.frag deleted file mode 100644 index 9e3a927ddb124..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_difference.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendDifference(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_exclusion.frag b/impeller/entity/shaders/blending/advanced_blend_exclusion.frag deleted file mode 100644 index e8e3911817fbf..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_exclusion.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendExclusion(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_hardlight.frag b/impeller/entity/shaders/blending/advanced_blend_hardlight.frag deleted file mode 100644 index 96a94de56f1c0..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_hardlight.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendHardLight(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_hue.frag b/impeller/entity/shaders/blending/advanced_blend_hue.frag deleted file mode 100644 index 5f2afb6332073..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_hue.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendHue(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_lighten.frag b/impeller/entity/shaders/blending/advanced_blend_lighten.frag deleted file mode 100644 index fa421d7ae1cbc..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_lighten.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendLighten(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_luminosity.frag b/impeller/entity/shaders/blending/advanced_blend_luminosity.frag deleted file mode 100644 index c4ee5598f16c0..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_luminosity.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendLuminosity(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_multiply.frag b/impeller/entity/shaders/blending/advanced_blend_multiply.frag deleted file mode 100644 index bda2e1ed44419..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_multiply.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendMultiply(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_overlay.frag b/impeller/entity/shaders/blending/advanced_blend_overlay.frag deleted file mode 100644 index 5def270326a7c..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_overlay.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendOverlay(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_saturation.frag b/impeller/entity/shaders/blending/advanced_blend_saturation.frag deleted file mode 100644 index 2122b57a0b6a2..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_saturation.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendSaturation(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_screen.frag b/impeller/entity/shaders/blending/advanced_blend_screen.frag deleted file mode 100644 index 98690c3ab5ea8..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_screen.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendScreen(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/advanced_blend_softlight.frag b/impeller/entity/shaders/blending/advanced_blend_softlight.frag deleted file mode 100644 index 130f02807baab..0000000000000 --- a/impeller/entity/shaders/blending/advanced_blend_softlight.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendSoftLight(dst, src); -} - -#include "advanced_blend.glsl" diff --git a/impeller/entity/shaders/blending/blend_dispatch.glsl b/impeller/entity/shaders/blending/blend_dispatch.glsl new file mode 100644 index 0000000000000..e256cbc2cae26 --- /dev/null +++ b/impeller/entity/shaders/blending/blend_dispatch.glsl @@ -0,0 +1,61 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include +#include +#include + +layout(constant_id = 0) const int blend_type = 0; + +// kScreen = 0, +// kOverlay, +// kDarken, +// kLighten, +// kColorDodge, +// kColorBurn, +// kHardLight, +// kSoftLight, +// kDifference, +// kExclusion, +// kMultiply, +// kHue, +// kSaturation, +// kColor, +// kLuminosity, +f16vec3 Blend(f16vec3 dst, f16vec3 src) { + switch (blend_type) { + case 0: + return IPBlendScreen(dst, src); + case 1: + return IPBlendOverlay(dst, src); + case 2: + return IPBlendDarken(dst, src); + case 3: + return IPBlendLighten(dst, src); + case 4: + return IPBlendColorDodge(dst, src); + case 5: + return IPBlendColorBurn(dst, src); + case 6: + return IPBlendHardLight(dst, src); + case 7: + return IPBlendSoftLight(dst, src); + case 8: + return IPBlendDifference(dst, src); + case 9: + return IPBlendExclusion(dst, src); + case 10: + return IPBlendMultiply(dst, src); + case 11: + return IPBlendHue(dst, src); + case 12: + return IPBlendSaturation(dst, src); + case 13: + return IPBlendColor(dst, src); + case 14: + return IPBlendLuminosity(dst, src); + default: + return f16vec3(0.0hf); + } +} diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend.glsl b/impeller/entity/shaders/blending/framebuffer_blend.frag similarity index 97% rename from impeller/entity/shaders/blending/ios/framebuffer_blend.glsl rename to impeller/entity/shaders/blending/framebuffer_blend.frag index 67bd9cad8370e..a8ad6143d044d 100644 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend.glsl +++ b/impeller/entity/shaders/blending/framebuffer_blend.frag @@ -8,6 +8,7 @@ #include #include #include +#include "blend_dispatch.glsl" layout(set = 0, binding = 0, diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend.vert b/impeller/entity/shaders/blending/framebuffer_blend.vert similarity index 100% rename from impeller/entity/shaders/blending/ios/framebuffer_blend.vert rename to impeller/entity/shaders/blending/framebuffer_blend.vert diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_color.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_color.frag deleted file mode 100644 index 4798cca350598..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_color.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendColor(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_colorburn.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_colorburn.frag deleted file mode 100644 index 4c53c2b7ab16a..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_colorburn.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendColorBurn(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_colordodge.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_colordodge.frag deleted file mode 100644 index d07de5925d8fb..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_colordodge.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendColorDodge(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_darken.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_darken.frag deleted file mode 100644 index e2e42f238558d..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_darken.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendDarken(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_difference.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_difference.frag deleted file mode 100644 index b2d26ca8e6b0f..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_difference.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendDifference(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_exclusion.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_exclusion.frag deleted file mode 100644 index 6358bcc2acbf6..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_exclusion.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendExclusion(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_hardlight.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_hardlight.frag deleted file mode 100644 index 19a370b7da19d..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_hardlight.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendHardLight(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_hue.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_hue.frag deleted file mode 100644 index 653e570dd7287..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_hue.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendHue(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_lighten.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_lighten.frag deleted file mode 100644 index 93b5bcaa7d4bc..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_lighten.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendLighten(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_luminosity.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_luminosity.frag deleted file mode 100644 index 93cb15f3bba12..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_luminosity.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendLuminosity(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_multiply.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_multiply.frag deleted file mode 100644 index bc6621ae070d3..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_multiply.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendMultiply(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_overlay.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_overlay.frag deleted file mode 100644 index 2238c38b707c0..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_overlay.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendOverlay(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_saturation.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_saturation.frag deleted file mode 100644 index e731de1562031..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_saturation.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendSaturation(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_screen.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_screen.frag deleted file mode 100644 index f8f2d569f0222..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_screen.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendScreen(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/entity/shaders/blending/ios/framebuffer_blend_softlight.frag b/impeller/entity/shaders/blending/ios/framebuffer_blend_softlight.frag deleted file mode 100644 index 1902dafa42f0f..0000000000000 --- a/impeller/entity/shaders/blending/ios/framebuffer_blend_softlight.frag +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -precision mediump float; - -#include -#include - -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - return IPBlendSoftLight(dst, src); -} - -#include "framebuffer_blend.glsl" diff --git a/impeller/renderer/backend/gles/pipeline_library_gles.cc b/impeller/renderer/backend/gles/pipeline_library_gles.cc index b0190826e5771..12842229a51bf 100644 --- a/impeller/renderer/backend/gles/pipeline_library_gles.cc +++ b/impeller/renderer/backend/gles/pipeline_library_gles.cc @@ -33,6 +33,19 @@ static std::string GetShaderInfoLog(const ProcTableGLES& gl, GLuint shader) { return log_string; } +static std::string GetShaderSource(const ProcTableGLES& gl, GLuint shader) { + // Arbitrarily chosen size that should be larger than most shaders. + // Since this only fires on compilation errors the performance shouldn't + // matter. + auto data = static_cast(malloc(10240)); + GLsizei length; + gl.GetShaderSource(shader, 10240, &length, data); + + auto result = std::string{data, static_cast(length)}; + free(data); + return result; +} + static void LogShaderCompilationFailure(const ProcTableGLES& gl, GLuint shader, const std::string& name, @@ -63,10 +76,7 @@ static void LogShaderCompilationFailure(const ProcTableGLES& gl, stream << " shader for '" << name << "' with error:" << std::endl; stream << GetShaderInfoLog(gl, shader) << std::endl; stream << "Shader source was: " << std::endl; - stream << std::string{reinterpret_cast( - source_mapping.GetMapping()), - source_mapping.GetSize()} - << std::endl; + stream << GetShaderSource(gl, shader) << std::endl; VALIDATION_LOG << stream.str(); } @@ -105,8 +115,17 @@ static bool LinkProgram( fml::ScopedCleanupClosure delete_frag_shader( [&gl, frag_shader]() { gl.DeleteShader(frag_shader); }); - gl.ShaderSourceMapping(vert_shader, *vert_mapping); - gl.ShaderSourceMapping(frag_shader, *frag_mapping); + std::vector defines = {}; + size_t index = 0; + for (const auto value : descriptor.GetSpecializationConstants()) { + std::stringstream ss; + ss << "#define SPIRV_CROSS_CONSTANT_ID_" << index << " " << value; + defines.emplace_back(ss.str()); + index++; + } + + gl.ShaderSourceMapping(vert_shader, *vert_mapping, defines); + gl.ShaderSourceMapping(frag_shader, *frag_mapping, defines); gl.CompileShader(vert_shader); gl.CompileShader(frag_shader); diff --git a/impeller/renderer/backend/gles/proc_table_gles.cc b/impeller/renderer/backend/gles/proc_table_gles.cc index 2541424ad9439..d5b9473d9baa0 100644 --- a/impeller/renderer/backend/gles/proc_table_gles.cc +++ b/impeller/renderer/backend/gles/proc_table_gles.cc @@ -6,6 +6,7 @@ #include +#include "fml/closure.h" #include "impeller/base/allocation.h" #include "impeller/base/comparable.h" #include "impeller/base/validation.h" @@ -138,11 +139,37 @@ bool ProcTableGLES::IsValid() const { return is_valid_; } -void ProcTableGLES::ShaderSourceMapping(GLuint shader, - const fml::Mapping& mapping) const { +void ProcTableGLES::ShaderSourceMapping( + GLuint shader, + const fml::Mapping& mapping, + const std::vector& defines) const { + if (defines.empty()) { + const GLchar* sources[] = { + reinterpret_cast(mapping.GetMapping())}; + const GLint lengths[] = {static_cast(mapping.GetSize())}; + ShaderSource(shader, 1u, sources, lengths); + return; + } + auto shader_source = std::string{ + reinterpret_cast(mapping.GetMapping()), mapping.GetSize()}; + + auto index = shader_source.find('\n'); + if (index == std::string::npos) { + VALIDATION_LOG << "Failed to append constant data to shader"; + return; + } + + std::stringstream ss; + for (auto define : defines) { + ss << define; + ss << '\n'; + } + auto define_string = ss.str(); + shader_source.insert(index + 1, define_string); + const GLchar* sources[] = { - reinterpret_cast(mapping.GetMapping())}; - const GLint lengths[] = {static_cast(mapping.GetSize())}; + reinterpret_cast(shader_source.c_str())}; + const GLint lengths[] = {static_cast(shader_source.size())}; ShaderSource(shader, 1u, sources, lengths); } diff --git a/impeller/renderer/backend/gles/proc_table_gles.h b/impeller/renderer/backend/gles/proc_table_gles.h index 01c2f8dc9d937..cf726a6f5035b 100644 --- a/impeller/renderer/backend/gles/proc_table_gles.h +++ b/impeller/renderer/backend/gles/proc_table_gles.h @@ -185,6 +185,7 @@ struct GLProc { PROC(UseProgram); \ PROC(VertexAttribPointer); \ PROC(Viewport); \ + PROC(GetShaderSource); \ PROC(ReadPixels); #define FOR_EACH_IMPELLER_GLES3_PROC(PROC) PROC(BlitFramebuffer); @@ -232,7 +233,14 @@ class ProcTableGLES { bool IsValid() const; - void ShaderSourceMapping(GLuint shader, const fml::Mapping& mapping) const; + /// @brief Set the source for the attached [shader]. + /// + /// Optionally, [defines] may contain a string value that will be + /// append to the shader source after the version marker. This can be used to + /// support static specialization. For example, setting "#define Foo 1". + void ShaderSourceMapping(GLuint shader, + const fml::Mapping& mapping, + const std::vector& defines = {}) const; const DescriptionGLES* GetDescription() const; diff --git a/impeller/renderer/backend/gles/shader_library_gles.h b/impeller/renderer/backend/gles/shader_library_gles.h index cd1ed53a7d416..b2acd2228182f 100644 --- a/impeller/renderer/backend/gles/shader_library_gles.h +++ b/impeller/renderer/backend/gles/shader_library_gles.h @@ -30,7 +30,7 @@ class ShaderLibraryGLES final : public ShaderLibrary { ShaderFunctionMap functions_ IPLR_GUARDED_BY(functions_mutex_); bool is_valid_ = false; - ShaderLibraryGLES( + explicit ShaderLibraryGLES( const std::vector>& shader_libraries); // |ShaderLibrary| diff --git a/impeller/renderer/backend/metal/pipeline_library_mtl.h b/impeller/renderer/backend/metal/pipeline_library_mtl.h index 5b333c22684ac..06489545e9210 100644 --- a/impeller/renderer/backend/metal/pipeline_library_mtl.h +++ b/impeller/renderer/backend/metal/pipeline_library_mtl.h @@ -27,7 +27,7 @@ class PipelineLibraryMTL final : public PipelineLibrary { PipelineMap pipelines_; ComputePipelineMap compute_pipelines_; - PipelineLibraryMTL(id device); + explicit PipelineLibraryMTL(id device); // |PipelineLibrary| bool IsValid() const override; diff --git a/impeller/renderer/backend/metal/pipeline_library_mtl.mm b/impeller/renderer/backend/metal/pipeline_library_mtl.mm index 98895ce336ddd..c7c180aa57c83 100644 --- a/impeller/renderer/backend/metal/pipeline_library_mtl.mm +++ b/impeller/renderer/backend/metal/pipeline_library_mtl.mm @@ -4,6 +4,7 @@ #include "impeller/renderer/backend/metal/pipeline_library_mtl.h" +#include #include #include "flutter/fml/build_config.h" @@ -28,14 +29,25 @@ descriptor.label = @(desc.GetLabel().c_str()); descriptor.rasterSampleCount = static_cast(desc.GetSampleCount()); + const auto& constants = desc.GetSpecializationConstants(); for (const auto& entry : desc.GetStageEntrypoints()) { if (entry.first == ShaderStage::kVertex) { - descriptor.vertexFunction = - ShaderFunctionMTL::Cast(*entry.second).GetMTLFunction(); + if (constants.empty()) { + descriptor.vertexFunction = + ShaderFunctionMTL::Cast(*entry.second).GetMTLFunction(); + } else { + descriptor.vertexFunction = ShaderFunctionMTL::Cast(*entry.second) + .GetMTLFunctionSpecialized(constants); + } } if (entry.first == ShaderStage::kFragment) { - descriptor.fragmentFunction = - ShaderFunctionMTL::Cast(*entry.second).GetMTLFunction(); + if (constants.empty()) { + descriptor.fragmentFunction = + ShaderFunctionMTL::Cast(*entry.second).GetMTLFunction(); + } else { + descriptor.fragmentFunction = ShaderFunctionMTL::Cast(*entry.second) + .GetMTLFunctionSpecialized(constants); + } } } diff --git a/impeller/renderer/backend/metal/shader_function_mtl.h b/impeller/renderer/backend/metal/shader_function_mtl.h index c47eaf6799fd3..9ed1fff86c960 100644 --- a/impeller/renderer/backend/metal/shader_function_mtl.h +++ b/impeller/renderer/backend/metal/shader_function_mtl.h @@ -21,13 +21,18 @@ class ShaderFunctionMTL final id GetMTLFunction() const; + id GetMTLFunctionSpecialized( + const std::vector& constants) const; + private: friend class ShaderLibraryMTL; id function_ = nullptr; + id library_ = nullptr; ShaderFunctionMTL(UniqueID parent_library_id, id function, + id library, std::string name, ShaderStage stage); diff --git a/impeller/renderer/backend/metal/shader_function_mtl.mm b/impeller/renderer/backend/metal/shader_function_mtl.mm index 04751af1b8f13..589c0ff7f6eea 100644 --- a/impeller/renderer/backend/metal/shader_function_mtl.mm +++ b/impeller/renderer/backend/metal/shader_function_mtl.mm @@ -8,13 +8,37 @@ ShaderFunctionMTL::ShaderFunctionMTL(UniqueID parent_library_id, id function, + id library, std::string name, ShaderStage stage) : ShaderFunction(parent_library_id, std::move(name), stage), - function_(function) {} + function_(function), + library_(library) {} ShaderFunctionMTL::~ShaderFunctionMTL() = default; +id ShaderFunctionMTL::GetMTLFunctionSpecialized( + const std::vector& constants) const { + MTLFunctionConstantValues* constantValues = + [[MTLFunctionConstantValues alloc] init]; + size_t index = 0; + for (const auto value : constants) { + int copied_value = value; + [constantValues setConstantValue:&copied_value + type:MTLDataTypeInt + atIndex:index]; + index++; + } + NSError* error = nil; + auto result = [library_ newFunctionWithName:@(GetName().data()) + constantValues:constantValues + error:&error]; + if (error != nil) { + return nil; + } + return result; +} + id ShaderFunctionMTL::GetMTLFunction() const { return function_; } diff --git a/impeller/renderer/backend/metal/shader_library_mtl.h b/impeller/renderer/backend/metal/shader_library_mtl.h index 5b1bc7c75cd81..c401696c7ec45 100644 --- a/impeller/renderer/backend/metal/shader_library_mtl.h +++ b/impeller/renderer/backend/metal/shader_library_mtl.h @@ -39,7 +39,7 @@ class ShaderLibraryMTL final : public ShaderLibrary { ShaderFunctionMap functions_; bool is_valid_ = false; - ShaderLibraryMTL(NSArray>* libraries); + explicit ShaderLibraryMTL(NSArray>* libraries); // |ShaderLibrary| std::shared_ptr GetFunction(std::string_view name, diff --git a/impeller/renderer/backend/metal/shader_library_mtl.mm b/impeller/renderer/backend/metal/shader_library_mtl.mm index 94fb1e335b16d..45eb5d5e3c40e 100644 --- a/impeller/renderer/backend/metal/shader_library_mtl.mm +++ b/impeller/renderer/backend/metal/shader_library_mtl.mm @@ -55,6 +55,7 @@ static MTLFunctionType ToMTLFunctionType(ShaderStage stage) { ShaderKey key(name, stage); id function = nil; + id library = nil; { ReaderLock lock(libraries_mutex_); @@ -64,7 +65,8 @@ static MTLFunctionType ToMTLFunctionType(ShaderStage stage) { } for (size_t i = 0, count = [libraries_ count]; i < count; i++) { - function = [libraries_[i] newFunctionWithName:@(name.data())]; + library = libraries_[i]; + function = [library newFunctionWithName:@(name.data())]; if (function) { break; } @@ -81,7 +83,7 @@ static MTLFunctionType ToMTLFunctionType(ShaderStage stage) { } auto func = std::shared_ptr(new ShaderFunctionMTL( - library_id_, function, {name.data(), name.size()}, stage)); + library_id_, function, library, {name.data(), name.size()}, stage)); functions_[key] = func; return func; diff --git a/impeller/renderer/backend/vulkan/pipeline_library_vk.cc b/impeller/renderer/backend/vulkan/pipeline_library_vk.cc index 830d2d08120e1..c70edf9b38ade 100644 --- a/impeller/renderer/backend/vulkan/pipeline_library_vk.cc +++ b/impeller/renderer/backend/vulkan/pipeline_library_vk.cc @@ -277,7 +277,15 @@ std::unique_ptr PipelineLibraryVK::CreatePipeline( //---------------------------------------------------------------------------- /// Shader Stages /// + const auto& constants = desc.GetSpecializationConstants(); + + std::vector> map_entries( + desc.GetStageEntrypoints().size()); + std::vector specialization_infos( + desc.GetStageEntrypoints().size()); std::vector shader_stages; + + size_t entrypoint_count = 0; for (const auto& entrypoint : desc.GetStageEntrypoints()) { auto stage = ToVKShaderStageFlagBits(entrypoint.first); if (!stage.has_value()) { @@ -285,12 +293,33 @@ std::unique_ptr PipelineLibraryVK::CreatePipeline( << desc.GetLabel(); return nullptr; } + + size_t index = 0; + std::vector& entries = + map_entries[entrypoint_count]; + for (auto value : constants) { + vk::SpecializationMapEntry entry; + entry.offset = (index * sizeof(int)); + entry.size = sizeof(int); + entry.constantID = index; + entries.emplace_back(entry); + index++; + } + + vk::SpecializationInfo& specialization_info = + specialization_infos[entrypoint_count]; + specialization_info.setMapEntries(map_entries[entrypoint_count]); + specialization_info.setPData(constants.data()); + specialization_info.setDataSize(sizeof(int) * constants.size()); + vk::PipelineShaderStageCreateInfo info; info.setStage(stage.value()); info.setPName("main"); info.setModule( ShaderFunctionVK::Cast(entrypoint.second.get())->GetModule()); + info.setPSpecializationInfo(&specialization_info); shader_stages.push_back(info); + entrypoint_count++; } pipeline_info.setStages(shader_stages); diff --git a/impeller/renderer/pipeline_builder.h b/impeller/renderer/pipeline_builder.h index 593df8057ff75..293a2b7e17aac 100644 --- a/impeller/renderer/pipeline_builder.h +++ b/impeller/renderer/pipeline_builder.h @@ -48,8 +48,10 @@ struct PipelineBuilder { /// context, a pipeline descriptor. /// static std::optional MakeDefaultPipelineDescriptor( - const Context& context) { + const Context& context, + const std::vector& constants = {}) { PipelineDescriptor desc; + desc.SetSpecializationConstants(constants); if (InitializePipelineDescriptorDefaults(context, desc)) { return {std::move(desc)}; } diff --git a/impeller/renderer/pipeline_descriptor.cc b/impeller/renderer/pipeline_descriptor.cc index eef517b30c847..1b1537ca3db39 100644 --- a/impeller/renderer/pipeline_descriptor.cc +++ b/impeller/renderer/pipeline_descriptor.cc @@ -4,6 +4,9 @@ #include "impeller/renderer/pipeline_descriptor.h" +#include + +#include "impeller/base/comparable.h" #include "impeller/core/formats.h" #include "impeller/renderer/shader_function.h" #include "impeller/renderer/shader_library.h" @@ -61,7 +64,8 @@ bool PipelineDescriptor::IsEqual(const PipelineDescriptor& other) const { winding_order_ == other.winding_order_ && cull_mode_ == other.cull_mode_ && primitive_type_ == other.primitive_type_ && - polygon_mode_ == other.polygon_mode_; + polygon_mode_ == other.polygon_mode_ && + specialization_constants_ == other.specialization_constants_; } PipelineDescriptor& PipelineDescriptor::SetLabel(std::string label) { @@ -277,4 +281,12 @@ PolygonMode PipelineDescriptor::GetPolygonMode() const { return polygon_mode_; } +void PipelineDescriptor::SetSpecializationConstants(std::vector values) { + specialization_constants_ = std::move(values); +} + +const std::vector& PipelineDescriptor::GetSpecializationConstants() const { + return specialization_constants_; +} + } // namespace impeller diff --git a/impeller/renderer/pipeline_descriptor.h b/impeller/renderer/pipeline_descriptor.h index 3d0eddf880e28..ec2447e13934d 100644 --- a/impeller/renderer/pipeline_descriptor.h +++ b/impeller/renderer/pipeline_descriptor.h @@ -4,17 +4,12 @@ #pragma once -#include -#include #include #include #include -#include -#include #include #include "flutter/fml/hash_combine.h" -#include "flutter/fml/macros.h" #include "impeller/base/comparable.h" #include "impeller/core/formats.h" #include "impeller/core/shader_types.h" @@ -27,6 +22,27 @@ class VertexDescriptor; template class Pipeline; +struct SpecializationConstant { + const char* name; + size_t index; + ShaderType type; + + struct Equal { + constexpr bool operator()(const SpecializationConstant& a, + const SpecializationConstant& b) const { + return a.name == b.name && // + a.index == b.index && // + a.type == b.type; + } + }; + + struct Hash { + std::size_t operator()(const SpecializationConstant& key) const { + return fml::HashCombine(key.name, key.index, key.type); + } + }; +}; + class PipelineDescriptor final : public Comparable { public: PipelineDescriptor(); @@ -131,6 +147,10 @@ class PipelineDescriptor final : public Comparable { PolygonMode GetPolygonMode() const; + void SetSpecializationConstants(std::vector values); + + const std::vector& GetSpecializationConstants() const; + private: std::string label_; SampleCount sample_count_ = SampleCount::kCount1; @@ -149,6 +169,7 @@ class PipelineDescriptor final : public Comparable { back_stencil_attachment_descriptor_; PrimitiveType primitive_type_ = PrimitiveType::kTriangle; PolygonMode polygon_mode_ = PolygonMode::kFill; + std::vector specialization_constants_; }; } // namespace impeller diff --git a/impeller/renderer/shader_function.cc b/impeller/renderer/shader_function.cc index b51a4888d006f..7aa8053bd5e10 100644 --- a/impeller/renderer/shader_function.cc +++ b/impeller/renderer/shader_function.cc @@ -19,6 +19,10 @@ ShaderStage ShaderFunction::GetStage() const { return stage_; } +const std::string& ShaderFunction::GetName() const { + return name_; +} + // |Comparable| std::size_t ShaderFunction::GetHash() const { return fml::HashCombine(parent_library_id_, name_, stage_); diff --git a/impeller/renderer/shader_function.h b/impeller/renderer/shader_function.h index 2a0660884940a..280c64d117fd1 100644 --- a/impeller/renderer/shader_function.h +++ b/impeller/renderer/shader_function.h @@ -4,6 +4,7 @@ #pragma once +#include #include "flutter/fml/hash_combine.h" #include "flutter/fml/macros.h" #include "impeller/base/comparable.h" @@ -18,6 +19,8 @@ class ShaderFunction : public Comparable { ShaderStage GetStage() const; + const std::string& GetName() const; + // |Comparable| std::size_t GetHash() const override; From 0bfb7410484a67a4ff166811e85b80ab7933a22e Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Sat, 28 Oct 2023 20:18:03 -0700 Subject: [PATCH 02/20] ++ --- ci/licenses_golden/licenses_flutter | 74 ++----------------- impeller/base/comparable.h | 22 ------ .../backend/vulkan/pipeline_library_vk.cc | 8 +- 3 files changed, 11 insertions(+), 93 deletions(-) diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index fd6748c5a5e94..c204228b799a2 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -2870,42 +2870,13 @@ ORIGIN: ../../../flutter/impeller/entity/inline_pass_context.cc + ../../../flutt ORIGIN: ../../../flutter/impeller/entity/inline_pass_context.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/render_target_cache.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/render_target_cache.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend.glsl + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend.frag + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend.vert + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_color.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_colorburn.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_colordodge.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_darken.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_difference.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_exclusion.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_hardlight.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_hue.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_lighten.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_luminosity.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_multiply.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_overlay.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_saturation.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_screen.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_softlight.frag + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/blending/blend.frag + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/blending/blend.vert + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend.glsl + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend.vert + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_color.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_colorburn.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_colordodge.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_darken.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_difference.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_exclusion.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_hardlight.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_hue.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_lighten.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_luminosity.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_multiply.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_overlay.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_saturation.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_screen.frag + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_softlight.frag + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/entity/shaders/blending/blend_dispatch.glsl + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/entity/shaders/blending/framebuffer_blend.frag + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/entity/shaders/blending/framebuffer_blend.vert + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/blending/porter_duff_blend.frag + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/blending/porter_duff_blend.vert + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/border_mask_blur.frag + ../../../flutter/LICENSE @@ -5652,42 +5623,13 @@ FILE: ../../../flutter/impeller/entity/inline_pass_context.cc FILE: ../../../flutter/impeller/entity/inline_pass_context.h FILE: ../../../flutter/impeller/entity/render_target_cache.cc FILE: ../../../flutter/impeller/entity/render_target_cache.h -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend.glsl +FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend.frag FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend.vert -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_color.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_colorburn.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_colordodge.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_darken.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_difference.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_exclusion.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_hardlight.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_hue.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_lighten.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_luminosity.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_multiply.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_overlay.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_saturation.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_screen.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend_softlight.frag FILE: ../../../flutter/impeller/entity/shaders/blending/blend.frag FILE: ../../../flutter/impeller/entity/shaders/blending/blend.vert -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend.glsl -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend.vert -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_color.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_colorburn.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_colordodge.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_darken.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_difference.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_exclusion.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_hardlight.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_hue.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_lighten.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_luminosity.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_multiply.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_overlay.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_saturation.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_screen.frag -FILE: ../../../flutter/impeller/entity/shaders/blending/ios/framebuffer_blend_softlight.frag +FILE: ../../../flutter/impeller/entity/shaders/blending/blend_dispatch.glsl +FILE: ../../../flutter/impeller/entity/shaders/blending/framebuffer_blend.frag +FILE: ../../../flutter/impeller/entity/shaders/blending/framebuffer_blend.vert FILE: ../../../flutter/impeller/entity/shaders/blending/porter_duff_blend.frag FILE: ../../../flutter/impeller/entity/shaders/blending/porter_duff_blend.vert FILE: ../../../flutter/impeller/entity/shaders/border_mask_blur.frag diff --git a/impeller/base/comparable.h b/impeller/base/comparable.h index 5e54153f7d493..1937aebf2e0b3 100644 --- a/impeller/base/comparable.h +++ b/impeller/base/comparable.h @@ -93,28 +93,6 @@ bool DeepCompareMap(const std::map>& lhs, return true; } -template -bool CompareUnorderedMap(const std::unordered_map& lhs, - const std::unordered_map& rhs) { - if (lhs.size() != rhs.size()) { - return false; - } - for (const auto& [key, value] : lhs) { - auto found = rhs.find(key); - if (found == rhs.end() || found->second != value) { - return false; - } - } - for (const auto& [key, value] : rhs) { - auto found = lhs.find(key); - if (found == rhs.end() || found->second != value) { - return false; - } - } - - return true; -} - } // namespace impeller namespace std { diff --git a/impeller/renderer/backend/vulkan/pipeline_library_vk.cc b/impeller/renderer/backend/vulkan/pipeline_library_vk.cc index c70edf9b38ade..227b2a56b6d0d 100644 --- a/impeller/renderer/backend/vulkan/pipeline_library_vk.cc +++ b/impeller/renderer/backend/vulkan/pipeline_library_vk.cc @@ -294,16 +294,14 @@ std::unique_ptr PipelineLibraryVK::CreatePipeline( return nullptr; } - size_t index = 0; std::vector& entries = map_entries[entrypoint_count]; - for (auto value : constants) { + for (auto i = 0u; i < constants.size(); i++) { vk::SpecializationMapEntry entry; - entry.offset = (index * sizeof(int)); + entry.offset = (i * sizeof(int)); entry.size = sizeof(int); - entry.constantID = index; + entry.constantID = i; entries.emplace_back(entry); - index++; } vk::SpecializationInfo& specialization_info = From 3c32f10e787e5a7c49660de71d024c866f23f3e2 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Sat, 28 Oct 2023 20:56:49 -0700 Subject: [PATCH 03/20] ++ --- impeller/tools/malioc.json | 3836 ++++++------------------------------ 1 file changed, 586 insertions(+), 3250 deletions(-) diff --git a/impeller/tools/malioc.json b/impeller/tools/malioc.json index 4e61378f06e5c..5a63fc96f276c 100644 --- a/impeller/tools/malioc.json +++ b/impeller/tools/malioc.json @@ -1,4 +1,77 @@ { + "flutter/impeller/entity/advanced_blend.frag.vkspv": { + "Mali-G78": { + "core": "Mali-G78", + "filename": "flutter/impeller/entity/advanced_blend.frag.vkspv", + "has_side_effects": false, + "has_uniform_computation": true, + "modifies_coverage": false, + "reads_color_buffer": false, + "type": "Fragment", + "uses_late_zs_test": false, + "uses_late_zs_update": false, + "variants": { + "Main": { + "fp16_arithmetic": 0, + "has_stack_spilling": false, + "performance": { + "longest_path_bound_pipelines": [ + "varying", + "texture" + ], + "longest_path_cycles": [ + 0.46875, + 0.46875, + 0.015625, + 0.0, + 0.0, + 0.5, + 0.5 + ], + "pipelines": [ + "arith_total", + "arith_fma", + "arith_cvt", + "arith_sfu", + "load_store", + "varying", + "texture" + ], + "shortest_path_bound_pipelines": [ + "arith_total", + "arith_fma" + ], + "shortest_path_cycles": [ + 0.40625, + 0.40625, + 0.09375, + 0.0, + 0.0, + 0.25, + 0.25 + ], + "total_bound_pipelines": [ + "varying", + "texture" + ], + "total_cycles": [ + 0.46875, + 0.46875, + 0.09375, + 0.0, + 0.0, + 0.5, + 0.5 + ] + }, + "stack_spill_bytes": 0, + "thread_occupancy": 100, + "uniform_registers_used": 10, + "work_registers_used": 16 + } + } + } + }, "flutter/impeller/entity/advanced_blend.vert.vkspv": { "Mali-G78": { "core": "Mali-G78", @@ -111,10 +184,10 @@ } } }, - "flutter/impeller/entity/advanced_blend_color.frag.vkspv": { + "flutter/impeller/entity/blend.frag.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_color.frag.vkspv", + "filename": "flutter/impeller/entity/blend.frag.vkspv", "has_side_effects": false, "has_uniform_computation": true, "modifies_coverage": false, @@ -124,21 +197,21 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 87, + "fp16_arithmetic": 100, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + "varying", + "texture" ], "longest_path_cycles": [ - 0.609375, - 0.609375, - 0.15625, - 0.125, + 0.03125, + 0.03125, 0.0, - 0.5, - 0.5 + 0.0, + 0.0, + 0.25, + 0.25 ], "pipelines": [ "arith_total", @@ -150,68 +223,61 @@ "texture" ], "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + "varying", + "texture" ], "shortest_path_cycles": [ - 0.34375, - 0.34375, - 0.203125, + 0.03125, + 0.03125, + 0.0, 0.0, 0.0, 0.25, 0.25 ], "total_bound_pipelines": [ - "arith_total", - "arith_fma" + "varying", + "texture" ], "total_cycles": [ - 0.609375, - 0.609375, - 0.203125, - 0.125, + 0.03125, + 0.03125, 0.0, - 0.5, - 0.5 + 0.0, + 0.0, + 0.25, + 0.25 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 12, - "work_registers_used": 12 + "uniform_registers_used": 4, + "work_registers_used": 4 } } } }, - "flutter/impeller/entity/advanced_blend_colorburn.frag.vkspv": { + "flutter/impeller/entity/blend.vert.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_colorburn.frag.vkspv", - "has_side_effects": false, + "filename": "flutter/impeller/entity/blend.vert.vkspv", "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, + "type": "Vertex", "variants": { - "Main": { - "fp16_arithmetic": 100, + "Position": { + "fp16_arithmetic": 0, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "longest_path_cycles": [ - 0.296875, - 0.28125, - 0.296875, - 0.1875, + 0.125, + 0.125, 0.0, - 0.5, - 0.5 + 0.0, + 2.0, + 0.0 ], "pipelines": [ "arith_total", @@ -219,72 +285,50 @@ "arith_cvt", "arith_sfu", "load_store", - "varying", "texture" ], "shortest_path_bound_pipelines": [ - "arith_total", - "arith_cvt" + "load_store" ], "shortest_path_cycles": [ - 0.34375, - 0.25, - 0.34375, - 0.1875, + 0.125, + 0.125, 0.0, - 0.25, - 0.25 + 0.0, + 2.0, + 0.0 ], "total_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "total_cycles": [ - 0.34375, - 0.28125, - 0.34375, - 0.1875, + 0.125, + 0.125, 0.0, - 0.5, - 0.5 + 0.0, + 2.0, + 0.0 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 12, - "work_registers_used": 14 - } - } - } - }, - "flutter/impeller/entity/advanced_blend_colordodge.frag.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_colordodge.frag.vkspv", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, + "uniform_registers_used": 30, + "work_registers_used": 32 + }, + "Varying": { + "fp16_arithmetic": 0, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "longest_path_cycles": [ - 0.296875, - 0.25, - 0.296875, - 0.1875, + 0.015625, + 0.015625, + 0.015625, 0.0, - 0.5, - 0.5 + 3.0, + 0.0 ], "pipelines": [ "arith_total", @@ -292,48 +336,43 @@ "arith_cvt", "arith_sfu", "load_store", - "varying", "texture" ], "shortest_path_bound_pipelines": [ - "arith_total", - "arith_cvt" + "load_store" ], "shortest_path_cycles": [ - 0.34375, - 0.21875, - 0.34375, - 0.1875, + 0.015625, + 0.015625, + 0.015625, 0.0, - 0.25, - 0.25 + 3.0, + 0.0 ], "total_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "total_cycles": [ - 0.34375, - 0.25, - 0.34375, - 0.1875, + 0.015625, + 0.015625, + 0.015625, 0.0, - 0.5, - 0.5 + 3.0, + 0.0 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 12, - "work_registers_used": 12 + "uniform_registers_used": 22, + "work_registers_used": 8 } } } }, - "flutter/impeller/entity/advanced_blend_darken.frag.vkspv": { + "flutter/impeller/entity/border_mask_blur.frag.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_darken.frag.vkspv", + "filename": "flutter/impeller/entity/border_mask_blur.frag.vkspv", "has_side_effects": false, "has_uniform_computation": true, "modifies_coverage": false, @@ -343,21 +382,21 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 100, + "fp16_arithmetic": 44, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "varying", - "texture" + "arith_total", + "arith_fma" ], "longest_path_cycles": [ - 0.1875, - 0.1875, - 0.0625, - 0.0, + 0.875, + 0.875, + 0.203125, + 0.25, 0.0, - 0.5, - 0.5 + 0.25, + 0.25 ], "pipelines": [ "arith_total", @@ -369,68 +408,61 @@ "texture" ], "shortest_path_bound_pipelines": [ - "varying", - "texture" + "arith_total", + "arith_fma" ], "shortest_path_cycles": [ - 0.15625, - 0.15625, - 0.109375, - 0.0, + 0.875, + 0.875, + 0.203125, + 0.25, 0.0, 0.25, 0.25 ], "total_bound_pipelines": [ - "varying", - "texture" + "arith_total", + "arith_fma" ], "total_cycles": [ - 0.1875, - 0.1875, - 0.109375, - 0.0, + 0.875, + 0.875, + 0.203125, + 0.25, 0.0, - 0.5, - 0.5 + 0.25, + 0.25 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 8, - "work_registers_used": 11 + "uniform_registers_used": 12, + "work_registers_used": 18 } } } }, - "flutter/impeller/entity/advanced_blend_difference.frag.vkspv": { + "flutter/impeller/entity/border_mask_blur.vert.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_difference.frag.vkspv", - "has_side_effects": false, + "filename": "flutter/impeller/entity/border_mask_blur.vert.vkspv", "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, + "type": "Vertex", "variants": { - "Main": { - "fp16_arithmetic": 100, + "Position": { + "fp16_arithmetic": 0, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "longest_path_cycles": [ - 0.234375, - 0.234375, - 0.03125, + 0.125, + 0.125, 0.0, 0.0, - 0.5, - 0.5 + 2.0, + 0.0 ], "pipelines": [ "arith_total", @@ -438,72 +470,50 @@ "arith_cvt", "arith_sfu", "load_store", - "varying", "texture" ], "shortest_path_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "shortest_path_cycles": [ - 0.203125, - 0.203125, - 0.078125, + 0.125, + 0.125, 0.0, 0.0, - 0.25, - 0.25 + 2.0, + 0.0 ], "total_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "total_cycles": [ - 0.234375, - 0.234375, - 0.078125, + 0.125, + 0.125, 0.0, 0.0, - 0.5, - 0.5 + 2.0, + 0.0 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 8, - "work_registers_used": 11 - } - } - } - }, - "flutter/impeller/entity/advanced_blend_exclusion.frag.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_exclusion.frag.vkspv", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, + "uniform_registers_used": 30, + "work_registers_used": 32 + }, + "Varying": { + "fp16_arithmetic": 0, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "longest_path_cycles": [ - 0.296875, - 0.296875, - 0.03125, - 0.0, + 0.015625, + 0.015625, + 0.015625, 0.0, - 0.5, - 0.5 + 3.0, + 0.0 ], "pipelines": [ "arith_total", @@ -511,48 +521,43 @@ "arith_cvt", "arith_sfu", "load_store", - "varying", "texture" ], "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + "load_store" ], "shortest_path_cycles": [ - 0.265625, - 0.265625, - 0.078125, - 0.0, + 0.015625, + 0.015625, + 0.015625, 0.0, - 0.25, - 0.25 + 3.0, + 0.0 ], "total_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "total_cycles": [ - 0.296875, - 0.296875, - 0.078125, - 0.0, + 0.015625, + 0.015625, + 0.015625, 0.0, - 0.5, - 0.5 + 3.0, + 0.0 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 8, - "work_registers_used": 11 + "uniform_registers_used": 22, + "work_registers_used": 8 } } } }, - "flutter/impeller/entity/advanced_blend_hardlight.frag.vkspv": { + "flutter/impeller/entity/checkerboard.frag.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_hardlight.frag.vkspv", + "filename": "flutter/impeller/entity/checkerboard.frag.vkspv", "has_side_effects": false, "has_uniform_computation": true, "modifies_coverage": false, @@ -562,21 +567,20 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 100, + "fp16_arithmetic": 80, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "longest_path_cycles": [ - 0.46875, - 0.46875, - 0.09375, - 0.0, + 0.125, + 0.125, + 0.125, + 0.0625, + 1.0, 0.0, - 0.5, - 0.5 + 0.0 ], "pipelines": [ "arith_total", @@ -588,68 +592,59 @@ "texture" ], "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + "load_store" ], "shortest_path_cycles": [ - 0.4375, - 0.4375, - 0.140625, - 0.0, + 0.125, + 0.125, + 0.125, + 0.0625, + 1.0, 0.0, - 0.25, - 0.25 + 0.0 ], "total_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "total_cycles": [ - 0.46875, - 0.46875, - 0.140625, - 0.0, + 0.125, + 0.125, + 0.125, + 0.0625, + 1.0, 0.0, - 0.5, - 0.5 + 0.0 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 10, - "work_registers_used": 13 + "uniform_registers_used": 6, + "work_registers_used": 7 } } } }, - "flutter/impeller/entity/advanced_blend_hue.frag.vkspv": { + "flutter/impeller/entity/checkerboard.vert.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_hue.frag.vkspv", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, + "filename": "flutter/impeller/entity/checkerboard.vert.vkspv", + "has_uniform_computation": false, + "type": "Vertex", "variants": { - "Main": { - "fp16_arithmetic": 90, + "Position": { + "fp16_arithmetic": null, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + "load_store" ], "longest_path_cycles": [ - 0.71875, - 0.71875, - 0.328125, - 0.1875, 0.0, - 0.5, - 0.5 + 0.0, + 0.0, + 0.0, + 2.0, + 0.0 ], "pipelines": [ "arith_total", @@ -657,51 +652,45 @@ "arith_cvt", "arith_sfu", "load_store", - "varying", "texture" ], "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt" + "load_store" ], "shortest_path_cycles": [ - 0.34375, - 0.34375, - 0.34375, 0.0, 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "arith_total", - "arith_fma" + 0.0, + 0.0, + 2.0, + 0.0 + ], + "total_bound_pipelines": [ + "load_store" ], "total_cycles": [ - 0.71875, - 0.71875, - 0.40625, - 0.1875, 0.0, - 0.5, - 0.5 + 0.0, + 0.0, + 0.0, + 2.0, + 0.0 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 12, - "work_registers_used": 12 + "uniform_registers_used": 8, + "work_registers_used": 32 } } } }, - "flutter/impeller/entity/advanced_blend_lighten.frag.vkspv": { + "flutter/impeller/entity/clip.frag.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_lighten.frag.vkspv", + "filename": "flutter/impeller/entity/clip.frag.vkspv", "has_side_effects": false, - "has_uniform_computation": true, + "has_uniform_computation": false, "modifies_coverage": false, "reads_color_buffer": false, "type": "Fragment", @@ -709,21 +698,21 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 100, + "fp16_arithmetic": null, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "varying", - "texture" + "arith_total", + "arith_cvt" ], "longest_path_cycles": [ - 0.1875, - 0.1875, - 0.0625, + 0.015625, 0.0, + 0.015625, 0.0, - 0.5, - 0.5 + 0.0, + 0.0, + 0.0 ], "pipelines": [ "arith_total", @@ -735,68 +724,61 @@ "texture" ], "shortest_path_bound_pipelines": [ - "varying", - "texture" + "arith_total", + "arith_cvt" ], "shortest_path_cycles": [ - 0.15625, - 0.15625, - 0.109375, + 0.015625, + 0.0, + 0.015625, 0.0, 0.0, - 0.25, - 0.25 + 0.0, + 0.0 ], "total_bound_pipelines": [ - "varying", - "texture" + "arith_total", + "arith_cvt" ], "total_cycles": [ - 0.1875, - 0.1875, - 0.109375, + 0.015625, 0.0, + 0.015625, 0.0, - 0.5, - 0.5 + 0.0, + 0.0, + 0.0 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 8, - "work_registers_used": 11 + "uniform_registers_used": 0, + "work_registers_used": 0 } } } }, - "flutter/impeller/entity/advanced_blend_luminosity.frag.vkspv": { + "flutter/impeller/entity/clip.vert.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_luminosity.frag.vkspv", - "has_side_effects": false, + "filename": "flutter/impeller/entity/clip.vert.vkspv", "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, + "type": "Vertex", "variants": { - "Main": { - "fp16_arithmetic": 87, + "Position": { + "fp16_arithmetic": 0, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + "load_store" ], "longest_path_cycles": [ - 0.609375, - 0.609375, - 0.15625, + 0.125, 0.125, 0.0, - 0.5, - 0.5 + 0.0, + 2.0, + 0.0 ], "pipelines": [ "arith_total", @@ -804,48 +786,43 @@ "arith_cvt", "arith_sfu", "load_store", - "varying", "texture" ], "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + "load_store" ], "shortest_path_cycles": [ - 0.34375, - 0.34375, - 0.203125, + 0.125, + 0.125, 0.0, 0.0, - 0.25, - 0.25 + 2.0, + 0.0 ], "total_bound_pipelines": [ - "arith_total", - "arith_fma" + "load_store" ], "total_cycles": [ - 0.609375, - 0.609375, - 0.203125, + 0.125, 0.125, 0.0, - 0.5, - 0.5 + 0.0, + 2.0, + 0.0 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 12, - "work_registers_used": 12 + "uniform_registers_used": 28, + "work_registers_used": 32 } } } }, - "flutter/impeller/entity/advanced_blend_multiply.frag.vkspv": { + "flutter/impeller/entity/color_matrix_color_filter.frag.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_multiply.frag.vkspv", + "filename": "flutter/impeller/entity/color_matrix_color_filter.frag.vkspv", "has_side_effects": false, "has_uniform_computation": true, "modifies_coverage": false, @@ -859,17 +836,19 @@ "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ + "arith_total", + "arith_fma", "varying", "texture" ], "longest_path_cycles": [ - 0.203125, - 0.203125, - 0.03125, - 0.0, + 0.25, + 0.25, + 0.0625, + 0.0625, 0.0, - 0.5, - 0.5 + 0.25, + 0.25 ], "pipelines": [ "arith_total", @@ -881,68 +860,65 @@ "texture" ], "shortest_path_bound_pipelines": [ + "arith_total", + "arith_fma", "varying", "texture" ], "shortest_path_cycles": [ - 0.171875, - 0.171875, - 0.078125, - 0.0, + 0.25, + 0.25, + 0.0625, + 0.0625, 0.0, 0.25, 0.25 ], "total_bound_pipelines": [ + "arith_total", + "arith_fma", "varying", "texture" ], "total_cycles": [ - 0.203125, - 0.203125, - 0.078125, - 0.0, + 0.25, + 0.25, + 0.0625, + 0.0625, 0.0, - 0.5, - 0.5 + 0.25, + 0.25 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 8, - "work_registers_used": 11 + "uniform_registers_used": 14, + "work_registers_used": 10 } } } }, - "flutter/impeller/entity/advanced_blend_overlay.frag.vkspv": { + "flutter/impeller/entity/color_matrix_color_filter.vert.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_overlay.frag.vkspv", - "has_side_effects": false, + "filename": "flutter/impeller/entity/color_matrix_color_filter.vert.vkspv", "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, + "type": "Vertex", "variants": { - "Main": { - "fp16_arithmetic": 100, + "Position": { + "fp16_arithmetic": 0, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "longest_path_cycles": [ - 0.46875, - 0.46875, - 0.09375, + 0.125, + 0.125, 0.0, 0.0, - 0.5, - 0.5 + 2.0, + 0.0 ], "pipelines": [ "arith_total", @@ -950,146 +926,50 @@ "arith_cvt", "arith_sfu", "load_store", - "varying", "texture" ], "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + "load_store" ], "shortest_path_cycles": [ - 0.4375, - 0.4375, - 0.140625, + 0.125, + 0.125, 0.0, 0.0, - 0.25, - 0.25 + 2.0, + 0.0 ], "total_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "total_cycles": [ - 0.46875, - 0.46875, - 0.140625, + 0.125, + 0.125, 0.0, 0.0, - 0.5, - 0.5 + 2.0, + 0.0 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 10, - "work_registers_used": 13 - } - } - } - }, - "flutter/impeller/entity/advanced_blend_saturation.frag.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_saturation.frag.vkspv", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 90, + "uniform_registers_used": 30, + "work_registers_used": 32 + }, + "Varying": { + "fp16_arithmetic": 0, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + "load_store" ], "longest_path_cycles": [ - 0.71875, - 0.71875, - 0.328125, - 0.1875, + 0.015625, + 0.015625, + 0.015625, 0.0, - 0.5, - 0.5 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt" - ], - "shortest_path_cycles": [ - 0.34375, - 0.34375, - 0.34375, - 0.0, - 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "arith_total", - "arith_fma" - ], - "total_cycles": [ - 0.71875, - 0.71875, - 0.40625, - 0.1875, - 0.0, - 0.5, - 0.5 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 12, - "work_registers_used": 12 - } - } - } - }, - "flutter/impeller/entity/advanced_blend_screen.frag.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_screen.frag.vkspv", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "varying", - "texture" - ], - "longest_path_cycles": [ - 0.265625, - 0.265625, - 0.03125, - 0.0, - 0.0, - 0.5, - 0.5 + 3.0, + 0.0 ], "pipelines": [ "arith_total", @@ -1097,48 +977,43 @@ "arith_cvt", "arith_sfu", "load_store", - "varying", "texture" ], "shortest_path_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "shortest_path_cycles": [ - 0.234375, - 0.234375, - 0.078125, - 0.0, + 0.015625, + 0.015625, + 0.015625, 0.0, - 0.25, - 0.25 + 3.0, + 0.0 ], "total_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "total_cycles": [ - 0.265625, - 0.265625, - 0.078125, - 0.0, + 0.015625, + 0.015625, + 0.015625, 0.0, - 0.5, - 0.5 + 3.0, + 0.0 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 8, - "work_registers_used": 10 + "uniform_registers_used": 22, + "work_registers_used": 8 } } } }, - "flutter/impeller/entity/advanced_blend_softlight.frag.vkspv": { + "flutter/impeller/entity/conical_gradient_fill.frag.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/advanced_blend_softlight.frag.vkspv", + "filename": "flutter/impeller/entity/conical_gradient_fill.frag.vkspv", "has_side_effects": false, "has_uniform_computation": true, "modifies_coverage": false, @@ -1148,21 +1023,21 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 100, + "fp16_arithmetic": 74, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ "arith_total", - "arith_fma" + "arith_cvt" ], "longest_path_cycles": [ 0.800000011920929, + 0.328125, 0.800000011920929, - 0.234375, - 0.1875, + 0.0625, 0.0, - 0.5, - 0.5 + 0.25, + 0.25 ], "pipelines": [ "arith_total", @@ -1174,44 +1049,43 @@ "texture" ], "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + "varying" ], "shortest_path_cycles": [ - 0.762499988079071, - 0.762499988079071, - 0.28125, - 0.1875, + 0.15625, + 0.0, + 0.15625, + 0.0, 0.0, 0.25, - 0.25 + 0.0 ], "total_bound_pipelines": [ "arith_total", - "arith_fma" + "arith_cvt" ], "total_cycles": [ - 0.800000011920929, - 0.800000011920929, - 0.28125, - 0.1875, + 1.1375000476837158, + 0.699999988079071, + 1.1375000476837158, + 0.3125, 0.0, - 0.5, - 0.5 + 0.25, + 0.25 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 14, - "work_registers_used": 22 + "uniform_registers_used": 40, + "work_registers_used": 9 } } } }, - "flutter/impeller/entity/blend.frag.vkspv": { + "flutter/impeller/entity/conical_gradient_ssbo_fill.frag.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/blend.frag.vkspv", + "filename": "flutter/impeller/entity/conical_gradient_ssbo_fill.frag.vkspv", "has_side_effects": false, "has_uniform_computation": true, "modifies_coverage": false, @@ -1221,21 +1095,20 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 100, + "fp16_arithmetic": 68, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "varying", - "texture" + null ], "longest_path_cycles": [ - 0.03125, - 0.03125, - 0.0, - 0.0, - 0.0, - 0.25, - 0.25 + null, + null, + null, + null, + null, + null, + null ], "pipelines": [ "arith_total", @@ -1247,44 +1120,43 @@ "texture" ], "shortest_path_bound_pipelines": [ - "varying", - "texture" + "arith_total", + "arith_sfu" ], "shortest_path_cycles": [ - 0.03125, - 0.03125, - 0.0, - 0.0, + 0.5, + 0.109375, + 0.328125, + 0.5, 0.0, 0.25, - 0.25 + 0.0 ], "total_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "total_cycles": [ - 0.03125, - 0.03125, - 0.0, - 0.0, - 0.0, + 1.4500000476837158, + 0.862500011920929, + 1.4500000476837158, + 0.875, + 4.0, 0.25, - 0.25 + 0.0 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 4, - "work_registers_used": 4 + "uniform_registers_used": 46, + "work_registers_used": 20 } } } }, - "flutter/impeller/entity/blend.vert.vkspv": { + "flutter/impeller/entity/gaussian_blur.vert.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/blend.vert.vkspv", + "filename": "flutter/impeller/entity/gaussian_blur.vert.vkspv", "has_uniform_computation": true, "type": "Vertex", "variants": { @@ -1393,10 +1265,10 @@ } } }, - "flutter/impeller/entity/border_mask_blur.frag.vkspv": { + "flutter/impeller/entity/gaussian_blur_noalpha_decal.frag.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/border_mask_blur.frag.vkspv", + "filename": "flutter/impeller/entity/gaussian_blur_noalpha_decal.frag.vkspv", "has_side_effects": false, "has_uniform_computation": true, "modifies_coverage": false, @@ -1406,21 +1278,20 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 44, + "fp16_arithmetic": 42, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + null ], "longest_path_cycles": [ - 0.875, - 0.875, - 0.203125, - 0.25, - 0.0, - 0.25, - 0.25 + null, + null, + null, + null, + null, + null, + null ], "pipelines": [ "arith_total", @@ -1433,2457 +1304,44 @@ ], "shortest_path_bound_pipelines": [ "arith_total", - "arith_fma" + "arith_cvt" ], "shortest_path_cycles": [ - 0.875, - 0.875, - 0.203125, - 0.25, + 0.109375, + 0.03125, + 0.109375, + 0.0625, 0.0, - 0.25, - 0.25 + 0.0, + 0.0 ], "total_bound_pipelines": [ "arith_total", - "arith_fma" + "arith_cvt", + "arith_sfu" ], "total_cycles": [ - 0.875, - 0.875, + 0.3125, 0.203125, - 0.25, - 0.0, - 0.25, - 0.25 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 12, - "work_registers_used": 18 - } - } - } - }, - "flutter/impeller/entity/border_mask_blur.vert.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/border_mask_blur.vert.vkspv", - "has_uniform_computation": true, - "type": "Vertex", - "variants": { - "Position": { - "fp16_arithmetic": 0, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "load_store" - ], - "longest_path_cycles": [ - 0.125, - 0.125, - 0.0, - 0.0, - 2.0, - 0.0 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "load_store" - ], - "shortest_path_cycles": [ - 0.125, - 0.125, - 0.0, - 0.0, - 2.0, - 0.0 - ], - "total_bound_pipelines": [ - "load_store" - ], - "total_cycles": [ - 0.125, - 0.125, - 0.0, - 0.0, - 2.0, - 0.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 30, - "work_registers_used": 32 - }, - "Varying": { - "fp16_arithmetic": 0, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "load_store" - ], - "longest_path_cycles": [ - 0.015625, - 0.015625, - 0.015625, - 0.0, - 3.0, - 0.0 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "load_store" - ], - "shortest_path_cycles": [ - 0.015625, - 0.015625, - 0.015625, - 0.0, - 3.0, - 0.0 - ], - "total_bound_pipelines": [ - "load_store" - ], - "total_cycles": [ - 0.015625, - 0.015625, - 0.015625, - 0.0, - 3.0, - 0.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 22, - "work_registers_used": 8 - } - } - } - }, - "flutter/impeller/entity/checkerboard.frag.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/checkerboard.frag.vkspv", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 80, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "load_store" - ], - "longest_path_cycles": [ - 0.125, - 0.125, - 0.125, - 0.0625, - 1.0, - 0.0, - 0.0 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "load_store" - ], - "shortest_path_cycles": [ - 0.125, - 0.125, - 0.125, - 0.0625, - 1.0, - 0.0, - 0.0 - ], - "total_bound_pipelines": [ - "load_store" - ], - "total_cycles": [ - 0.125, - 0.125, - 0.125, - 0.0625, - 1.0, - 0.0, - 0.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 6, - "work_registers_used": 7 - } - } - } - }, - "flutter/impeller/entity/checkerboard.vert.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/checkerboard.vert.vkspv", - "has_uniform_computation": false, - "type": "Vertex", - "variants": { - "Position": { - "fp16_arithmetic": null, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "load_store" - ], - "longest_path_cycles": [ - 0.0, - 0.0, - 0.0, - 0.0, - 2.0, - 0.0 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "load_store" - ], - "shortest_path_cycles": [ - 0.0, - 0.0, - 0.0, - 0.0, - 2.0, - 0.0 - ], - "total_bound_pipelines": [ - "load_store" - ], - "total_cycles": [ - 0.0, - 0.0, - 0.0, - 0.0, - 2.0, - 0.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 8, - "work_registers_used": 32 - } - } - } - }, - "flutter/impeller/entity/clip.frag.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/clip.frag.vkspv", - "has_side_effects": false, - "has_uniform_computation": false, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": null, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arith_total", - "arith_cvt" - ], - "longest_path_cycles": [ - 0.015625, - 0.0, - 0.015625, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_cvt" - ], - "shortest_path_cycles": [ - 0.015625, - 0.0, - 0.015625, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "total_bound_pipelines": [ - "arith_total", - "arith_cvt" - ], - "total_cycles": [ - 0.015625, - 0.0, - 0.015625, - 0.0, - 0.0, - 0.0, - 0.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 0, - "work_registers_used": 0 - } - } - } - }, - "flutter/impeller/entity/clip.vert.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/clip.vert.vkspv", - "has_uniform_computation": true, - "type": "Vertex", - "variants": { - "Position": { - "fp16_arithmetic": 0, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "load_store" - ], - "longest_path_cycles": [ - 0.125, - 0.125, - 0.0, - 0.0, - 2.0, - 0.0 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "load_store" - ], - "shortest_path_cycles": [ - 0.125, - 0.125, - 0.0, - 0.0, - 2.0, - 0.0 - ], - "total_bound_pipelines": [ - "load_store" - ], - "total_cycles": [ - 0.125, - 0.125, - 0.0, - 0.0, - 2.0, - 0.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 28, - "work_registers_used": 32 - } - } - } - }, - "flutter/impeller/entity/color_matrix_color_filter.frag.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/color_matrix_color_filter.frag.vkspv", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arith_total", - "arith_fma", - "varying", - "texture" - ], - "longest_path_cycles": [ - 0.25, - 0.25, - 0.0625, - 0.0625, - 0.0, - 0.25, - 0.25 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma", - "varying", - "texture" - ], - "shortest_path_cycles": [ - 0.25, - 0.25, - 0.0625, - 0.0625, - 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "arith_total", - "arith_fma", - "varying", - "texture" - ], - "total_cycles": [ - 0.25, - 0.25, - 0.0625, - 0.0625, - 0.0, - 0.25, - 0.25 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 14, - "work_registers_used": 10 - } - } - } - }, - "flutter/impeller/entity/color_matrix_color_filter.vert.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/color_matrix_color_filter.vert.vkspv", - "has_uniform_computation": true, - "type": "Vertex", - "variants": { - "Position": { - "fp16_arithmetic": 0, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "load_store" - ], - "longest_path_cycles": [ - 0.125, - 0.125, - 0.0, - 0.0, - 2.0, - 0.0 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "load_store" - ], - "shortest_path_cycles": [ - 0.125, - 0.125, - 0.0, - 0.0, - 2.0, - 0.0 - ], - "total_bound_pipelines": [ - "load_store" - ], - "total_cycles": [ - 0.125, - 0.125, - 0.0, - 0.0, - 2.0, - 0.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 30, - "work_registers_used": 32 - }, - "Varying": { - "fp16_arithmetic": 0, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "load_store" - ], - "longest_path_cycles": [ - 0.015625, - 0.015625, - 0.015625, - 0.0, - 3.0, - 0.0 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "load_store" - ], - "shortest_path_cycles": [ - 0.015625, - 0.015625, - 0.015625, - 0.0, - 3.0, - 0.0 - ], - "total_bound_pipelines": [ - "load_store" - ], - "total_cycles": [ - 0.015625, - 0.015625, - 0.015625, - 0.0, - 3.0, - 0.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 22, - "work_registers_used": 8 - } - } - } - }, - "flutter/impeller/entity/conical_gradient_fill.frag.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/conical_gradient_fill.frag.vkspv", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 74, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arith_total", - "arith_cvt" - ], - "longest_path_cycles": [ - 0.800000011920929, - 0.328125, - 0.800000011920929, - 0.0625, - 0.0, - 0.25, - 0.25 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "varying" - ], - "shortest_path_cycles": [ - 0.15625, - 0.0, - 0.15625, - 0.0, - 0.0, - 0.25, - 0.0 - ], - "total_bound_pipelines": [ - "arith_total", - "arith_cvt" - ], - "total_cycles": [ - 1.1375000476837158, - 0.699999988079071, - 1.1375000476837158, - 0.3125, - 0.0, - 0.25, - 0.25 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 40, - "work_registers_used": 9 - } - } - } - }, - "flutter/impeller/entity/conical_gradient_ssbo_fill.frag.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/conical_gradient_ssbo_fill.frag.vkspv", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 68, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - null - ], - "longest_path_cycles": [ - null, - null, - null, - null, - null, - null, - null - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_sfu" - ], - "shortest_path_cycles": [ - 0.5, - 0.109375, - 0.328125, - 0.5, - 0.0, - 0.25, - 0.0 - ], - "total_bound_pipelines": [ - "load_store" - ], - "total_cycles": [ - 1.4500000476837158, - 0.862500011920929, - 1.4500000476837158, - 0.875, - 4.0, - 0.25, - 0.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 46, - "work_registers_used": 20 - } - } - } - }, - "flutter/impeller/entity/gaussian_blur.vert.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gaussian_blur.vert.vkspv", - "has_uniform_computation": true, - "type": "Vertex", - "variants": { - "Position": { - "fp16_arithmetic": 0, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "load_store" - ], - "longest_path_cycles": [ - 0.125, - 0.125, - 0.0, - 0.0, - 2.0, - 0.0 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "load_store" - ], - "shortest_path_cycles": [ - 0.125, - 0.125, - 0.0, - 0.0, - 2.0, - 0.0 - ], - "total_bound_pipelines": [ - "load_store" - ], - "total_cycles": [ - 0.125, - 0.125, - 0.0, - 0.0, - 2.0, - 0.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 30, - "work_registers_used": 32 - }, - "Varying": { - "fp16_arithmetic": 0, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "load_store" - ], - "longest_path_cycles": [ - 0.015625, - 0.015625, - 0.015625, - 0.0, - 3.0, - 0.0 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "load_store" - ], - "shortest_path_cycles": [ - 0.015625, - 0.015625, - 0.015625, - 0.0, - 3.0, - 0.0 - ], - "total_bound_pipelines": [ - "load_store" - ], - "total_cycles": [ - 0.015625, - 0.015625, - 0.015625, - 0.0, - 3.0, - 0.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 22, - "work_registers_used": 8 - } - } - } - }, - "flutter/impeller/entity/gaussian_blur_noalpha_decal.frag.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gaussian_blur_noalpha_decal.frag.vkspv", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 42, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - null - ], - "longest_path_cycles": [ - null, - null, - null, - null, - null, - null, - null - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_cvt" - ], - "shortest_path_cycles": [ - 0.109375, - 0.03125, - 0.109375, - 0.0625, - 0.0, - 0.0, - 0.0 - ], - "total_bound_pipelines": [ - "arith_total", - "arith_cvt", - "arith_sfu" - ], - "total_cycles": [ - 0.3125, - 0.203125, - 0.3125, - 0.3125, - 0.0, - 0.25, - 0.25 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 10, - "work_registers_used": 16 - } - } - } - }, - "flutter/impeller/entity/gaussian_blur_noalpha_nodecal.frag.vkspv": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gaussian_blur_noalpha_nodecal.frag.vkspv", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 35, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - null - ], - "longest_path_cycles": [ - null, - null, - null, - null, - null, - null, - null - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_cvt" - ], - "shortest_path_cycles": [ - 0.109375, - 0.03125, - 0.109375, - 0.0625, - 0.0, - 0.0, - 0.0 - ], - "total_bound_pipelines": [ - "varying", - "texture" - ], - "total_cycles": [ - 0.203125, - 0.203125, - 0.203125, - 0.125, - 0.0, - 0.25, - 0.25 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 10, - "work_registers_used": 13 - } - } - } - }, - "flutter/impeller/entity/gles/advanced_blend.vert.gles": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend.vert.gles", - "has_uniform_computation": true, - "type": "Vertex", - "variants": { - "Position": { - "fp16_arithmetic": 0, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "load_store" - ], - "longest_path_cycles": [ - 0.140625, - 0.140625, - 0.0, - 0.0, - 2.0, - 0.0 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "load_store" - ], - "shortest_path_cycles": [ - 0.140625, - 0.140625, - 0.0, - 0.0, - 2.0, - 0.0 - ], - "total_bound_pipelines": [ - "load_store" - ], - "total_cycles": [ - 0.140625, - 0.140625, - 0.0, - 0.0, - 2.0, - 0.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 22, - "work_registers_used": 32 - }, - "Varying": { - "fp16_arithmetic": 0, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "load_store" - ], - "longest_path_cycles": [ - 0.03125, - 0.03125, - 0.03125, - 0.0, - 4.0, - 0.0 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "load_store" - ], - "shortest_path_cycles": [ - 0.03125, - 0.03125, - 0.03125, - 0.0, - 4.0, - 0.0 - ], - "total_bound_pipelines": [ - "load_store" - ], - "total_cycles": [ - 0.03125, - 0.03125, - 0.03125, - 0.0, - 4.0, - 0.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 10, - "work_registers_used": 10 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend.vert.gles", - "has_uniform_computation": false, - "type": "Vertex", - "variants": { - "Main": { - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "load_store" - ], - "longest_path_cycles": [ - 3.299999952316284, - 7.0, - 0.0 - ], - "pipelines": [ - "arithmetic", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "load_store" - ], - "shortest_path_cycles": [ - 3.299999952316284, - 7.0, - 0.0 - ], - "total_bound_pipelines": [ - "load_store" - ], - "total_cycles": [ - 3.3333332538604736, - 7.0, - 0.0 - ] - }, - "thread_occupancy": 100, - "uniform_registers_used": 6, - "work_registers_used": 3 - } - } - } - }, - "flutter/impeller/entity/gles/advanced_blend_color.frag.gles": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_color.frag.gles", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arith_total", - "arith_fma" - ], - "longest_path_cycles": [ - 0.609375, - 0.609375, - 0.46875, - 0.5, - 0.0, - 0.5, - 0.5 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma" - ], - "shortest_path_cycles": [ - 0.34375, - 0.34375, - 0.265625, - 0.0, - 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "texture" - ], - "total_cycles": [ - 0.609375, - 0.609375, - 0.578125, - 0.5, - 0.0, - 0.5, - 1.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 12, - "work_registers_used": 20 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_color.frag.gles", - "has_uniform_computation": false, - "type": "Fragment", - "variants": { - "Main": { - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arithmetic" - ], - "longest_path_cycles": [ - 9.569999694824219, - 2.0, - 2.0 - ], - "pipelines": [ - "arithmetic", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arithmetic" - ], - "shortest_path_cycles": [ - 4.949999809265137, - 1.0, - 0.0 - ], - "total_bound_pipelines": [ - "arithmetic" - ], - "total_cycles": [ - 11.0, - 2.0, - 4.0 - ] - }, - "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 3 - } - } - } - }, - "flutter/impeller/entity/gles/advanced_blend_colorburn.frag.gles": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_colorburn.frag.gles", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arith_total", - "arith_cvt" - ], - "longest_path_cycles": [ - 0.637499988079071, - 0.28125, - 0.637499988079071, - 0.5625, - 0.0, - 0.5, - 0.5 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_cvt" - ], - "shortest_path_cycles": [ - 0.40625, - 0.25, - 0.40625, - 0.1875, - 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "texture" - ], - "total_cycles": [ - 0.75, - 0.28125, - 0.75, - 0.5625, - 0.0, - 0.5, - 1.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 12, - "work_registers_used": 26 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_colorburn.frag.gles", - "has_uniform_computation": false, - "type": "Fragment", - "variants": { - "Main": { - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arithmetic" - ], - "longest_path_cycles": [ - 10.229999542236328, - 2.0, - 2.0 - ], - "pipelines": [ - "arithmetic", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arithmetic" - ], - "shortest_path_cycles": [ - 7.590000152587891, - 1.0, - 0.0 - ], - "total_bound_pipelines": [ - "arithmetic" - ], - "total_cycles": [ - 11.666666984558105, - 2.0, - 4.0 - ] - }, - "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 2 - } - } - } - }, - "flutter/impeller/entity/gles/advanced_blend_colordodge.frag.gles": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_colordodge.frag.gles", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arith_total", - "arith_cvt" - ], - "longest_path_cycles": [ - 0.625, - 0.25, - 0.625, - 0.5625, - 0.0, - 0.5, - 0.5 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_cvt" - ], - "shortest_path_cycles": [ - 0.390625, - 0.21875, - 0.390625, - 0.1875, - 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "texture" - ], - "total_cycles": [ - 0.737500011920929, - 0.25, - 0.737500011920929, - 0.5625, - 0.0, - 0.5, - 1.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 12, - "work_registers_used": 24 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_colordodge.frag.gles", - "has_uniform_computation": false, - "type": "Fragment", - "variants": { - "Main": { - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arithmetic" - ], - "longest_path_cycles": [ - 10.229999542236328, - 2.0, - 2.0 - ], - "pipelines": [ - "arithmetic", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arithmetic" - ], - "shortest_path_cycles": [ - 7.590000152587891, - 1.0, - 0.0 - ], - "total_bound_pipelines": [ - "arithmetic" - ], - "total_cycles": [ - 11.666666984558105, - 2.0, - 4.0 - ] - }, - "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 2 - } - } - } - }, - "flutter/impeller/entity/gles/advanced_blend_darken.frag.gles": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_darken.frag.gles", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "varying", - "texture" - ], - "longest_path_cycles": [ - 0.40625, - 0.1875, - 0.40625, - 0.375, - 0.0, - 0.5, - 0.5 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "varying", - "texture" - ], - "shortest_path_cycles": [ - 0.171875, - 0.15625, - 0.171875, - 0.0, - 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "texture" - ], - "total_cycles": [ - 0.515625, - 0.1875, - 0.515625, - 0.375, - 0.0, - 0.5, - 1.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 8, - "work_registers_used": 20 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_darken.frag.gles", - "has_uniform_computation": false, - "type": "Fragment", - "variants": { - "Main": { - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arithmetic" - ], - "longest_path_cycles": [ - 5.28000020980835, - 2.0, - 2.0 - ], - "pipelines": [ - "arithmetic", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arithmetic" - ], - "shortest_path_cycles": [ - 2.309999942779541, - 1.0, - 0.0 - ], - "total_bound_pipelines": [ - "arithmetic" - ], - "total_cycles": [ - 6.333333492279053, - 2.0, - 4.0 - ] - }, - "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 2 - } - } - } - }, - "flutter/impeller/entity/gles/advanced_blend_difference.frag.gles": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_difference.frag.gles", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "varying", - "texture" - ], - "longest_path_cycles": [ - 0.375, - 0.234375, - 0.375, - 0.375, - 0.0, - 0.5, - 0.5 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "varying", - "texture" - ], - "shortest_path_cycles": [ - 0.203125, - 0.203125, - 0.140625, - 0.0, - 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "texture" - ], - "total_cycles": [ - 0.484375, - 0.234375, - 0.484375, - 0.375, - 0.0, - 0.5, - 1.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 8, - "work_registers_used": 20 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_difference.frag.gles", - "has_uniform_computation": false, - "type": "Fragment", - "variants": { - "Main": { - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arithmetic" - ], - "longest_path_cycles": [ - 5.610000133514404, - 2.0, - 2.0 - ], - "pipelines": [ - "arithmetic", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arithmetic" - ], - "shortest_path_cycles": [ - 2.640000104904175, - 1.0, - 0.0 - ], - "total_bound_pipelines": [ - "arithmetic" - ], - "total_cycles": [ - 6.666666507720947, - 2.0, - 4.0 - ] - }, - "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 2 - } - } - } - }, - "flutter/impeller/entity/gles/advanced_blend_exclusion.frag.gles": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_exclusion.frag.gles", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "varying", - "texture" - ], - "longest_path_cycles": [ - 0.375, - 0.28125, - 0.375, - 0.375, - 0.0, - 0.5, - 0.5 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma", - "varying", - "texture" - ], - "shortest_path_cycles": [ - 0.25, - 0.25, - 0.140625, - 0.0, - 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "texture" - ], - "total_cycles": [ - 0.484375, - 0.28125, - 0.484375, - 0.375, - 0.0, - 0.5, - 1.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 8, - "work_registers_used": 20 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_exclusion.frag.gles", - "has_uniform_computation": false, - "type": "Fragment", - "variants": { - "Main": { - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arithmetic" - ], - "longest_path_cycles": [ - 5.610000133514404, - 2.0, - 2.0 - ], - "pipelines": [ - "arithmetic", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arithmetic" - ], - "shortest_path_cycles": [ - 2.640000104904175, - 1.0, - 0.0 - ], - "total_bound_pipelines": [ - "arithmetic" - ], - "total_cycles": [ - 6.666666507720947, - 2.0, - 4.0 - ] - }, - "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 2 - } - } - } - }, - "flutter/impeller/entity/gles/advanced_blend_hardlight.frag.gles": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_hardlight.frag.gles", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "varying", - "texture" - ], - "longest_path_cycles": [ - 0.453125, - 0.453125, - 0.421875, - 0.375, - 0.0, - 0.5, - 0.5 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma" - ], - "shortest_path_cycles": [ - 0.421875, - 0.421875, - 0.1875, - 0.0, - 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "texture" - ], - "total_cycles": [ - 0.53125, - 0.453125, - 0.53125, - 0.375, - 0.0, - 0.5, - 1.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 10, - "work_registers_used": 24 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_hardlight.frag.gles", - "has_uniform_computation": false, - "type": "Fragment", - "variants": { - "Main": { - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arithmetic" - ], - "longest_path_cycles": [ - 6.599999904632568, - 2.0, - 2.0 - ], - "pipelines": [ - "arithmetic", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arithmetic" - ], - "shortest_path_cycles": [ - 3.9600000381469727, - 1.0, - 0.0 - ], - "total_bound_pipelines": [ - "arithmetic" - ], - "total_cycles": [ - 8.0, - 2.0, - 4.0 - ] - }, - "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 4 - } - } - } - }, - "flutter/impeller/entity/gles/advanced_blend_hue.frag.gles": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_hue.frag.gles", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arith_total", - "arith_fma" - ], - "longest_path_cycles": [ - 0.71875, - 0.71875, - 0.625, - 0.5625, - 0.0, - 0.5, - 0.5 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_cvt" - ], - "shortest_path_cycles": [ - 0.40625, - 0.34375, - 0.40625, - 0.0, - 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "texture" - ], - "total_cycles": [ - 0.78125, - 0.71875, - 0.78125, - 0.5625, - 0.0, - 0.5, - 1.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 12, - "work_registers_used": 20 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_hue.frag.gles", - "has_uniform_computation": false, - "type": "Fragment", - "variants": { - "Main": { - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arithmetic" - ], - "longest_path_cycles": [ - 11.220000267028809, - 2.0, - 2.0 - ], - "pipelines": [ - "arithmetic", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arithmetic" - ], - "shortest_path_cycles": [ - 5.610000133514404, - 1.0, - 0.0 - ], - "total_bound_pipelines": [ - "arithmetic" - ], - "total_cycles": [ - 13.0, - 2.0, - 4.0 - ] - }, - "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 3 - } - } - } - }, - "flutter/impeller/entity/gles/advanced_blend_lighten.frag.gles": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_lighten.frag.gles", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "varying", - "texture" - ], - "longest_path_cycles": [ - 0.40625, - 0.1875, - 0.40625, - 0.375, - 0.0, - 0.5, - 0.5 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "varying", - "texture" - ], - "shortest_path_cycles": [ - 0.171875, - 0.15625, - 0.171875, - 0.0, - 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "texture" - ], - "total_cycles": [ - 0.515625, - 0.1875, - 0.515625, - 0.375, - 0.0, - 0.5, - 1.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 8, - "work_registers_used": 20 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_lighten.frag.gles", - "has_uniform_computation": false, - "type": "Fragment", - "variants": { - "Main": { - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arithmetic" - ], - "longest_path_cycles": [ - 5.28000020980835, - 2.0, - 2.0 - ], - "pipelines": [ - "arithmetic", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arithmetic" - ], - "shortest_path_cycles": [ - 2.309999942779541, - 1.0, - 0.0 - ], - "total_bound_pipelines": [ - "arithmetic" - ], - "total_cycles": [ - 6.333333492279053, - 2.0, - 4.0 - ] - }, - "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 2 - } - } - } - }, - "flutter/impeller/entity/gles/advanced_blend_luminosity.frag.gles": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_luminosity.frag.gles", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arith_total", - "arith_fma" - ], - "longest_path_cycles": [ - 0.609375, - 0.609375, - 0.46875, - 0.5, - 0.0, - 0.5, - 0.5 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma" - ], - "shortest_path_cycles": [ - 0.34375, - 0.34375, - 0.265625, - 0.0, - 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "texture" - ], - "total_cycles": [ - 0.609375, - 0.609375, - 0.578125, - 0.5, - 0.0, - 0.5, - 1.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 12, - "work_registers_used": 20 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_luminosity.frag.gles", - "has_uniform_computation": false, - "type": "Fragment", - "variants": { - "Main": { - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arithmetic" - ], - "longest_path_cycles": [ - 9.569999694824219, - 2.0, - 2.0 - ], - "pipelines": [ - "arithmetic", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arithmetic" - ], - "shortest_path_cycles": [ - 4.949999809265137, - 1.0, - 0.0 - ], - "total_bound_pipelines": [ - "arithmetic" - ], - "total_cycles": [ - 11.0, - 2.0, - 4.0 - ] - }, - "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 3 - } - } - } - }, - "flutter/impeller/entity/gles/advanced_blend_multiply.frag.gles": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_multiply.frag.gles", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "varying", - "texture" - ], - "longest_path_cycles": [ - 0.375, - 0.203125, - 0.375, - 0.375, - 0.0, - 0.5, - 0.5 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "varying", - "texture" - ], - "shortest_path_cycles": [ - 0.171875, - 0.171875, - 0.140625, - 0.0, + 0.3125, + 0.3125, 0.0, 0.25, 0.25 - ], - "total_bound_pipelines": [ - "texture" - ], - "total_cycles": [ - 0.484375, - 0.203125, - 0.484375, - 0.375, - 0.0, - 0.5, - 1.0 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 8, - "work_registers_used": 20 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_multiply.frag.gles", - "has_uniform_computation": false, - "type": "Fragment", - "variants": { - "Main": { - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arithmetic" - ], - "longest_path_cycles": [ - 5.610000133514404, - 2.0, - 2.0 - ], - "pipelines": [ - "arithmetic", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arithmetic" - ], - "shortest_path_cycles": [ - 2.640000104904175, - 1.0, - 0.0 - ], - "total_bound_pipelines": [ - "arithmetic" - ], - "total_cycles": [ - 6.666666507720947, - 2.0, - 4.0 - ] - }, - "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 2 + "uniform_registers_used": 10, + "work_registers_used": 16 } } } }, - "flutter/impeller/entity/gles/advanced_blend_overlay.frag.gles": { + "flutter/impeller/entity/gaussian_blur_noalpha_nodecal.frag.vkspv": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_overlay.frag.gles", + "filename": "flutter/impeller/entity/gaussian_blur_noalpha_nodecal.frag.vkspv", "has_side_effects": false, "has_uniform_computation": true, "modifies_coverage": false, @@ -3893,114 +1351,69 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 100, - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "varying", - "texture" - ], - "longest_path_cycles": [ - 0.453125, - 0.453125, - 0.4375, - 0.375, - 0.0, - 0.5, - 0.5 - ], - "pipelines": [ - "arith_total", - "arith_fma", - "arith_cvt", - "arith_sfu", - "load_store", - "varying", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma" - ], - "shortest_path_cycles": [ - 0.421875, - 0.421875, - 0.203125, - 0.0, - 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "texture" - ], - "total_cycles": [ - 0.546875, - 0.453125, - 0.546875, - 0.375, - 0.0, - 0.5, - 1.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 10, - "work_registers_used": 24 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_overlay.frag.gles", - "has_uniform_computation": false, - "type": "Fragment", - "variants": { - "Main": { + "fp16_arithmetic": 35, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "arithmetic" + null ], "longest_path_cycles": [ - 6.929999828338623, - 2.0, - 2.0 + null, + null, + null, + null, + null, + null, + null ], "pipelines": [ - "arithmetic", + "arith_total", + "arith_fma", + "arith_cvt", + "arith_sfu", "load_store", + "varying", "texture" ], "shortest_path_bound_pipelines": [ - "arithmetic" + "arith_total", + "arith_cvt" ], "shortest_path_cycles": [ - 3.9600000381469727, - 1.0, + 0.109375, + 0.03125, + 0.109375, + 0.0625, + 0.0, + 0.0, 0.0 ], "total_bound_pipelines": [ - "arithmetic" + "varying", + "texture" ], "total_cycles": [ - 8.0, - 2.0, - 4.0 + 0.203125, + 0.203125, + 0.203125, + 0.125, + 0.0, + 0.25, + 0.25 ] }, + "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 4 + "uniform_registers_used": 10, + "work_registers_used": 13 } } } }, - "flutter/impeller/entity/gles/advanced_blend_saturation.frag.gles": { + "flutter/impeller/entity/gles/advanced_blend.frag.gles": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_saturation.frag.gles", + "filename": "flutter/impeller/entity/gles/advanced_blend.frag.gles", "has_side_effects": false, "has_uniform_computation": true, "modifies_coverage": false, @@ -4010,18 +1423,18 @@ "uses_late_zs_update": false, "variants": { "Main": { - "fp16_arithmetic": 100, + "fp16_arithmetic": 0, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + "varying", + "texture" ], "longest_path_cycles": [ - 0.71875, - 0.71875, - 0.625, - 0.5625, + 0.46875, + 0.46875, + 0.359375, + 0.125, 0.0, 0.5, 0.5 @@ -4037,12 +1450,12 @@ ], "shortest_path_bound_pipelines": [ "arith_total", - "arith_cvt" + "arith_fma" ], "shortest_path_cycles": [ 0.40625, - 0.34375, 0.40625, + 0.15625, 0.0, 0.0, 0.25, @@ -4052,10 +1465,10 @@ "texture" ], "total_cycles": [ - 0.78125, - 0.71875, - 0.78125, - 0.5625, + 0.5, + 0.46875, + 0.5, + 0.125, 0.0, 0.5, 1.0 @@ -4064,13 +1477,13 @@ "stack_spill_bytes": 0, "thread_occupancy": 100, "uniform_registers_used": 12, - "work_registers_used": 20 + "work_registers_used": 24 } } }, "Mali-T880": { "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_saturation.frag.gles", + "filename": "flutter/impeller/entity/gles/advanced_blend.frag.gles", "has_uniform_computation": false, "type": "Fragment", "variants": { @@ -4081,7 +1494,7 @@ "arithmetic" ], "longest_path_cycles": [ - 11.550000190734863, + 6.269999980926514, 2.0, 2.0 ], @@ -4094,7 +1507,7 @@ "arithmetic" ], "shortest_path_cycles": [ - 5.610000133514404, + 3.299999952316284, 1.0, 0.0 ], @@ -4102,46 +1515,39 @@ "arithmetic" ], "total_cycles": [ - 13.0, + 7.333333492279053, 2.0, 4.0 ] }, "thread_occupancy": 100, "uniform_registers_used": 2, - "work_registers_used": 3 + "work_registers_used": 4 } } } }, - "flutter/impeller/entity/gles/advanced_blend_screen.frag.gles": { + "flutter/impeller/entity/gles/advanced_blend.vert.gles": { "Mali-G78": { "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_screen.frag.gles", - "has_side_effects": false, + "filename": "flutter/impeller/entity/gles/advanced_blend.vert.gles", "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, + "type": "Vertex", "variants": { - "Main": { - "fp16_arithmetic": 100, + "Position": { + "fp16_arithmetic": 0, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "longest_path_cycles": [ - 0.375, - 0.25, - 0.375, - 0.375, + 0.140625, + 0.140625, 0.0, - 0.5, - 0.5 + 0.0, + 2.0, + 0.0 ], "pipelines": [ "arith_total", @@ -4149,116 +1555,50 @@ "arith_cvt", "arith_sfu", "load_store", - "varying", "texture" ], "shortest_path_bound_pipelines": [ - "varying", - "texture" + "load_store" ], "shortest_path_cycles": [ - 0.21875, - 0.21875, + 0.140625, 0.140625, 0.0, 0.0, - 0.25, - 0.25 - ], - "total_bound_pipelines": [ - "texture" - ], - "total_cycles": [ - 0.484375, - 0.25, - 0.484375, - 0.375, - 0.0, - 0.5, - 1.0 - ] - }, - "stack_spill_bytes": 0, - "thread_occupancy": 100, - "uniform_registers_used": 8, - "work_registers_used": 20 - } - } - }, - "Mali-T880": { - "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_screen.frag.gles", - "has_uniform_computation": false, - "type": "Fragment", - "variants": { - "Main": { - "has_stack_spilling": false, - "performance": { - "longest_path_bound_pipelines": [ - "arithmetic" - ], - "longest_path_cycles": [ - 5.610000133514404, 2.0, - 2.0 - ], - "pipelines": [ - "arithmetic", - "load_store", - "texture" - ], - "shortest_path_bound_pipelines": [ - "arithmetic" - ], - "shortest_path_cycles": [ - 2.640000104904175, - 1.0, 0.0 ], "total_bound_pipelines": [ - "arithmetic" + "load_store" ], "total_cycles": [ - 6.666666507720947, + 0.140625, + 0.140625, + 0.0, + 0.0, 2.0, - 4.0 + 0.0 ] }, + "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 2 - } - } - } - }, - "flutter/impeller/entity/gles/advanced_blend_softlight.frag.gles": { - "Mali-G78": { - "core": "Mali-G78", - "filename": "flutter/impeller/entity/gles/advanced_blend_softlight.frag.gles", - "has_side_effects": false, - "has_uniform_computation": true, - "modifies_coverage": false, - "reads_color_buffer": false, - "type": "Fragment", - "uses_late_zs_test": false, - "uses_late_zs_update": false, - "variants": { - "Main": { - "fp16_arithmetic": 100, + "uniform_registers_used": 22, + "work_registers_used": 32 + }, + "Varying": { + "fp16_arithmetic": 0, "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + "load_store" ], "longest_path_cycles": [ - 0.75, - 0.75, - 0.578125, - 0.5625, + 0.03125, + 0.03125, + 0.03125, 0.0, - 0.5, - 0.5 + 4.0, + 0.0 ], "pipelines": [ "arith_total", @@ -4266,58 +1606,54 @@ "arith_cvt", "arith_sfu", "load_store", - "varying", "texture" ], "shortest_path_bound_pipelines": [ - "arith_total", - "arith_fma" + "load_store" ], "shortest_path_cycles": [ - 0.71875, - 0.71875, - 0.34375, - 0.1875, + 0.03125, + 0.03125, + 0.03125, 0.0, - 0.25, - 0.25 + 4.0, + 0.0 ], "total_bound_pipelines": [ - "texture" + "load_store" ], "total_cycles": [ - 0.75, - 0.75, - 0.6875, - 0.5625, + 0.03125, + 0.03125, + 0.03125, 0.0, - 0.5, - 1.0 + 4.0, + 0.0 ] }, "stack_spill_bytes": 0, "thread_occupancy": 100, - "uniform_registers_used": 14, - "work_registers_used": 30 + "uniform_registers_used": 10, + "work_registers_used": 10 } } }, "Mali-T880": { "core": "Mali-T880", - "filename": "flutter/impeller/entity/gles/advanced_blend_softlight.frag.gles", + "filename": "flutter/impeller/entity/gles/advanced_blend.vert.gles", "has_uniform_computation": false, - "type": "Fragment", + "type": "Vertex", "variants": { "Main": { "has_stack_spilling": false, "performance": { "longest_path_bound_pipelines": [ - "arithmetic" + "load_store" ], "longest_path_cycles": [ - 9.569999694824219, - 2.0, - 2.0 + 3.299999952316284, + 7.0, + 0.0 ], "pipelines": [ "arithmetic", @@ -4325,25 +1661,25 @@ "texture" ], "shortest_path_bound_pipelines": [ - "arithmetic" + "load_store" ], "shortest_path_cycles": [ - 6.599999904632568, - 1.0, + 3.299999952316284, + 7.0, 0.0 ], "total_bound_pipelines": [ - "arithmetic" + "load_store" ], "total_cycles": [ - 10.666666984558105, - 2.0, - 4.0 + 3.3333332538604736, + 7.0, + 0.0 ] }, "thread_occupancy": 100, - "uniform_registers_used": 2, - "work_registers_used": 4 + "uniform_registers_used": 6, + "work_registers_used": 3 } } } From 432700d614d4fd91951865de176fd08d36adbc99 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 30 Oct 2023 11:34:24 -0700 Subject: [PATCH 04/20] self code review. --- impeller/base/comparable.h | 4 - impeller/docs/specialization_constants.md | 90 +++++++++++++++++++ impeller/entity/contents/atlas_contents.cc | 2 - impeller/entity/contents/content_context.cc | 70 ++++++++------- impeller/entity/contents/content_context.h | 2 +- .../contents/filters/blend_filter_contents.cc | 6 -- .../shaders/blending/advanced_blend.frag | 19 ++-- .../shaders/blending/blend_dispatch.glsl | 61 ------------- .../entity/shaders/blending/blend_select.glsl | 60 +++++++++++++ .../shaders/blending/framebuffer_blend.frag | 18 ++-- .../shaders/blending/porter_duff_blend.frag | 12 +-- .../backend/gles/pipeline_library_gles.cc | 15 +--- .../renderer/backend/gles/proc_table_gles.cc | 13 ++- .../renderer/backend/gles/proc_table_gles.h | 2 +- .../backend/vulkan/pipeline_library_vk.cc | 6 +- impeller/renderer/pipeline_descriptor.cc | 6 +- impeller/renderer/pipeline_descriptor.h | 29 +----- 17 files changed, 233 insertions(+), 182 deletions(-) create mode 100644 impeller/docs/specialization_constants.md delete mode 100644 impeller/entity/shaders/blending/blend_dispatch.glsl create mode 100644 impeller/entity/shaders/blending/blend_select.glsl diff --git a/impeller/base/comparable.h b/impeller/base/comparable.h index 1937aebf2e0b3..08780f75c5e66 100644 --- a/impeller/base/comparable.h +++ b/impeller/base/comparable.h @@ -8,12 +8,8 @@ #include #include #include -#include #include -#include "flutter/fml/hash_combine.h" -#include "flutter/fml/macros.h" - namespace impeller { struct UniqueID { diff --git a/impeller/docs/specialization_constants.md b/impeller/docs/specialization_constants.md new file mode 100644 index 0000000000000..a475c02415888 --- /dev/null +++ b/impeller/docs/specialization_constants.md @@ -0,0 +1,90 @@ +# Specialization Constants + +Specialization constants have two possible benefits when used in a shader: + + * Improving performance, by removing branching and conditional code. + * Code organization/size, by removing the number of shader source files required. + +These goals are interrrelated, we can always reduce the number of shaders by creating +ubershaders. Or we can reduce branching by adding more shader variants. Specialization +constants provide a happy medium where the source files would be highly reptitive. + +## Example Usage + +Consider the case of the "decal" texture sampling mode. This is implement via clamp-to-border with +a border color set to transparent black. While this functionality is well supported on the Metal and +Vulkan backends, the GLES backend needs to support devices that do not have this extension. As a +result, the following code was used to conditionally decal: + +```glsl +// Decal sample if necessary. +vec4 Sample(sampler2D sampler, vec2 coord) { + #ifdef GLES + return IPSampleDecal(sampler, coord) + #else + return texture(sampler, coord); + #endif +} +``` + +This works great as long as we know that the GLES backend can never do the decal sample mode. This is also "free" as the ifdef branch is evaluated in the compiler. But eventually, we added a runtime check for decal mode as we need to support this on GLES. So the code turned into (approximately) the following: + +```glsl +#ifdef GLES +uniform float supports_decal; +#endif + +// Decal sample if necessary. +vec4 Sample(sampler2D sampler, vec2 coord) { + #ifdef GLES + if (supports_decal) { + return texture(sampler, coord); + } + return IPSampleDecal(sampler, coord) + #else + return texture(sampler, coord); + #endif +} +``` + +Now we've got decal support, but we've also got new problems: + +* The code is actually quite messy. We have to track different uniform values depending on the backend. +* The GLES backend is still paying some cost for branching, even though we "know" that decal is or isn't supported when the shader is compiled. + +### Specialization constants to the rescue + +Instead of using a runtime check, we can create a specialization constant that is set when compiling the +shader. This constant will be `1` if decal is supported and `0` otherwise. + +```glsl +layout(constant_id = 0) const int supports_decal = 1; + +vec4 Sample(sampler2D sampler, vec2 coord) { + if (supports_decal) { + return texture(sampler, coord); + } + return IPSampleDecal(sampler, coord) +} + +``` + +Immediately we realize a number of benefits: + +* Code is the same across all backends +* Runtime branching cost is removed as the branch is compiled out. + + +## Implementation + +Currently the only constant values that are support are 32bit ints. This should be sufficient for now as we +should generally only use these values for true/false or select-style constants. Please don't try to add +constant color values or anything like that. + +Specialization constants are provided to the CreateDefault argument in content_context.cc and aren't a +part of variants. This is intentional: specialization constants shouldn't be used to create (potentially unlimited) runtime variants of a shader. + +Backend specific information: +* In the Metal backend, the specialization constants are mapped to a MTLFunctionConstantValues. See also: https://developer.apple.com/documentation/metal/using_function_specialization_to_build_pipeline_variants?language=objc +* In the Vulkan backend, the specialization constants are mapped to VkSpecializationINfo. See also: https://blogs.igalia.com/itoral/2018/03/20/improving-shader-performance-with-vulkans-specialization-constants/ +* In the GLES backend, the SPIRV Cross compiler will generate defines named `#ifdef SPIRV_CROSS_CONSTANT_i`, where i is the index of constant. The Impeller runtime will insert `#define SPIRV_CROSS_CONSTANT_i` in the header of the shader. \ No newline at end of file diff --git a/impeller/entity/contents/atlas_contents.cc b/impeller/entity/contents/atlas_contents.cc index 34030ac95a9f0..f92c3dbd3449b 100644 --- a/impeller/entity/contents/atlas_contents.cc +++ b/impeller/entity/contents/atlas_contents.cc @@ -262,8 +262,6 @@ bool AtlasContents::Render(const ContentContext& renderer, dst_sampler_descriptor.width_address_mode = SamplerAddressMode::kDecal; dst_sampler_descriptor.height_address_mode = SamplerAddressMode::kDecal; } - frag_info.supports_decal_sampler_address_mode = - renderer.GetDeviceCapabilities().SupportsDecalSamplerAddressMode(); auto dst_sampler = renderer.GetContext()->GetSamplerLibrary()->GetSampler( dst_sampler_descriptor); FS::BindTextureSamplerDst(cmd, texture_, dst_sampler); diff --git a/impeller/entity/contents/content_context.cc b/impeller/entity/contents/content_context.cc index 08b70f7c67ea3..e91f6f038e1e5 100644 --- a/impeller/entity/contents/content_context.cc +++ b/impeller/entity/contents/content_context.cc @@ -155,10 +155,9 @@ void ContentContextOptions::ApplyToPipelineDescriptor( template static std::unique_ptr CreateDefaultPipeline( - const Context& context, - const std::map& constants = {}) { + const Context& context) { auto desc = - PipelineT::Builder::MakeDefaultPipelineDescriptor(context, constants); + PipelineT::Builder::MakeDefaultPipelineDescriptor(context); if (!desc.has_value()) { return nullptr; } @@ -199,6 +198,8 @@ ContentContext::ContentContext( .primitive_type = PrimitiveType::kTriangleStrip, .color_attachment_pixel_format = context_->GetCapabilities()->GetDefaultColorFormat()}; + const auto supports_decal = + context_->GetCapabilities()->SupportsDecalSamplerAddressMode(); #ifdef IMPELLER_DEBUG checkerboard_pipelines_.CreateDefault(*context_, options); @@ -221,96 +222,96 @@ ContentContext::ContentContext( if (context_->GetCapabilities()->SupportsFramebufferFetch()) { framebuffer_blend_color_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kColor)}); + {static_cast(BlendSelectValues::kColor), supports_decal}); framebuffer_blend_colorburn_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kColorBurn)}); + {static_cast(BlendSelectValues::kColorBurn), supports_decal}); framebuffer_blend_colordodge_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kColorDodge)}); + {static_cast(BlendSelectValues::kColorDodge), supports_decal}); framebuffer_blend_darken_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kDarken)}); + {static_cast(BlendSelectValues::kDarken), supports_decal}); framebuffer_blend_difference_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kDifference)}); + {static_cast(BlendSelectValues::kDifference), supports_decal}); framebuffer_blend_exclusion_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kExclusion)}); + {static_cast(BlendSelectValues::kExclusion), supports_decal}); framebuffer_blend_hardlight_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kHardLight)}); + {static_cast(BlendSelectValues::kHardLight), supports_decal}); framebuffer_blend_hue_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kHue)}); + {static_cast(BlendSelectValues::kHue), supports_decal}); framebuffer_blend_lighten_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kLighten)}); + {static_cast(BlendSelectValues::kLighten), supports_decal}); framebuffer_blend_luminosity_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kLuminosity)}); + {static_cast(BlendSelectValues::kLuminosity), supports_decal}); framebuffer_blend_multiply_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kMultiply)}); + {static_cast(BlendSelectValues::kMultiply), supports_decal}); framebuffer_blend_overlay_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kOverlay)}); + {static_cast(BlendSelectValues::kOverlay), supports_decal}); framebuffer_blend_saturation_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kSaturation)}); + {static_cast(BlendSelectValues::kSaturation), supports_decal}); framebuffer_blend_screen_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kScreen)}); + {static_cast(BlendSelectValues::kScreen), supports_decal}); framebuffer_blend_softlight_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kSoftLight)}); + {static_cast(BlendSelectValues::kSoftLight), supports_decal}); } blend_color_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kColor)}); + {static_cast(BlendSelectValues::kColor), supports_decal}); blend_colorburn_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kColorBurn)}); + {static_cast(BlendSelectValues::kColorBurn), supports_decal}); blend_colordodge_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kColorDodge)}); + {static_cast(BlendSelectValues::kColorDodge), supports_decal}); blend_darken_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kDarken)}); + {static_cast(BlendSelectValues::kDarken), supports_decal}); blend_difference_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kDifference)}); + {static_cast(BlendSelectValues::kDifference), supports_decal}); blend_exclusion_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kExclusion)}); + {static_cast(BlendSelectValues::kExclusion), supports_decal}); blend_hardlight_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kHardLight)}); + {static_cast(BlendSelectValues::kHardLight), supports_decal}); blend_hue_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kHue)}); + {static_cast(BlendSelectValues::kHue), supports_decal}); blend_lighten_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kLighten)}); + {static_cast(BlendSelectValues::kLighten), supports_decal}); blend_luminosity_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kLuminosity)}); + {static_cast(BlendSelectValues::kLuminosity), supports_decal}); blend_multiply_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kMultiply)}); + {static_cast(BlendSelectValues::kMultiply), supports_decal}); blend_overlay_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kOverlay)}); + {static_cast(BlendSelectValues::kOverlay), supports_decal}); blend_saturation_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kSaturation)}); + {static_cast(BlendSelectValues::kSaturation), supports_decal}); blend_screen_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kScreen)}); + {static_cast(BlendSelectValues::kScreen), supports_decal}); blend_softlight_pipelines_.CreateDefault( *context_, options_trianglestrip, - {static_cast(BlendSelectValues::kSoftLight)}); + {static_cast(BlendSelectValues::kSoftLight), supports_decal}); rrect_blur_pipelines_.CreateDefault(*context_, options_trianglestrip); texture_blend_pipelines_.CreateDefault(*context_, options); @@ -333,7 +334,8 @@ ContentContext::ContentContext( glyph_atlas_color_pipelines_.CreateDefault(*context_, options); geometry_color_pipelines_.CreateDefault(*context_, options); yuv_to_rgb_filter_pipelines_.CreateDefault(*context_, options_trianglestrip); - porter_duff_blend_pipelines_.CreateDefault(*context_, options_trianglestrip); + porter_duff_blend_pipelines_.CreateDefault(*context_, options_trianglestrip, + {supports_decal}); // GLES only shader. #ifdef IMPELLER_ENABLE_OPENGLES if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) { diff --git a/impeller/entity/contents/content_context.h b/impeller/entity/contents/content_context.h index ded67be8cacb9..7fdcc6cbc74e8 100644 --- a/impeller/entity/contents/content_context.h +++ b/impeller/entity/contents/content_context.h @@ -701,7 +701,7 @@ class ContentContext { void CreateDefault(const Context& context, const ContentContextOptions& options, - const std::initializer_list& constants = {}) { + const std::initializer_list& constants = {}) { auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context, constants); if (!desc.has_value()) { diff --git a/impeller/entity/contents/filters/blend_filter_contents.cc b/impeller/entity/contents/filters/blend_filter_contents.cc index 225f915f9aa5e..197b74d998e73 100644 --- a/impeller/entity/contents/filters/blend_filter_contents.cc +++ b/impeller/entity/contents/filters/blend_filter_contents.cc @@ -180,8 +180,6 @@ static std::optional AdvancedBlend( dst_sampler_descriptor.width_address_mode = SamplerAddressMode::kDecal; dst_sampler_descriptor.height_address_mode = SamplerAddressMode::kDecal; } - blend_info.supports_decal_sampler_address_mode = - renderer.GetDeviceCapabilities().SupportsDecalSamplerAddressMode(); auto dst_sampler = renderer.GetContext()->GetSamplerLibrary()->GetSampler( dst_sampler_descriptor); FS::BindTextureSamplerDst(cmd, dst_snapshot->texture, dst_sampler); @@ -354,8 +352,6 @@ std::optional BlendFilterContents::CreateForegroundAdvancedBlend( dst_sampler_descriptor.width_address_mode = SamplerAddressMode::kDecal; dst_sampler_descriptor.height_address_mode = SamplerAddressMode::kDecal; } - blend_info.supports_decal_sampler_address_mode = - renderer.GetDeviceCapabilities().SupportsDecalSamplerAddressMode(); auto dst_sampler = renderer.GetContext()->GetSamplerLibrary()->GetSampler( dst_sampler_descriptor); FS::BindTextureSamplerDst(cmd, dst_snapshot->texture, dst_sampler); @@ -478,8 +474,6 @@ std::optional BlendFilterContents::CreateForegroundPorterDuffBlend( dst_sampler_descriptor.width_address_mode = SamplerAddressMode::kDecal; dst_sampler_descriptor.height_address_mode = SamplerAddressMode::kDecal; } - frag_info.supports_decal_sampler_address_mode = - renderer.GetDeviceCapabilities().SupportsDecalSamplerAddressMode(); auto dst_sampler = renderer.GetContext()->GetSamplerLibrary()->GetSampler( dst_sampler_descriptor); FS::BindTextureSamplerDst(cmd, dst_snapshot->texture, dst_sampler); diff --git a/impeller/entity/shaders/blending/advanced_blend.frag b/impeller/entity/shaders/blending/advanced_blend.frag index 513fc8fc9022a..258ab66c392c6 100644 --- a/impeller/entity/shaders/blending/advanced_blend.frag +++ b/impeller/entity/shaders/blending/advanced_blend.frag @@ -6,7 +6,10 @@ #include #include #include -#include "blend_dispatch.glsl" +#include "blend_select.glsl" + +layout(constant_id = 0) const int blend_type = 0; +layout(constant_id = 1) const int supports_decal = 1; uniform BlendInfo { float16_t dst_input_alpha; @@ -26,17 +29,14 @@ in vec2 v_src_texture_coords; out f16vec4 frag_color; f16vec4 Sample(f16sampler2D texture_sampler, vec2 texture_coords) { -#ifdef IMPELLER_TARGET_OPENGLES - if (blend_info.supports_decal_sampler_address_mode > 0.0) { + if (supports_decal > 0.0) { return texture(texture_sampler, texture_coords); - } else { - return IPHalfSampleDecal(texture_sampler, texture_coords); } -#else - return texture(texture_sampler, texture_coords); -#endif + return IPHalfSampleDecal(texture_sampler, texture_coords); } +AdvancedBlend(blend_type); + void main() { f16vec4 dst_sample = Sample(texture_sampler_dst, // sampler v_dst_texture_coords // texture coordinates @@ -51,6 +51,7 @@ void main() { ) * blend_info.src_input_alpha; - f16vec4 blended = mix(src, f16vec4(Blend(dst.rgb, src.rgb), dst.a), dst.a); + f16vec3 blend_result = Blend(dst.rgb, src.rgb); + f16vec4 blended = mix(src, f16vec4(blend_result, dst.a), dst.a); frag_color = mix(dst_sample, blended, src.a); } diff --git a/impeller/entity/shaders/blending/blend_dispatch.glsl b/impeller/entity/shaders/blending/blend_dispatch.glsl deleted file mode 100644 index e256cbc2cae26..0000000000000 --- a/impeller/entity/shaders/blending/blend_dispatch.glsl +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include -#include -#include - -layout(constant_id = 0) const int blend_type = 0; - -// kScreen = 0, -// kOverlay, -// kDarken, -// kLighten, -// kColorDodge, -// kColorBurn, -// kHardLight, -// kSoftLight, -// kDifference, -// kExclusion, -// kMultiply, -// kHue, -// kSaturation, -// kColor, -// kLuminosity, -f16vec3 Blend(f16vec3 dst, f16vec3 src) { - switch (blend_type) { - case 0: - return IPBlendScreen(dst, src); - case 1: - return IPBlendOverlay(dst, src); - case 2: - return IPBlendDarken(dst, src); - case 3: - return IPBlendLighten(dst, src); - case 4: - return IPBlendColorDodge(dst, src); - case 5: - return IPBlendColorBurn(dst, src); - case 6: - return IPBlendHardLight(dst, src); - case 7: - return IPBlendSoftLight(dst, src); - case 8: - return IPBlendDifference(dst, src); - case 9: - return IPBlendExclusion(dst, src); - case 10: - return IPBlendMultiply(dst, src); - case 11: - return IPBlendHue(dst, src); - case 12: - return IPBlendSaturation(dst, src); - case 13: - return IPBlendColor(dst, src); - case 14: - return IPBlendLuminosity(dst, src); - default: - return f16vec3(0.0hf); - } -} diff --git a/impeller/entity/shaders/blending/blend_select.glsl b/impeller/entity/shaders/blending/blend_select.glsl new file mode 100644 index 0000000000000..43fb04ca50138 --- /dev/null +++ b/impeller/entity/shaders/blending/blend_select.glsl @@ -0,0 +1,60 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include +#include +#include + +// kScreen = 0, +// kOverlay, +// kDarken, +// kLighten, +// kColorDodge, +// kColorBurn, +// kHardLight, +// kSoftLight, +// kDifference, +// kExclusion, +// kMultiply, +// kHue, +// kSaturation, +// kColor, +// kLuminosity, +#define AdvancedBlend(blend_type) \ + f16vec3 Blend(f16vec3 dst, f16vec3 src) { \ + switch (blend_type) { \ + case 0: \ + return IPBlendScreen(dst, src); \ + case 1: \ + return IPBlendOverlay(dst, src); \ + case 2: \ + return IPBlendDarken(dst, src); \ + case 3: \ + return IPBlendLighten(dst, src); \ + case 4: \ + return IPBlendColorDodge(dst, src); \ + case 5: \ + return IPBlendColorBurn(dst, src); \ + case 6: \ + return IPBlendHardLight(dst, src); \ + case 7: \ + return IPBlendSoftLight(dst, src); \ + case 8: \ + return IPBlendDifference(dst, src); \ + case 9: \ + return IPBlendExclusion(dst, src); \ + case 10: \ + return IPBlendMultiply(dst, src); \ + case 11: \ + return IPBlendHue(dst, src); \ + case 12: \ + return IPBlendSaturation(dst, src); \ + case 13: \ + return IPBlendColor(dst, src); \ + case 14: \ + return IPBlendLuminosity(dst, src); \ + default: \ + return f16vec3(0.0hf); \ + } \ + } diff --git a/impeller/entity/shaders/blending/framebuffer_blend.frag b/impeller/entity/shaders/blending/framebuffer_blend.frag index a8ad6143d044d..076a4d7b25cde 100644 --- a/impeller/entity/shaders/blending/framebuffer_blend.frag +++ b/impeller/entity/shaders/blending/framebuffer_blend.frag @@ -8,7 +8,10 @@ #include #include #include -#include "blend_dispatch.glsl" +#include "blend_select.glsl" + +layout(constant_id = 0) const int blend_type = 0; +layout(constant_id = 1) const int supports_decal = 1; layout(set = 0, binding = 0, @@ -30,14 +33,14 @@ in vec2 v_src_texture_coords; out vec4 frag_color; vec4 Sample(sampler2D texture_sampler, vec2 texture_coords) { -// gles 2.0 is the only backend without native decal support. -#ifdef IMPELLER_TARGET_OPENGLES + if (supports_decal > 1) { + return texture(texture_sampler, texture_coords); + } return IPSampleDecal(texture_sampler, texture_coords); -#else - return texture(texture_sampler, texture_coords); -#endif } +AdvancedBlend(blend_type); + void main() { f16vec4 dst = f16vec4(ReadDestination()); f16vec4 src = f16vec4(Sample(texture_sampler_src, // sampler @@ -45,6 +48,7 @@ void main() { )) * frag_info.src_input_alpha; - f16vec4 blended = mix(src, f16vec4(Blend(dst.rgb, src.rgb), dst.a), dst.a); + f16vec3 blend_result = Blend(dst.rgb, src.rgb); + f16vec4 blended = mix(src, f16vec4(blend_result, dst.a), dst.a); frag_color = vec4(mix(dst, blended, src.a)); } diff --git a/impeller/entity/shaders/blending/porter_duff_blend.frag b/impeller/entity/shaders/blending/porter_duff_blend.frag index 7e3498ff0d33c..0d140e754e27f 100644 --- a/impeller/entity/shaders/blending/porter_duff_blend.frag +++ b/impeller/entity/shaders/blending/porter_duff_blend.frag @@ -9,6 +9,8 @@ precision mediump float; #include #include +layout(constant_id = 0) const int supports_decal = 1; + uniform f16sampler2D texture_sampler_dst; uniform FragInfo { @@ -19,7 +21,6 @@ uniform FragInfo { float16_t dst_coeff_src_color; float16_t input_alpha; float16_t output_alpha; - float supports_decal_sampler_address_mode; } frag_info; @@ -29,15 +30,10 @@ in f16vec4 v_color; out f16vec4 frag_color; f16vec4 Sample(f16sampler2D texture_sampler, vec2 texture_coords) { -#ifdef IMPELLER_TARGET_OPENGLES - if (frag_info.supports_decal_sampler_address_mode > 0.0) { + if (supports_decal > 0.0) { return texture(texture_sampler, texture_coords); - } else { - return IPHalfSampleDecal(texture_sampler, texture_coords); } -#else - return texture(texture_sampler, texture_coords); -#endif + return IPHalfSampleDecal(texture_sampler, texture_coords); } void main() { diff --git a/impeller/renderer/backend/gles/pipeline_library_gles.cc b/impeller/renderer/backend/gles/pipeline_library_gles.cc index 12842229a51bf..85316e386dd12 100644 --- a/impeller/renderer/backend/gles/pipeline_library_gles.cc +++ b/impeller/renderer/backend/gles/pipeline_library_gles.cc @@ -115,17 +115,10 @@ static bool LinkProgram( fml::ScopedCleanupClosure delete_frag_shader( [&gl, frag_shader]() { gl.DeleteShader(frag_shader); }); - std::vector defines = {}; - size_t index = 0; - for (const auto value : descriptor.GetSpecializationConstants()) { - std::stringstream ss; - ss << "#define SPIRV_CROSS_CONSTANT_ID_" << index << " " << value; - defines.emplace_back(ss.str()); - index++; - } - - gl.ShaderSourceMapping(vert_shader, *vert_mapping, defines); - gl.ShaderSourceMapping(frag_shader, *frag_mapping, defines); + gl.ShaderSourceMapping(vert_shader, *vert_mapping, + descriptor.GetSpecializationConstants()); + gl.ShaderSourceMapping(frag_shader, *frag_mapping, + descriptor.GetSpecializationConstants()); gl.CompileShader(vert_shader); gl.CompileShader(frag_shader); diff --git a/impeller/renderer/backend/gles/proc_table_gles.cc b/impeller/renderer/backend/gles/proc_table_gles.cc index d5b9473d9baa0..d1d0dd7886047 100644 --- a/impeller/renderer/backend/gles/proc_table_gles.cc +++ b/impeller/renderer/backend/gles/proc_table_gles.cc @@ -139,10 +139,9 @@ bool ProcTableGLES::IsValid() const { return is_valid_; } -void ProcTableGLES::ShaderSourceMapping( - GLuint shader, - const fml::Mapping& mapping, - const std::vector& defines) const { +void ProcTableGLES::ShaderSourceMapping(GLuint shader, + const fml::Mapping& mapping, + const std::vector& defines) const { if (defines.empty()) { const GLchar* sources[] = { reinterpret_cast(mapping.GetMapping())}; @@ -160,9 +159,9 @@ void ProcTableGLES::ShaderSourceMapping( } std::stringstream ss; - for (auto define : defines) { - ss << define; - ss << '\n'; + for (auto i = 0u; i < defines.size(); i++) { + ss << "#define SPIRV_CROSS_CONSTANT_ID_" << index << " " << defines[i] + << '\n'; } auto define_string = ss.str(); shader_source.insert(index + 1, define_string); diff --git a/impeller/renderer/backend/gles/proc_table_gles.h b/impeller/renderer/backend/gles/proc_table_gles.h index cf726a6f5035b..3beddd138d88e 100644 --- a/impeller/renderer/backend/gles/proc_table_gles.h +++ b/impeller/renderer/backend/gles/proc_table_gles.h @@ -240,7 +240,7 @@ class ProcTableGLES { /// support static specialization. For example, setting "#define Foo 1". void ShaderSourceMapping(GLuint shader, const fml::Mapping& mapping, - const std::vector& defines = {}) const; + const std::vector& defines = {}) const; const DescriptionGLES* GetDescription() const; diff --git a/impeller/renderer/backend/vulkan/pipeline_library_vk.cc b/impeller/renderer/backend/vulkan/pipeline_library_vk.cc index 227b2a56b6d0d..7bd61e187bf8f 100644 --- a/impeller/renderer/backend/vulkan/pipeline_library_vk.cc +++ b/impeller/renderer/backend/vulkan/pipeline_library_vk.cc @@ -298,8 +298,8 @@ std::unique_ptr PipelineLibraryVK::CreatePipeline( map_entries[entrypoint_count]; for (auto i = 0u; i < constants.size(); i++) { vk::SpecializationMapEntry entry; - entry.offset = (i * sizeof(int)); - entry.size = sizeof(int); + entry.offset = (i * sizeof(int32_t)); + entry.size = sizeof(int32_t); entry.constantID = i; entries.emplace_back(entry); } @@ -308,7 +308,7 @@ std::unique_ptr PipelineLibraryVK::CreatePipeline( specialization_infos[entrypoint_count]; specialization_info.setMapEntries(map_entries[entrypoint_count]); specialization_info.setPData(constants.data()); - specialization_info.setDataSize(sizeof(int) * constants.size()); + specialization_info.setDataSize(sizeof(int32_t) * constants.size()); vk::PipelineShaderStageCreateInfo info; info.setStage(stage.value()); diff --git a/impeller/renderer/pipeline_descriptor.cc b/impeller/renderer/pipeline_descriptor.cc index 1b1537ca3db39..22ee4c30c4945 100644 --- a/impeller/renderer/pipeline_descriptor.cc +++ b/impeller/renderer/pipeline_descriptor.cc @@ -281,11 +281,13 @@ PolygonMode PipelineDescriptor::GetPolygonMode() const { return polygon_mode_; } -void PipelineDescriptor::SetSpecializationConstants(std::vector values) { +void PipelineDescriptor::SetSpecializationConstants( + std::vector values) { specialization_constants_ = std::move(values); } -const std::vector& PipelineDescriptor::GetSpecializationConstants() const { +const std::vector& PipelineDescriptor::GetSpecializationConstants() + const { return specialization_constants_; } diff --git a/impeller/renderer/pipeline_descriptor.h b/impeller/renderer/pipeline_descriptor.h index ec2447e13934d..1045ea8fbd3fd 100644 --- a/impeller/renderer/pipeline_descriptor.h +++ b/impeller/renderer/pipeline_descriptor.h @@ -7,9 +7,7 @@ #include #include #include -#include -#include "flutter/fml/hash_combine.h" #include "impeller/base/comparable.h" #include "impeller/core/formats.h" #include "impeller/core/shader_types.h" @@ -22,27 +20,6 @@ class VertexDescriptor; template class Pipeline; -struct SpecializationConstant { - const char* name; - size_t index; - ShaderType type; - - struct Equal { - constexpr bool operator()(const SpecializationConstant& a, - const SpecializationConstant& b) const { - return a.name == b.name && // - a.index == b.index && // - a.type == b.type; - } - }; - - struct Hash { - std::size_t operator()(const SpecializationConstant& key) const { - return fml::HashCombine(key.name, key.index, key.type); - } - }; -}; - class PipelineDescriptor final : public Comparable { public: PipelineDescriptor(); @@ -147,9 +124,9 @@ class PipelineDescriptor final : public Comparable { PolygonMode GetPolygonMode() const; - void SetSpecializationConstants(std::vector values); + void SetSpecializationConstants(std::vector values); - const std::vector& GetSpecializationConstants() const; + const std::vector& GetSpecializationConstants() const; private: std::string label_; @@ -169,7 +146,7 @@ class PipelineDescriptor final : public Comparable { back_stencil_attachment_descriptor_; PrimitiveType primitive_type_ = PrimitiveType::kTriangle; PolygonMode polygon_mode_ = PolygonMode::kFill; - std::vector specialization_constants_; + std::vector specialization_constants_; }; } // namespace impeller From bdab80d0ef73478cacd39779cb59f85f9c36f561 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 30 Oct 2023 11:45:56 -0700 Subject: [PATCH 05/20] ++ --- impeller/entity/contents/content_context.cc | 3 +-- impeller/renderer/backend/gles/proc_table_gles.cc | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/impeller/entity/contents/content_context.cc b/impeller/entity/contents/content_context.cc index e91f6f038e1e5..79a812a70133c 100644 --- a/impeller/entity/contents/content_context.cc +++ b/impeller/entity/contents/content_context.cc @@ -156,8 +156,7 @@ void ContentContextOptions::ApplyToPipelineDescriptor( template static std::unique_ptr CreateDefaultPipeline( const Context& context) { - auto desc = - PipelineT::Builder::MakeDefaultPipelineDescriptor(context); + auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context); if (!desc.has_value()) { return nullptr; } diff --git a/impeller/renderer/backend/gles/proc_table_gles.cc b/impeller/renderer/backend/gles/proc_table_gles.cc index d1d0dd7886047..d8279f1e3a9a8 100644 --- a/impeller/renderer/backend/gles/proc_table_gles.cc +++ b/impeller/renderer/backend/gles/proc_table_gles.cc @@ -139,9 +139,10 @@ bool ProcTableGLES::IsValid() const { return is_valid_; } -void ProcTableGLES::ShaderSourceMapping(GLuint shader, - const fml::Mapping& mapping, - const std::vector& defines) const { +void ProcTableGLES::ShaderSourceMapping( + GLuint shader, + const fml::Mapping& mapping, + const std::vector& defines) const { if (defines.empty()) { const GLchar* sources[] = { reinterpret_cast(mapping.GetMapping())}; From e10ebb2075505afbce00c8ba1bb93e3314e05c7a Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 30 Oct 2023 13:27:40 -0700 Subject: [PATCH 06/20] ++ --- ci/licenses_golden/licenses_flutter | 4 ++-- impeller/tools/malioc.json | 25 +++++++++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 45f4a2ebe2290..21f9efd43db4b 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -2874,7 +2874,7 @@ ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend.frag + ORIGIN: ../../../flutter/impeller/entity/shaders/blending/advanced_blend.vert + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/blending/blend.frag + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/blending/blend.vert + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/entity/shaders/blending/blend_dispatch.glsl + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/entity/shaders/blending/blend_select.glsl + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/blending/framebuffer_blend.frag + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/blending/framebuffer_blend.vert + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/blending/porter_duff_blend.frag + ../../../flutter/LICENSE @@ -5628,7 +5628,7 @@ FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend.frag FILE: ../../../flutter/impeller/entity/shaders/blending/advanced_blend.vert FILE: ../../../flutter/impeller/entity/shaders/blending/blend.frag FILE: ../../../flutter/impeller/entity/shaders/blending/blend.vert -FILE: ../../../flutter/impeller/entity/shaders/blending/blend_dispatch.glsl +FILE: ../../../flutter/impeller/entity/shaders/blending/blend_select.glsl FILE: ../../../flutter/impeller/entity/shaders/blending/framebuffer_blend.frag FILE: ../../../flutter/impeller/entity/shaders/blending/framebuffer_blend.vert FILE: ../../../flutter/impeller/entity/shaders/blending/porter_duff_blend.frag diff --git a/impeller/tools/malioc.json b/impeller/tools/malioc.json index 5a63fc96f276c..1aa9b4e8a8242 100644 --- a/impeller/tools/malioc.json +++ b/impeller/tools/malioc.json @@ -1433,8 +1433,8 @@ "longest_path_cycles": [ 0.46875, 0.46875, - 0.359375, - 0.125, + 0.0625, + 0.0, 0.0, 0.5, 0.5 @@ -1455,23 +1455,24 @@ "shortest_path_cycles": [ 0.40625, 0.40625, - 0.15625, + 0.109375, 0.0, 0.0, 0.25, 0.25 ], "total_bound_pipelines": [ + "varying", "texture" ], "total_cycles": [ - 0.5, 0.46875, - 0.5, - 0.125, + 0.46875, + 0.140625, + 0.0, 0.0, 0.5, - 1.0 + 0.5 ] }, "stack_spill_bytes": 0, @@ -1494,7 +1495,7 @@ "arithmetic" ], "longest_path_cycles": [ - 6.269999980926514, + 2.9700000286102295, 2.0, 2.0 ], @@ -1507,17 +1508,17 @@ "arithmetic" ], "shortest_path_cycles": [ - 3.299999952316284, + 2.640000104904175, 1.0, - 0.0 + 1.0 ], "total_bound_pipelines": [ "arithmetic" ], "total_cycles": [ - 7.333333492279053, + 3.3333332538604736, 2.0, - 4.0 + 2.0 ] }, "thread_occupancy": 100, From ea91c9fe9fb25c92abe755b54d5a235a1b7ef127 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 30 Oct 2023 14:01:51 -0700 Subject: [PATCH 07/20] GLES fixes --- .../entity/shaders/blending/blend_select.glsl | 66 +++++++++---------- .../renderer/backend/gles/proc_table_gles.cc | 3 +- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/impeller/entity/shaders/blending/blend_select.glsl b/impeller/entity/shaders/blending/blend_select.glsl index 43fb04ca50138..608093500f768 100644 --- a/impeller/entity/shaders/blending/blend_select.glsl +++ b/impeller/entity/shaders/blending/blend_select.glsl @@ -21,40 +21,40 @@ // kSaturation, // kColor, // kLuminosity, +// Note, this isn't a switch as GLSL 1.0 does not support them. #define AdvancedBlend(blend_type) \ f16vec3 Blend(f16vec3 dst, f16vec3 src) { \ - switch (blend_type) { \ - case 0: \ - return IPBlendScreen(dst, src); \ - case 1: \ - return IPBlendOverlay(dst, src); \ - case 2: \ - return IPBlendDarken(dst, src); \ - case 3: \ - return IPBlendLighten(dst, src); \ - case 4: \ - return IPBlendColorDodge(dst, src); \ - case 5: \ - return IPBlendColorBurn(dst, src); \ - case 6: \ - return IPBlendHardLight(dst, src); \ - case 7: \ - return IPBlendSoftLight(dst, src); \ - case 8: \ - return IPBlendDifference(dst, src); \ - case 9: \ - return IPBlendExclusion(dst, src); \ - case 10: \ - return IPBlendMultiply(dst, src); \ - case 11: \ - return IPBlendHue(dst, src); \ - case 12: \ - return IPBlendSaturation(dst, src); \ - case 13: \ - return IPBlendColor(dst, src); \ - case 14: \ - return IPBlendLuminosity(dst, src); \ - default: \ - return f16vec3(0.0hf); \ + if (blend_type == 0) { \ + return IPBlendScreen(dst, src); \ + } else if (blend_type == 1) { \ + return IPBlendOverlay(dst, src); \ + } else if (blend_type == 2) { \ + return IPBlendDarken(dst, src); \ + } else if (blend_type == 3) { \ + return IPBlendLighten(dst, src); \ + } else if (blend_type == 4) { \ + return IPBlendColorDodge(dst, src); \ + } else if (blend_type == 5) { \ + return IPBlendColorBurn(dst, src); \ + } else if (blend_type == 6) { \ + return IPBlendHardLight(dst, src); \ + } else if (blend_type == 7) { \ + return IPBlendSoftLight(dst, src); \ + } else if (blend_type == 8) { \ + return IPBlendDifference(dst, src); \ + } else if (blend_type == 9) { \ + return IPBlendExclusion(dst, src); \ + } else if (blend_type == 10) { \ + return IPBlendMultiply(dst, src); \ + } else if (blend_type == 11) { \ + return IPBlendHue(dst, src); \ + } else if (blend_type == 12) { \ + return IPBlendSaturation(dst, src); \ + } else if (blend_type == 13) { \ + return IPBlendColor(dst, src); \ + } else if (blend_type == 14) { \ + return IPBlendLuminosity(dst, src); \ + } else { \ + return f16vec3(0.0hf); \ } \ } diff --git a/impeller/renderer/backend/gles/proc_table_gles.cc b/impeller/renderer/backend/gles/proc_table_gles.cc index d8279f1e3a9a8..39b5768d87d64 100644 --- a/impeller/renderer/backend/gles/proc_table_gles.cc +++ b/impeller/renderer/backend/gles/proc_table_gles.cc @@ -161,8 +161,7 @@ void ProcTableGLES::ShaderSourceMapping( std::stringstream ss; for (auto i = 0u; i < defines.size(); i++) { - ss << "#define SPIRV_CROSS_CONSTANT_ID_" << index << " " << defines[i] - << '\n'; + ss << "#define SPIRV_CROSS_CONSTANT_ID_" << i << " " << defines[i] << '\n'; } auto define_string = ss.str(); shader_source.insert(index + 1, define_string); From bd3e5dddc0476405712ca40fde6eae34cf75e05c Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 30 Oct 2023 14:34:57 -0700 Subject: [PATCH 08/20] well I tried. --- impeller/renderer/backend/gles/BUILD.gn | 1 + .../renderer/backend/gles/proc_table_gles.cc | 24 ++++-- .../renderer/backend/gles/proc_table_gles.h | 5 ++ .../specialization_constants_unittests.cc | 75 +++++++++++++++++++ 4 files changed, 99 insertions(+), 6 deletions(-) create mode 100644 impeller/renderer/backend/gles/test/specialization_constants_unittests.cc diff --git a/impeller/renderer/backend/gles/BUILD.gn b/impeller/renderer/backend/gles/BUILD.gn index f9db5b0313901..edace2b7aab40 100644 --- a/impeller/renderer/backend/gles/BUILD.gn +++ b/impeller/renderer/backend/gles/BUILD.gn @@ -20,6 +20,7 @@ impeller_component("gles_unittests") { "test/mock_gles.cc", "test/mock_gles.h", "test/mock_gles_unittests.cc", + "test/specialization_constants_unittests.cc", ] deps = [ ":gles", diff --git a/impeller/renderer/backend/gles/proc_table_gles.cc b/impeller/renderer/backend/gles/proc_table_gles.cc index 39b5768d87d64..50b6aac428f67 100644 --- a/impeller/renderer/backend/gles/proc_table_gles.cc +++ b/impeller/renderer/backend/gles/proc_table_gles.cc @@ -150,13 +150,29 @@ void ProcTableGLES::ShaderSourceMapping( ShaderSource(shader, 1u, sources, lengths); return; } + const auto& shader_source = ComputeShaderWithDefines(mapping, defines); + if (!shader_source.has_value()) { + VALIDATION_LOG << "Failed to append constant data to shader"; + return; + } + + const GLchar* sources[] = { + reinterpret_cast(shader_source->c_str())}; + const GLint lengths[] = {static_cast(shader_source->size())}; + ShaderSource(shader, 1u, sources, lengths); +} + +// Visible For testing. +std::optional ProcTableGLES::ComputeShaderWithDefines( + const fml::Mapping& mapping, + const std::vector& defines) const { auto shader_source = std::string{ reinterpret_cast(mapping.GetMapping()), mapping.GetSize()}; auto index = shader_source.find('\n'); if (index == std::string::npos) { VALIDATION_LOG << "Failed to append constant data to shader"; - return; + return std::nullopt; } std::stringstream ss; @@ -165,11 +181,7 @@ void ProcTableGLES::ShaderSourceMapping( } auto define_string = ss.str(); shader_source.insert(index + 1, define_string); - - const GLchar* sources[] = { - reinterpret_cast(shader_source.c_str())}; - const GLint lengths[] = {static_cast(shader_source.size())}; - ShaderSource(shader, 1u, sources, lengths); + return shader_source; } const DescriptionGLES* ProcTableGLES::GetDescription() const { diff --git a/impeller/renderer/backend/gles/proc_table_gles.h b/impeller/renderer/backend/gles/proc_table_gles.h index 3beddd138d88e..e8e301438f5e5 100644 --- a/impeller/renderer/backend/gles/proc_table_gles.h +++ b/impeller/renderer/backend/gles/proc_table_gles.h @@ -260,6 +260,11 @@ class ProcTableGLES { void PopDebugGroup() const; + // Visible For testing. + std::optional ComputeShaderWithDefines( + const fml::Mapping& mapping, + const std::vector& defines) const; + private: bool is_valid_ = false; std::unique_ptr description_; diff --git a/impeller/renderer/backend/gles/test/specialization_constants_unittests.cc b/impeller/renderer/backend/gles/test/specialization_constants_unittests.cc new file mode 100644 index 0000000000000..8285c137808a3 --- /dev/null +++ b/impeller/renderer/backend/gles/test/specialization_constants_unittests.cc @@ -0,0 +1,75 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/testing/testing.h" // IWYU pragma: keep +#include "fml/mapping.h" +#include "gtest/gtest.h" +#include "impeller/renderer/backend/gles/proc_table_gles.h" +#include "impeller/renderer/backend/gles/test/mock_gles.h" + +namespace impeller { +namespace testing { + +TEST(SpecConstant, CanCreateShaderWithSpecializationConstant) { + auto mock_gles = MockGLES::Init(); + auto& proc_table = mock_gles->GetProcTable(); + auto shader_source = + "#version 100\n" + "#ifndef SPIRV_CROSS_CONSTANT_ID_0\n" + "#define SPIRV_CROSS_CONSTANT_ID_0 1\n" + "#endif\n" + "void main() { return vec4(0.0); }"; + auto test_shader = std::make_shared(shader_source); + + auto result = proc_table.ComputeShaderWithDefines(*test_shader, {0}); + + auto expected_shader_source = + "#version 100\n" + "#define SPIRV_CROSS_CONSTANT_ID_0 0\n" + "#ifndef SPIRV_CROSS_CONSTANT_ID_0\n" + "#define SPIRV_CROSS_CONSTANT_ID_0 1\n" + "#endif\n" + "void main() { return vec4(0.0); }"; + + if (!result.has_value()) { + GTEST_FAIL() << "Expected shader source"; + } + ASSERT_EQ(result.value(), expected_shader_source); +} + +TEST(SpecConstant, CanCreateShaderWithSpecializationConstantMultipleValues) { + auto mock_gles = MockGLES::Init(); + auto& proc_table = mock_gles->GetProcTable(); + auto shader_source = + "#version 100\n" + "#ifndef SPIRV_CROSS_CONSTANT_ID_0\n" + "#define SPIRV_CROSS_CONSTANT_ID_0 1\n" + "#endif\n" + "void main() { return vec4(0.0); }"; + auto test_shader = std::make_shared(shader_source); + + auto result = + proc_table.ComputeShaderWithDefines(*test_shader, {0, 1, 2, 3, 4, 5}); + + auto expected_shader_source = + "#version 100\n" + "#define SPIRV_CROSS_CONSTANT_ID_0 0\n" + "#define SPIRV_CROSS_CONSTANT_ID_1 1\n" + "#define SPIRV_CROSS_CONSTANT_ID_2 2\n" + "#define SPIRV_CROSS_CONSTANT_ID_3 3\n" + "#define SPIRV_CROSS_CONSTANT_ID_4 4\n" + "#define SPIRV_CROSS_CONSTANT_ID_5 5\n" + "#ifndef SPIRV_CROSS_CONSTANT_ID_0\n" + "#define SPIRV_CROSS_CONSTANT_ID_0 1\n" + "#endif\n" + "void main() { return vec4(0.0); }"; + + if (!result.has_value()) { + GTEST_FAIL() << "Expected shader source"; + } + ASSERT_EQ(result.value(), expected_shader_source); +} + +} // namespace testing +} // namespace impeller From 43e2309d60fbb1c7a5914890f0218d740170e87b Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 30 Oct 2023 14:52:32 -0700 Subject: [PATCH 09/20] ++ --- impeller/entity/contents/content_context.cc | 4 ++-- impeller/entity/entity_unittests.cc | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/impeller/entity/contents/content_context.cc b/impeller/entity/contents/content_context.cc index 79a812a70133c..ec4725795eb31 100644 --- a/impeller/entity/contents/content_context.cc +++ b/impeller/entity/contents/content_context.cc @@ -335,8 +335,8 @@ ContentContext::ContentContext( yuv_to_rgb_filter_pipelines_.CreateDefault(*context_, options_trianglestrip); porter_duff_blend_pipelines_.CreateDefault(*context_, options_trianglestrip, {supports_decal}); - // GLES only shader. -#ifdef IMPELLER_ENABLE_OPENGLES + // GLES only shader that is unsupported on macOS. +#if defined(IMPELLER_ENABLE_OPENGLES) && !defined(FML_OS_MACOSX) if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) { texture_external_pipelines_.CreateDefault(*context_, options); } diff --git a/impeller/entity/entity_unittests.cc b/impeller/entity/entity_unittests.cc index 0eb86e8b9fc27..d93cf5b5a0d30 100644 --- a/impeller/entity/entity_unittests.cc +++ b/impeller/entity/entity_unittests.cc @@ -2535,6 +2535,26 @@ TEST_P(EntityTest, AdvancedBlendCoverageHintIsNotResetByEntityPass) { } } +TEST_P(EntityTest, SpecializationConstantsAreAppliedToVariants) { + auto content_context = + ContentContext(GetContext(), TypographerContextSkia::Make()); + + auto default_color_burn = content_context.GetBlendColorBurnPipeline( + {.has_stencil_attachment = false}); + auto alt_color_burn = content_context.GetBlendColorBurnPipeline( + {.has_stencil_attachment = true}); + + ASSERT_NE(default_color_burn, alt_color_burn); + ASSERT_EQ(default_color_burn->GetDescriptor().GetSpecializationConstants(), + alt_color_burn->GetDescriptor().GetSpecializationConstants()); + + auto decal_supported = static_cast( + GetContext()->GetCapabilities()->SupportsDecalSamplerAddressMode()); + std::vector expected_constants = {5, decal_supported}; + ASSERT_EQ(default_color_burn->GetDescriptor().GetSpecializationConstants(), + expected_constants); +} + } // namespace testing } // namespace impeller From a1ab22f5720a9ee42c4c0819f4a943f1ac704cf5 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 30 Oct 2023 15:52:46 -0700 Subject: [PATCH 10/20] update markdown doc. --- impeller/docs/specialization_constants.md | 51 +++++++++++++---------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/impeller/docs/specialization_constants.md b/impeller/docs/specialization_constants.md index a475c02415888..e4997531c2949 100644 --- a/impeller/docs/specialization_constants.md +++ b/impeller/docs/specialization_constants.md @@ -1,13 +1,15 @@ # Specialization Constants +A specialization constant is a named variable that contains a value that contains a known constant +value at runtime, but not when the shader is authored. These variables are bound to specific values when +the shader is compiled on application start up and allow the backend to perform optimizations such as branch elimination and constant folding. + Specialization constants have two possible benefits when used in a shader: * Improving performance, by removing branching and conditional code. * Code organization/size, by removing the number of shader source files required. -These goals are interrrelated, we can always reduce the number of shaders by creating -ubershaders. Or we can reduce branching by adding more shader variants. Specialization -constants provide a happy medium where the source files would be highly reptitive. +These goals are related: The number of shaders can be reduce by adding runtime branching to create more generic shaders. Alternatively, branching can be reduced by adding more specialized shader variants. Specialization constants provide a happy medium where the source files can be combined with branching but done so in a way that has no runtime cost. ## Example Usage @@ -19,11 +21,11 @@ result, the following code was used to conditionally decal: ```glsl // Decal sample if necessary. vec4 Sample(sampler2D sampler, vec2 coord) { - #ifdef GLES - return IPSampleDecal(sampler, coord) - #else - return texture(sampler, coord); - #endif +#ifdef GLES + return IPSampleDecal(sampler, coord) +#else + return texture(sampler, coord); +#endif } ``` @@ -36,14 +38,14 @@ uniform float supports_decal; // Decal sample if necessary. vec4 Sample(sampler2D sampler, vec2 coord) { - #ifdef GLES - if (supports_decal) { - return texture(sampler, coord); - } - return IPSampleDecal(sampler, coord) - #else - return texture(sampler, coord); - #endif +#ifdef GLES + if (supports_decal) { + return texture(sampler, coord); + } + return IPSampleDecal(sampler, coord) +#else + return texture(sampler, coord); +#endif } ``` @@ -61,10 +63,10 @@ shader. This constant will be `1` if decal is supported and `0` otherwise. layout(constant_id = 0) const int supports_decal = 1; vec4 Sample(sampler2D sampler, vec2 coord) { - if (supports_decal) { - return texture(sampler, coord); - } - return IPSampleDecal(sampler, coord) + if (supports_decal) { + return texture(sampler, coord); + } + return IPSampleDecal(sampler, coord) } ``` @@ -77,9 +79,12 @@ Immediately we realize a number of benefits: ## Implementation -Currently the only constant values that are support are 32bit ints. This should be sufficient for now as we -should generally only use these values for true/false or select-style constants. Please don't try to add -constant color values or anything like that. +Only 32bit ints are supported as const values and can be used to represent: + +* true/false via 0/1. +* function selection, such as advanced blends. The specialization value maps to a specific blend function. For example, 0 maps to screen and 1 to overlay via a giant if/else macro. + +*AVOID* adding specialization constants for color values or anything more complex. Specialization constants are provided to the CreateDefault argument in content_context.cc and aren't a part of variants. This is intentional: specialization constants shouldn't be used to create (potentially unlimited) runtime variants of a shader. From 2bea539557b2b6d5cc6514aad5e9bc986b618211 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 30 Oct 2023 15:54:44 -0700 Subject: [PATCH 11/20] ++ --- impeller/docs/specialization_constants.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/impeller/docs/specialization_constants.md b/impeller/docs/specialization_constants.md index e4997531c2949..1488bb2f35331 100644 --- a/impeller/docs/specialization_constants.md +++ b/impeller/docs/specialization_constants.md @@ -1,8 +1,6 @@ # Specialization Constants -A specialization constant is a named variable that contains a value that contains a known constant -value at runtime, but not when the shader is authored. These variables are bound to specific values when -the shader is compiled on application start up and allow the backend to perform optimizations such as branch elimination and constant folding. +A specialization constant is a named variable that is known to be constant at runtime but not when the shader is authored. These variables are bound to specific values when the shader is compiled on application start up and allow the backend to perform optimizations such as branch elimination and constant folding. Specialization constants have two possible benefits when used in a shader: From 153072a7e61a38054b2f7a50a443fd073d0689b9 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Tue, 31 Oct 2023 14:40:55 -0700 Subject: [PATCH 12/20] bdero review. --- impeller/entity/shaders/blending/blend_select.glsl | 2 +- impeller/renderer/backend/gles/proc_table_gles.cc | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/impeller/entity/shaders/blending/blend_select.glsl b/impeller/entity/shaders/blending/blend_select.glsl index 608093500f768..3040382f353a8 100644 --- a/impeller/entity/shaders/blending/blend_select.glsl +++ b/impeller/entity/shaders/blending/blend_select.glsl @@ -21,7 +21,7 @@ // kSaturation, // kColor, // kLuminosity, -// Note, this isn't a switch as GLSL 1.0 does not support them. +// Note, this isn't a switch as GLSL ES 1.0 does not support them. #define AdvancedBlend(blend_type) \ f16vec3 Blend(f16vec3 dst, f16vec3 src) { \ if (blend_type == 0) { \ diff --git a/impeller/renderer/backend/gles/proc_table_gles.cc b/impeller/renderer/backend/gles/proc_table_gles.cc index 50b6aac428f67..5101012455c44 100644 --- a/impeller/renderer/backend/gles/proc_table_gles.cc +++ b/impeller/renderer/backend/gles/proc_table_gles.cc @@ -169,6 +169,8 @@ std::optional ProcTableGLES::ComputeShaderWithDefines( auto shader_source = std::string{ reinterpret_cast(mapping.GetMapping()), mapping.GetSize()}; + // Look for the first newline after the '#version' header, which impellerc will + // always emit as the first line of a compiled shader. auto index = shader_source.find('\n'); if (index == std::string::npos) { VALIDATION_LOG << "Failed to append constant data to shader"; From 967dfff777d202785230eebefd8bc130068689ad Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Tue, 31 Oct 2023 14:42:20 -0700 Subject: [PATCH 13/20] ++ --- impeller/renderer/backend/gles/proc_table_gles.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/impeller/renderer/backend/gles/proc_table_gles.cc b/impeller/renderer/backend/gles/proc_table_gles.cc index 5101012455c44..afdb620163afa 100644 --- a/impeller/renderer/backend/gles/proc_table_gles.cc +++ b/impeller/renderer/backend/gles/proc_table_gles.cc @@ -169,8 +169,8 @@ std::optional ProcTableGLES::ComputeShaderWithDefines( auto shader_source = std::string{ reinterpret_cast(mapping.GetMapping()), mapping.GetSize()}; - // Look for the first newline after the '#version' header, which impellerc will - // always emit as the first line of a compiled shader. + // Look for the first newline after the '#version' header, which impellerc + // will always emit as the first line of a compiled shader. auto index = shader_source.find('\n'); if (index == std::string::npos) { VALIDATION_LOG << "Failed to append constant data to shader"; From 4aca52720448ca613d910d22870c8eae08e66246 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Fri, 3 Nov 2023 20:27:10 -0700 Subject: [PATCH 14/20] claw back performance. --- .../shaders/blending/advanced_blend.frag | 4 +- .../entity/shaders/blending/blend_select.glsl | 82 +++++++++++-------- .../shaders/blending/framebuffer_blend.frag | 4 +- .../backend/metal/pipeline_library_mtl.mm | 74 ++++++++--------- .../backend/metal/shader_function_mtl.h | 7 +- .../backend/metal/shader_function_mtl.mm | 19 ++--- 6 files changed, 99 insertions(+), 91 deletions(-) diff --git a/impeller/entity/shaders/blending/advanced_blend.frag b/impeller/entity/shaders/blending/advanced_blend.frag index 258ab66c392c6..199dbbeead6f2 100644 --- a/impeller/entity/shaders/blending/advanced_blend.frag +++ b/impeller/entity/shaders/blending/advanced_blend.frag @@ -35,8 +35,6 @@ f16vec4 Sample(f16sampler2D texture_sampler, vec2 texture_coords) { return IPHalfSampleDecal(texture_sampler, texture_coords); } -AdvancedBlend(blend_type); - void main() { f16vec4 dst_sample = Sample(texture_sampler_dst, // sampler v_dst_texture_coords // texture coordinates @@ -51,7 +49,7 @@ void main() { ) * blend_info.src_input_alpha; - f16vec3 blend_result = Blend(dst.rgb, src.rgb); + f16vec3 blend_result = AdvancedBlend(dst.rgb, src.rgb, blend_type); f16vec4 blended = mix(src, f16vec4(blend_result, dst.a), dst.a); frag_color = mix(dst_sample, blended, src.a); } diff --git a/impeller/entity/shaders/blending/blend_select.glsl b/impeller/entity/shaders/blending/blend_select.glsl index 3040382f353a8..17c45c16fdcf4 100644 --- a/impeller/entity/shaders/blending/blend_select.glsl +++ b/impeller/entity/shaders/blending/blend_select.glsl @@ -22,39 +22,51 @@ // kColor, // kLuminosity, // Note, this isn't a switch as GLSL ES 1.0 does not support them. -#define AdvancedBlend(blend_type) \ - f16vec3 Blend(f16vec3 dst, f16vec3 src) { \ - if (blend_type == 0) { \ - return IPBlendScreen(dst, src); \ - } else if (blend_type == 1) { \ - return IPBlendOverlay(dst, src); \ - } else if (blend_type == 2) { \ - return IPBlendDarken(dst, src); \ - } else if (blend_type == 3) { \ - return IPBlendLighten(dst, src); \ - } else if (blend_type == 4) { \ - return IPBlendColorDodge(dst, src); \ - } else if (blend_type == 5) { \ - return IPBlendColorBurn(dst, src); \ - } else if (blend_type == 6) { \ - return IPBlendHardLight(dst, src); \ - } else if (blend_type == 7) { \ - return IPBlendSoftLight(dst, src); \ - } else if (blend_type == 8) { \ - return IPBlendDifference(dst, src); \ - } else if (blend_type == 9) { \ - return IPBlendExclusion(dst, src); \ - } else if (blend_type == 10) { \ - return IPBlendMultiply(dst, src); \ - } else if (blend_type == 11) { \ - return IPBlendHue(dst, src); \ - } else if (blend_type == 12) { \ - return IPBlendSaturation(dst, src); \ - } else if (blend_type == 13) { \ - return IPBlendColor(dst, src); \ - } else if (blend_type == 14) { \ - return IPBlendLuminosity(dst, src); \ - } else { \ - return f16vec3(0.0hf); \ - } \ +f16vec3 AdvancedBlend(f16vec3 dst, f16vec3 src, int blend_type) { + if (blend_type == 0) { + return IPBlendScreen(dst, src); } + if (blend_type == 1) { + return IPBlendOverlay(dst, src); + } + if (blend_type == 2) { + return IPBlendDarken(dst, src); + } + if (blend_type == 3) { + return IPBlendLighten(dst, src); + } + if (blend_type == 4) { + return IPBlendColorDodge(dst, src); + } + if (blend_type == 5) { + return IPBlendColorBurn(dst, src); + } + if (blend_type == 6) { + return IPBlendHardLight(dst, src); + } + if (blend_type == 7) { + return IPBlendSoftLight(dst, src); + } + if (blend_type == 8) { + return IPBlendDifference(dst, src); + } + if (blend_type == 9) { + return IPBlendExclusion(dst, src); + } + if (blend_type == 10) { + return IPBlendMultiply(dst, src); + } + if (blend_type == 11) { + return IPBlendHue(dst, src); + } + if (blend_type == 12) { + return IPBlendSaturation(dst, src); + } + if (blend_type == 13) { + return IPBlendColor(dst, src); + } + if (blend_type == 14) { + return IPBlendLuminosity(dst, src); + } + return f16vec3(0.0hf); +} diff --git a/impeller/entity/shaders/blending/framebuffer_blend.frag b/impeller/entity/shaders/blending/framebuffer_blend.frag index 076a4d7b25cde..e01316924ec8a 100644 --- a/impeller/entity/shaders/blending/framebuffer_blend.frag +++ b/impeller/entity/shaders/blending/framebuffer_blend.frag @@ -39,8 +39,6 @@ vec4 Sample(sampler2D texture_sampler, vec2 texture_coords) { return IPSampleDecal(texture_sampler, texture_coords); } -AdvancedBlend(blend_type); - void main() { f16vec4 dst = f16vec4(ReadDestination()); f16vec4 src = f16vec4(Sample(texture_sampler_src, // sampler @@ -48,7 +46,7 @@ void main() { )) * frag_info.src_input_alpha; - f16vec3 blend_result = Blend(dst.rgb, src.rgb); + f16vec3 blend_result = AdvancedBlend(dst.rgb, src.rgb, blend_type); f16vec4 blended = mix(src, f16vec4(blend_result, dst.a), dst.a); frag_color = vec4(mix(dst, blended, src.a)); } diff --git a/impeller/renderer/backend/metal/pipeline_library_mtl.mm b/impeller/renderer/backend/metal/pipeline_library_mtl.mm index c7c180aa57c83..d37769b22dd99 100644 --- a/impeller/renderer/backend/metal/pipeline_library_mtl.mm +++ b/impeller/renderer/backend/metal/pipeline_library_mtl.mm @@ -23,33 +23,14 @@ PipelineLibraryMTL::~PipelineLibraryMTL() = default; -static MTLRenderPipelineDescriptor* GetMTLRenderPipelineDescriptor( - const PipelineDescriptor& desc) { +using Callback = std::function; + +static void GetMTLRenderPipelineDescriptor(const PipelineDescriptor& desc, + Callback callback) { auto descriptor = [[MTLRenderPipelineDescriptor alloc] init]; descriptor.label = @(desc.GetLabel().c_str()); descriptor.rasterSampleCount = static_cast(desc.GetSampleCount()); - - const auto& constants = desc.GetSpecializationConstants(); - for (const auto& entry : desc.GetStageEntrypoints()) { - if (entry.first == ShaderStage::kVertex) { - if (constants.empty()) { - descriptor.vertexFunction = - ShaderFunctionMTL::Cast(*entry.second).GetMTLFunction(); - } else { - descriptor.vertexFunction = ShaderFunctionMTL::Cast(*entry.second) - .GetMTLFunctionSpecialized(constants); - } - } - if (entry.first == ShaderStage::kFragment) { - if (constants.empty()) { - descriptor.fragmentFunction = - ShaderFunctionMTL::Cast(*entry.second).GetMTLFunction(); - } else { - descriptor.fragmentFunction = ShaderFunctionMTL::Cast(*entry.second) - .GetMTLFunctionSpecialized(constants); - } - } - } + bool async = false; if (const auto& vertex_descriptor = desc.GetVertexDescriptor()) { VertexDescriptorMTL vertex_descriptor_mtl; @@ -71,7 +52,31 @@ descriptor.stencilAttachmentPixelFormat = ToMTLPixelFormat(desc.GetStencilPixelFormat()); - return descriptor; + const auto& constants = desc.GetSpecializationConstants(); + for (const auto& entry : desc.GetStageEntrypoints()) { + if (entry.first == ShaderStage::kVertex) { + descriptor.vertexFunction = + ShaderFunctionMTL::Cast(*entry.second).GetMTLFunction(); + } + if (entry.first == ShaderStage::kFragment) { + if (constants.empty()) { + descriptor.fragmentFunction = + ShaderFunctionMTL::Cast(*entry.second).GetMTLFunction(); + } else { + async = true; + ShaderFunctionMTL::Cast(*entry.second) + .GetMTLFunctionSpecialized( + constants, [callback, descriptor](id function) { + descriptor.fragmentFunction = function; + callback(descriptor); + }); + } + } + } + + if (!async) { + callback(descriptor); + } } static MTLComputePipelineDescriptor* GetMTLComputePipelineDescriptor( @@ -145,19 +150,12 @@ )); promise->set_value(new_pipeline); }; - auto mtl_descriptor = GetMTLRenderPipelineDescriptor(descriptor); -#if FML_OS_IOS - [device_ newRenderPipelineStateWithDescriptor:mtl_descriptor - completionHandler:completion_handler]; -#else // FML_OS_IOS - // TODO(116919): Investigate and revert speculative fix to make MTL pipeline - // state creation use a worker. - NSError* error = nil; - auto render_pipeline_state = - [device_ newRenderPipelineStateWithDescriptor:mtl_descriptor - error:&error]; - completion_handler(render_pipeline_state, error); -#endif // FML_OS_IOS + GetMTLRenderPipelineDescriptor( + descriptor, [device = device_, completion_handler]( + MTLRenderPipelineDescriptor* descriptor) { + [device newRenderPipelineStateWithDescriptor:descriptor + completionHandler:completion_handler]; + }); return pipeline_future; } diff --git a/impeller/renderer/backend/metal/shader_function_mtl.h b/impeller/renderer/backend/metal/shader_function_mtl.h index 9ed1fff86c960..53cb1804466b3 100644 --- a/impeller/renderer/backend/metal/shader_function_mtl.h +++ b/impeller/renderer/backend/metal/shader_function_mtl.h @@ -21,8 +21,11 @@ class ShaderFunctionMTL final id GetMTLFunction() const; - id GetMTLFunctionSpecialized( - const std::vector& constants) const; + using CompileCallback = std::function)>; + + void GetMTLFunctionSpecialized( + const std::vector& constants, + CompileCallback callback) const; private: friend class ShaderLibraryMTL; diff --git a/impeller/renderer/backend/metal/shader_function_mtl.mm b/impeller/renderer/backend/metal/shader_function_mtl.mm index 589c0ff7f6eea..048dd9de815ae 100644 --- a/impeller/renderer/backend/metal/shader_function_mtl.mm +++ b/impeller/renderer/backend/metal/shader_function_mtl.mm @@ -17,8 +17,9 @@ ShaderFunctionMTL::~ShaderFunctionMTL() = default; -id ShaderFunctionMTL::GetMTLFunctionSpecialized( - const std::vector& constants) const { +void ShaderFunctionMTL::GetMTLFunctionSpecialized( + const std::vector& constants, + CompileCallback callback) const { MTLFunctionConstantValues* constantValues = [[MTLFunctionConstantValues alloc] init]; size_t index = 0; @@ -29,14 +30,12 @@ atIndex:index]; index++; } - NSError* error = nil; - auto result = [library_ newFunctionWithName:@(GetName().data()) - constantValues:constantValues - error:&error]; - if (error != nil) { - return nil; - } - return result; + [library_ newFunctionWithName:@(GetName().data()) + constantValues:constantValues + completionHandler:^(id _Nullable function, + NSError* _Nullable error){ + callback(function); + }]; } id ShaderFunctionMTL::GetMTLFunction() const { From 8f84e165d1c40fcdb4f3e4557026c04ec108aaa3 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Fri, 3 Nov 2023 20:27:32 -0700 Subject: [PATCH 15/20] ++ --- impeller/renderer/backend/metal/shader_function_mtl.h | 5 ++--- impeller/renderer/backend/metal/shader_function_mtl.mm | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/impeller/renderer/backend/metal/shader_function_mtl.h b/impeller/renderer/backend/metal/shader_function_mtl.h index 53cb1804466b3..885050b62644f 100644 --- a/impeller/renderer/backend/metal/shader_function_mtl.h +++ b/impeller/renderer/backend/metal/shader_function_mtl.h @@ -23,9 +23,8 @@ class ShaderFunctionMTL final using CompileCallback = std::function)>; - void GetMTLFunctionSpecialized( - const std::vector& constants, - CompileCallback callback) const; + void GetMTLFunctionSpecialized(const std::vector& constants, + CompileCallback callback) const; private: friend class ShaderLibraryMTL; diff --git a/impeller/renderer/backend/metal/shader_function_mtl.mm b/impeller/renderer/backend/metal/shader_function_mtl.mm index 048dd9de815ae..db401768b0def 100644 --- a/impeller/renderer/backend/metal/shader_function_mtl.mm +++ b/impeller/renderer/backend/metal/shader_function_mtl.mm @@ -33,9 +33,9 @@ [library_ newFunctionWithName:@(GetName().data()) constantValues:constantValues completionHandler:^(id _Nullable function, - NSError* _Nullable error){ - callback(function); - }]; + NSError* _Nullable error) { + callback(function); + }]; } id ShaderFunctionMTL::GetMTLFunction() const { From a336bc644c3a99eb5b2f7e05cdd4af575fbce6b4 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Sat, 4 Nov 2023 04:14:54 -0700 Subject: [PATCH 16/20] ++ --- .../renderer/backend/metal/pipeline_library_mtl.mm | 11 +++++++++-- impeller/renderer/backend/metal/shader_function_mtl.h | 2 +- .../renderer/backend/metal/shader_function_mtl.mm | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/impeller/renderer/backend/metal/pipeline_library_mtl.mm b/impeller/renderer/backend/metal/pipeline_library_mtl.mm index d37769b22dd99..54850ebffdb27 100644 --- a/impeller/renderer/backend/metal/pipeline_library_mtl.mm +++ b/impeller/renderer/backend/metal/pipeline_library_mtl.mm @@ -9,6 +9,7 @@ #include "flutter/fml/build_config.h" #include "flutter/fml/container.h" +#include "fml/synchronization/count_down_latch.h" #include "impeller/base/promise.h" #include "impeller/renderer/backend/metal/compute_pipeline_mtl.h" #include "impeller/renderer/backend/metal/formats_mtl.h" @@ -26,7 +27,7 @@ using Callback = std::function; static void GetMTLRenderPipelineDescriptor(const PipelineDescriptor& desc, - Callback callback) { + const Callback& callback) { auto descriptor = [[MTLRenderPipelineDescriptor alloc] init]; descriptor.label = @(desc.GetLabel().c_str()); descriptor.rasterSampleCount = static_cast(desc.GetSampleCount()); @@ -52,6 +53,9 @@ static void GetMTLRenderPipelineDescriptor(const PipelineDescriptor& desc, descriptor.stencilAttachmentPixelFormat = ToMTLPixelFormat(desc.GetStencilPixelFormat()); + // This latch is used to ensure that GetMTLFunctionSpecialized does not finish + // before the descriptor is completely set up. + fml::CountDownLatch latch(1u); const auto& constants = desc.GetSpecializationConstants(); for (const auto& entry : desc.GetStageEntrypoints()) { if (entry.first == ShaderStage::kVertex) { @@ -66,14 +70,17 @@ static void GetMTLRenderPipelineDescriptor(const PipelineDescriptor& desc, async = true; ShaderFunctionMTL::Cast(*entry.second) .GetMTLFunctionSpecialized( - constants, [callback, descriptor](id function) { + constants, + [callback, descriptor, &latch](id function) { descriptor.fragmentFunction = function; + latch.Wait(); callback(descriptor); }); } } } + latch.CountDown(); if (!async) { callback(descriptor); } diff --git a/impeller/renderer/backend/metal/shader_function_mtl.h b/impeller/renderer/backend/metal/shader_function_mtl.h index 885050b62644f..20bf6d05bf988 100644 --- a/impeller/renderer/backend/metal/shader_function_mtl.h +++ b/impeller/renderer/backend/metal/shader_function_mtl.h @@ -24,7 +24,7 @@ class ShaderFunctionMTL final using CompileCallback = std::function)>; void GetMTLFunctionSpecialized(const std::vector& constants, - CompileCallback callback) const; + const CompileCallback& callback) const; private: friend class ShaderLibraryMTL; diff --git a/impeller/renderer/backend/metal/shader_function_mtl.mm b/impeller/renderer/backend/metal/shader_function_mtl.mm index db401768b0def..7517f226f73e2 100644 --- a/impeller/renderer/backend/metal/shader_function_mtl.mm +++ b/impeller/renderer/backend/metal/shader_function_mtl.mm @@ -19,7 +19,7 @@ void ShaderFunctionMTL::GetMTLFunctionSpecialized( const std::vector& constants, - CompileCallback callback) const { + const CompileCallback& callback) const { MTLFunctionConstantValues* constantValues = [[MTLFunctionConstantValues alloc] init]; size_t index = 0; From 94f65486b6493b162f5d0fb484357a1b4759ad1e Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Sat, 4 Nov 2023 07:50:31 -0700 Subject: [PATCH 17/20] fixup. --- impeller/docs/specialization_constants.md | 1 + .../backend/metal/pipeline_library_mtl.mm | 15 ++++++++------- .../renderer/backend/metal/shader_function_mtl.mm | 3 ++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/impeller/docs/specialization_constants.md b/impeller/docs/specialization_constants.md index 1488bb2f35331..ca20f7eacef3d 100644 --- a/impeller/docs/specialization_constants.md +++ b/impeller/docs/specialization_constants.md @@ -81,6 +81,7 @@ Only 32bit ints are supported as const values and can be used to represent: * true/false via 0/1. * function selection, such as advanced blends. The specialization value maps to a specific blend function. For example, 0 maps to screen and 1 to overlay via a giant if/else macro. +* Only fragment shaders can be specialized. This limitation could be removed with more investment. *AVOID* adding specialization constants for color values or anything more complex. diff --git a/impeller/renderer/backend/metal/pipeline_library_mtl.mm b/impeller/renderer/backend/metal/pipeline_library_mtl.mm index 54850ebffdb27..4e6c56668e464 100644 --- a/impeller/renderer/backend/metal/pipeline_library_mtl.mm +++ b/impeller/renderer/backend/metal/pipeline_library_mtl.mm @@ -31,7 +31,7 @@ static void GetMTLRenderPipelineDescriptor(const PipelineDescriptor& desc, auto descriptor = [[MTLRenderPipelineDescriptor alloc] init]; descriptor.label = @(desc.GetLabel().c_str()); descriptor.rasterSampleCount = static_cast(desc.GetSampleCount()); - bool async = false; + bool created_specialized_function = false; if (const auto& vertex_descriptor = desc.GetVertexDescriptor()) { VertexDescriptorMTL vertex_descriptor_mtl; @@ -55,7 +55,7 @@ static void GetMTLRenderPipelineDescriptor(const PipelineDescriptor& desc, // This latch is used to ensure that GetMTLFunctionSpecialized does not finish // before the descriptor is completely set up. - fml::CountDownLatch latch(1u); + auto latch = std::make_shared(1u); const auto& constants = desc.GetSpecializationConstants(); for (const auto& entry : desc.GetStageEntrypoints()) { if (entry.first == ShaderStage::kVertex) { @@ -67,21 +67,22 @@ static void GetMTLRenderPipelineDescriptor(const PipelineDescriptor& desc, descriptor.fragmentFunction = ShaderFunctionMTL::Cast(*entry.second).GetMTLFunction(); } else { - async = true; + // This code only expects a single specialized function per pipeline. + FML_CHECK(!created_specialized_function); + created_specialized_function = true; ShaderFunctionMTL::Cast(*entry.second) .GetMTLFunctionSpecialized( constants, - [callback, descriptor, &latch](id function) { + [callback, descriptor, latch](id function) { descriptor.fragmentFunction = function; - latch.Wait(); callback(descriptor); }); } } } - latch.CountDown(); - if (!async) { + latch->CountDown(); + if (!created_specialized_function) { callback(descriptor); } } diff --git a/impeller/renderer/backend/metal/shader_function_mtl.mm b/impeller/renderer/backend/metal/shader_function_mtl.mm index 7517f226f73e2..b33db5338179a 100644 --- a/impeller/renderer/backend/metal/shader_function_mtl.mm +++ b/impeller/renderer/backend/metal/shader_function_mtl.mm @@ -30,11 +30,12 @@ atIndex:index]; index++; } + CompileCallback callback_value = callback; [library_ newFunctionWithName:@(GetName().data()) constantValues:constantValues completionHandler:^(id _Nullable function, NSError* _Nullable error) { - callback(function); + callback_value(function); }]; } From b500bc4158ecfcffb6acfe3212fce6cef9d594b3 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 7 Nov 2023 07:22:35 -0800 Subject: [PATCH 18/20] Update pipeline_library_mtl.mm --- impeller/renderer/backend/metal/pipeline_library_mtl.mm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/impeller/renderer/backend/metal/pipeline_library_mtl.mm b/impeller/renderer/backend/metal/pipeline_library_mtl.mm index 4e6c56668e464..dafae3328f69c 100644 --- a/impeller/renderer/backend/metal/pipeline_library_mtl.mm +++ b/impeller/renderer/backend/metal/pipeline_library_mtl.mm @@ -53,9 +53,6 @@ static void GetMTLRenderPipelineDescriptor(const PipelineDescriptor& desc, descriptor.stencilAttachmentPixelFormat = ToMTLPixelFormat(desc.GetStencilPixelFormat()); - // This latch is used to ensure that GetMTLFunctionSpecialized does not finish - // before the descriptor is completely set up. - auto latch = std::make_shared(1u); const auto& constants = desc.GetSpecializationConstants(); for (const auto& entry : desc.GetStageEntrypoints()) { if (entry.first == ShaderStage::kVertex) { @@ -81,7 +78,6 @@ static void GetMTLRenderPipelineDescriptor(const PipelineDescriptor& desc, } } - latch->CountDown(); if (!created_specialized_function) { callback(descriptor); } From af74dae73947137d7831c855ba8063448b496779 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 7 Nov 2023 08:27:07 -0800 Subject: [PATCH 19/20] Update pipeline_library_mtl.mm --- impeller/renderer/backend/metal/pipeline_library_mtl.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/impeller/renderer/backend/metal/pipeline_library_mtl.mm b/impeller/renderer/backend/metal/pipeline_library_mtl.mm index dafae3328f69c..7d7bda05647e3 100644 --- a/impeller/renderer/backend/metal/pipeline_library_mtl.mm +++ b/impeller/renderer/backend/metal/pipeline_library_mtl.mm @@ -9,7 +9,6 @@ #include "flutter/fml/build_config.h" #include "flutter/fml/container.h" -#include "fml/synchronization/count_down_latch.h" #include "impeller/base/promise.h" #include "impeller/renderer/backend/metal/compute_pipeline_mtl.h" #include "impeller/renderer/backend/metal/formats_mtl.h" @@ -70,7 +69,7 @@ static void GetMTLRenderPipelineDescriptor(const PipelineDescriptor& desc, ShaderFunctionMTL::Cast(*entry.second) .GetMTLFunctionSpecialized( constants, - [callback, descriptor, latch](id function) { + [callback, descriptor](id function) { descriptor.fragmentFunction = function; callback(descriptor); }); From ef7761bdfa759f7d0bbc7a529fcf4f99f414a88a Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 7 Nov 2023 09:00:50 -0800 Subject: [PATCH 20/20] Update pipeline_library_mtl.mm --- impeller/renderer/backend/metal/pipeline_library_mtl.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/impeller/renderer/backend/metal/pipeline_library_mtl.mm b/impeller/renderer/backend/metal/pipeline_library_mtl.mm index 7d7bda05647e3..177c54aa6a8d2 100644 --- a/impeller/renderer/backend/metal/pipeline_library_mtl.mm +++ b/impeller/renderer/backend/metal/pipeline_library_mtl.mm @@ -68,8 +68,7 @@ static void GetMTLRenderPipelineDescriptor(const PipelineDescriptor& desc, created_specialized_function = true; ShaderFunctionMTL::Cast(*entry.second) .GetMTLFunctionSpecialized( - constants, - [callback, descriptor](id function) { + constants, [callback, descriptor](id function) { descriptor.fragmentFunction = function; callback(descriptor); });