From d083a5796a4a9b225415e70e604f9c8d13824f98 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 22 Apr 2024 21:24:24 -0700 Subject: [PATCH 1/7] [Impeller] drawVertices uber shader. --- impeller/aiks/aiks_unittests.cc | 32 ++++++ impeller/entity/BUILD.gn | 2 + impeller/entity/contents/content_context.cc | 1 + impeller/entity/contents/content_context.h | 13 +++ impeller/entity/contents/vertices_contents.cc | 104 +++++++++++------- impeller/entity/geometry/vertices_geometry.cc | 3 +- .../shaders/blending/vertices_uber.frag | 33 ++++++ .../shaders/blending/vertices_uber.vert | 25 +++++ 8 files changed, 175 insertions(+), 38 deletions(-) create mode 100644 impeller/entity/shaders/blending/vertices_uber.frag create mode 100644 impeller/entity/shaders/blending/vertices_uber.vert diff --git a/impeller/aiks/aiks_unittests.cc b/impeller/aiks/aiks_unittests.cc index abd0eeb72ae33..e1b860465775d 100644 --- a/impeller/aiks/aiks_unittests.cc +++ b/impeller/aiks/aiks_unittests.cc @@ -2773,6 +2773,38 @@ TEST_P(AiksTest, VerticesGeometryColorUVPositionData) { ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); } +TEST_P(AiksTest, VerticesGeometryColorUVPositionDataAdvancedBlend) { + Canvas canvas; + Paint paint; + auto texture = CreateTextureForFixture("table_mountain_nx.png"); + + paint.color_source = + ColorSource::MakeImage(texture, Entity::TileMode::kClamp, + Entity::TileMode::kClamp, {}, Matrix()); + + auto vertices = { + Point(0, 0), + Point(texture->GetSize().width, 0), + Point(0, texture->GetSize().height), + Point(texture->GetSize().width, 0), + Point(0, 0), + Point(texture->GetSize().width, texture->GetSize().height), + }; + std::vector indices = {}; + std::vector texture_coordinates = {}; + std::vector vertex_colors = { + Color::Red().WithAlpha(0.5), Color::Blue().WithAlpha(0.5), + Color::Green().WithAlpha(0.5), Color::Red().WithAlpha(0.5), + Color::Blue().WithAlpha(0.5), Color::Green().WithAlpha(0.5), + }; + auto geometry = std::make_shared( + vertices, indices, texture_coordinates, vertex_colors, + Rect::MakeLTRB(0, 0, 1, 1), VerticesGeometry::VertexMode::kTriangles); + + canvas.DrawVertices(geometry, BlendMode::kColorBurn, paint); + ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); +} + TEST_P(AiksTest, MatrixImageFilterMagnify) { Canvas canvas; canvas.Scale(GetContentScale()); diff --git a/impeller/entity/BUILD.gn b/impeller/entity/BUILD.gn index 42d0a32a3f244..61ca78ca7eca6 100644 --- a/impeller/entity/BUILD.gn +++ b/impeller/entity/BUILD.gn @@ -52,6 +52,8 @@ impeller_shaders("entity_shaders") { "shaders/filters/linear_to_srgb_filter.frag", "shaders/filters/morphology_filter.frag", "shaders/filters/morphology_filter.vert", + "shaders/blending/vertices_uber.frag", + "shaders/blending/vertices_uber.vert", ] if (impeller_debug) { diff --git a/impeller/entity/contents/content_context.cc b/impeller/entity/contents/content_context.cc index bd3e05c135f6a..31d4f45ca78fa 100644 --- a/impeller/entity/contents/content_context.cc +++ b/impeller/entity/contents/content_context.cc @@ -445,6 +445,7 @@ ContentContext::ContentContext( yuv_to_rgb_filter_pipelines_.CreateDefault(*context_, options_trianglestrip); porter_duff_blend_pipelines_.CreateDefault(*context_, options_trianglestrip, {supports_decal}); + vertices_uber_shader_.CreateDefault(*context_, options); // GLES only shader that is unsupported on macOS. #if defined(IMPELLER_ENABLE_OPENGLES) && !defined(FML_OS_MACOSX) if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) { diff --git a/impeller/entity/contents/content_context.h b/impeller/entity/contents/content_context.h index 361cd6650dc2e..7c877b34ba9e8 100644 --- a/impeller/entity/contents/content_context.h +++ b/impeller/entity/contents/content_context.h @@ -81,6 +81,9 @@ #include "impeller/entity/framebuffer_blend.frag.h" #include "impeller/entity/framebuffer_blend.vert.h" +#include "impeller/entity/vertices_uber.frag.h" +#include "impeller/entity/vertices_uber.vert.h" + #ifdef IMPELLER_ENABLE_OPENGLES #include "impeller/entity/tiled_texture_fill_external.frag.h" #endif // IMPELLER_ENABLE_OPENGLES @@ -251,6 +254,10 @@ using FramebufferBlendSoftLightPipeline = RenderPipelineHandle; +/// Draw Vertices/Atlas Uber Shader +using VerticesUberShader = + RenderPipelineHandle; + /// Geometry Pipelines using PointsComputeShaderPipeline = ComputePipelineBuilder; using UvComputeShaderPipeline = ComputePipelineBuilder; @@ -721,6 +728,11 @@ class ContentContext { return GetPipeline(framebuffer_blend_softlight_pipelines_, opts); } + std::shared_ptr> GetDrawVerticesUberShader( + ContentContextOptions opts) const { + return GetPipeline(vertices_uber_shader_, opts); + } + std::shared_ptr> GetPointComputePipeline() const { FML_DCHECK(GetDeviceCapabilities().SupportsCompute()); @@ -995,6 +1007,7 @@ class ContentContext { framebuffer_blend_screen_pipelines_; mutable Variants framebuffer_blend_softlight_pipelines_; + mutable Variants vertices_uber_shader_; mutable std::shared_ptr> point_field_compute_pipelines_; mutable std::shared_ptr> diff --git a/impeller/entity/contents/vertices_contents.cc b/impeller/entity/contents/vertices_contents.cc index 9aeaa83023b83..ab77539b3a169 100644 --- a/impeller/entity/contents/vertices_contents.cc +++ b/impeller/entity/contents/vertices_contents.cc @@ -275,11 +275,22 @@ bool VerticesSimpleBlendContents::Render(const ContentContext& renderer, const Entity& entity, RenderPass& pass) const { FML_DCHECK(texture_); - FML_DCHECK(geometry_->HasVertexColors()); + BlendMode blend_mode = blend_mode_; + if (!geometry_->HasVertexColors()) { + blend_mode = BlendMode::kSource; + } - // Simple Porter-Duff blends can be accomplished without a sub renderpass. - using VS = PorterDuffBlendPipeline::VertexShader; - using FS = PorterDuffBlendPipeline::FragmentShader; + auto dst_sampler_descriptor = descriptor_; + dst_sampler_descriptor.width_address_mode = + TileModeToAddressMode(tile_mode_x_, renderer.GetDeviceCapabilities()) + .value_or(SamplerAddressMode::kClampToEdge); + dst_sampler_descriptor.height_address_mode = + TileModeToAddressMode(tile_mode_y_, renderer.GetDeviceCapabilities()) + .value_or(SamplerAddressMode::kClampToEdge); + + const std::unique_ptr& dst_sampler = + renderer.GetContext()->GetSamplerLibrary()->GetSampler( + dst_sampler_descriptor); GeometryResult geometry_result = geometry_->GetPositionUVColorBuffer( Rect::MakeSize(texture_->GetSize()), inverse_matrix_, renderer, entity, @@ -289,53 +300,72 @@ bool VerticesSimpleBlendContents::Render(const ContentContext& renderer, } FML_DCHECK(geometry_result.mode == GeometryResult::Mode::kNormal); + if (blend_mode <= Entity::kLastPipelineBlendMode) { + using VS = PorterDuffBlendPipeline::VertexShader; + using FS = PorterDuffBlendPipeline::FragmentShader; + +#ifdef IMPELLER_DEBUG + pass.SetCommandLabel(SPrintF("DrawVertices Porterduff Blend (%s)", + BlendModeToString(blend_mode))); +#endif // IMPELLER_DEBUG + pass.SetVertexBuffer(std::move(geometry_result.vertex_buffer)); + + auto options = OptionsFromPassAndEntity(pass, entity); + options.primitive_type = geometry_result.type; + pass.SetPipeline(renderer.GetPorterDuffBlendPipeline(options)); + + FS::BindTextureSamplerDst(pass, texture_, dst_sampler); + + FS::FragInfo frag_info; + VS::FrameInfo frame_info; + + frame_info.texture_sampler_y_coord_scale = texture_->GetYCoordScale(); + frame_info.mvp = geometry_result.transform; + + frag_info.output_alpha = alpha_; + frag_info.input_alpha = 1.0; + + auto inverted_blend_mode = + InvertPorterDuffBlend(blend_mode).value_or(BlendMode::kSource); + auto blend_coefficients = + kPorterDuffCoefficients[static_cast(inverted_blend_mode)]; + frag_info.src_coeff = blend_coefficients[0]; + frag_info.src_coeff_dst_alpha = blend_coefficients[1]; + frag_info.dst_coeff = blend_coefficients[2]; + frag_info.dst_coeff_src_alpha = blend_coefficients[3]; + frag_info.dst_coeff_src_color = blend_coefficients[4]; + + auto& host_buffer = renderer.GetTransientsBuffer(); + FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info)); + VS::BindFrameInfo(pass, host_buffer.EmplaceUniform(frame_info)); + + return pass.Draw().ok(); + } + + using VS = VerticesUberShader::VertexShader; + using FS = VerticesUberShader::FragmentShader; + #ifdef IMPELLER_DEBUG - pass.SetCommandLabel(SPrintF("DrawVertices Porterduff Blend (%s)", - BlendModeToString(blend_mode_))); + pass.SetCommandLabel(SPrintF("DrawVertices Advanced Blend (%s)", + BlendModeToString(blend_mode))); #endif // IMPELLER_DEBUG pass.SetVertexBuffer(std::move(geometry_result.vertex_buffer)); auto options = OptionsFromPassAndEntity(pass, entity); options.primitive_type = geometry_result.type; - pass.SetPipeline(renderer.GetPorterDuffBlendPipeline(options)); - - auto dst_sampler_descriptor = descriptor_; - dst_sampler_descriptor.width_address_mode = - TileModeToAddressMode(tile_mode_x_, renderer.GetDeviceCapabilities()) - .value_or(SamplerAddressMode::kClampToEdge); - dst_sampler_descriptor.height_address_mode = - TileModeToAddressMode(tile_mode_y_, renderer.GetDeviceCapabilities()) - .value_or(SamplerAddressMode::kClampToEdge); - - const std::unique_ptr& dst_sampler = - renderer.GetContext()->GetSamplerLibrary()->GetSampler( - dst_sampler_descriptor); - FS::BindTextureSamplerDst(pass, texture_, dst_sampler); + pass.SetPipeline(renderer.GetDrawVerticesUberShader(options)); + FS::BindTextureSampler(pass, texture_, dst_sampler); FS::FragInfo frag_info; VS::FrameInfo frame_info; frame_info.texture_sampler_y_coord_scale = texture_->GetYCoordScale(); - frag_info.output_alpha = alpha_; - frag_info.input_alpha = 1.0; - - auto inverted_blend_mode = - InvertPorterDuffBlend(blend_mode_).value_or(BlendMode::kSource); - auto blend_coefficients = - kPorterDuffCoefficients[static_cast(inverted_blend_mode)]; - frag_info.src_coeff = blend_coefficients[0]; - frag_info.src_coeff_dst_alpha = blend_coefficients[1]; - frag_info.dst_coeff = blend_coefficients[2]; - frag_info.dst_coeff_src_alpha = blend_coefficients[3]; - frag_info.dst_coeff_src_color = blend_coefficients[4]; + frame_info.mvp = geometry_result.transform; + frag_info.alpha = alpha_; auto& host_buffer = renderer.GetTransientsBuffer(); FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info)); - - frame_info.mvp = geometry_result.transform; - - auto uniform_view = host_buffer.EmplaceUniform(frame_info); - VS::BindFrameInfo(pass, uniform_view); + VS::BindFrameInfo(pass, host_buffer.EmplaceUniform(frame_info)); return pass.Draw().ok(); } diff --git a/impeller/entity/geometry/vertices_geometry.cc b/impeller/entity/geometry/vertices_geometry.cc index a352a212c59d5..83b27e9e7ba24 100644 --- a/impeller/entity/geometry/vertices_geometry.cc +++ b/impeller/entity/geometry/vertices_geometry.cc @@ -256,6 +256,7 @@ GeometryResult VerticesGeometry::GetPositionUVColorBuffer( auto uv_transform = texture_coverage.GetNormalizingTransform() * effect_transform; auto has_texture_coordinates = HasTextureCoordinates(); + auto has_colors = HasVertexColors(); size_t total_vtx_bytes = vertices_.size() * sizeof(VS::PerVertexData); auto vertex_buffer = renderer.GetTransientsBuffer().Emplace( @@ -274,7 +275,7 @@ GeometryResult VerticesGeometry::GetPositionUVColorBuffer( .texture_coords = Point(std::clamp(uv.x, 0.0f, 1.0f - kEhCloseEnough), std::clamp(uv.y, 0.0f, 1.0f - kEhCloseEnough)), - .color = colors_[i], + .color = has_colors ? colors_[i] : Color::BlackTransparent(), }; std::memcpy(vtx_contents++, &vertex_data, sizeof(VS::PerVertexData)); } diff --git a/impeller/entity/shaders/blending/vertices_uber.frag b/impeller/entity/shaders/blending/vertices_uber.frag new file mode 100644 index 0000000000000..472c3da377aa3 --- /dev/null +++ b/impeller/entity/shaders/blending/vertices_uber.frag @@ -0,0 +1,33 @@ +// 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 "blend_select.glsl" + +uniform FragInfo { + float16_t alpha; + float16_t blend_mode; +} +frag_info; + +uniform f16sampler2D texture_sampler; + +in highp vec2 v_texture_coords; +in mediump f16vec4 v_color; + +out f16vec4 frag_color; + +// A shader that implements the required src/dst blending for drawVertices and +// drawAtlas advanced blends without requiring an offscreen render pass. This is +// done in a single shader to reduce the permutations of PSO needed at runtime +// for rarely used features. +void main() { + f16vec4 dst = IPHalfUnpremultiply(v_color); + f16vec4 src = IPHalfUnpremultiply(texture(texture_sampler, v_texture_coords)); + f16vec3 blend_result = + AdvancedBlend(dst.rgb, src.rgb, int(frag_info.blend_mode - 14.0)); + frag_color = IPApplyBlendedColor(dst, src, blend_result); + frag_color *= frag_info.alpha; +} diff --git a/impeller/entity/shaders/blending/vertices_uber.vert b/impeller/entity/shaders/blending/vertices_uber.vert new file mode 100644 index 0000000000000..a15472a925714 --- /dev/null +++ b/impeller/entity/shaders/blending/vertices_uber.vert @@ -0,0 +1,25 @@ +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include +#include + +uniform FrameInfo { + mat4 mvp; + float texture_sampler_y_coord_scale; +} +frame_info; + +in vec2 vertices; +in vec2 texture_coords; +in vec4 color; + +out vec2 v_texture_coords; +out mediump f16vec4 v_color; + +void main() { + gl_Position = frame_info.mvp * vec4(vertices, 0.0, 1.0); + v_color = f16vec4(color); + v_texture_coords = + IPRemapCoords(texture_coords, frame_info.texture_sampler_y_coord_scale); +} From 9ed61ae9ccb4f34b401e9a13ba52e829c89f71d8 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 22 Apr 2024 21:24:24 -0700 Subject: [PATCH 2/7] [Impeller] drawVertices uber shader. --- impeller/aiks/aiks_unittests.cc | 32 +++++ impeller/entity/BUILD.gn | 2 + impeller/entity/contents/content_context.cc | 1 + impeller/entity/contents/content_context.h | 13 +++ impeller/entity/contents/vertices_contents.cc | 109 ++++++++++++------ impeller/entity/geometry/vertices_geometry.cc | 3 +- .../shaders/blending/porter_duff_blend.frag | 14 ++- .../shaders/blending/vertices_uber.frag | 33 ++++++ .../shaders/blending/vertices_uber.vert | 25 ++++ 9 files changed, 189 insertions(+), 43 deletions(-) create mode 100644 impeller/entity/shaders/blending/vertices_uber.frag create mode 100644 impeller/entity/shaders/blending/vertices_uber.vert diff --git a/impeller/aiks/aiks_unittests.cc b/impeller/aiks/aiks_unittests.cc index abd0eeb72ae33..e1b860465775d 100644 --- a/impeller/aiks/aiks_unittests.cc +++ b/impeller/aiks/aiks_unittests.cc @@ -2773,6 +2773,38 @@ TEST_P(AiksTest, VerticesGeometryColorUVPositionData) { ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); } +TEST_P(AiksTest, VerticesGeometryColorUVPositionDataAdvancedBlend) { + Canvas canvas; + Paint paint; + auto texture = CreateTextureForFixture("table_mountain_nx.png"); + + paint.color_source = + ColorSource::MakeImage(texture, Entity::TileMode::kClamp, + Entity::TileMode::kClamp, {}, Matrix()); + + auto vertices = { + Point(0, 0), + Point(texture->GetSize().width, 0), + Point(0, texture->GetSize().height), + Point(texture->GetSize().width, 0), + Point(0, 0), + Point(texture->GetSize().width, texture->GetSize().height), + }; + std::vector indices = {}; + std::vector texture_coordinates = {}; + std::vector vertex_colors = { + Color::Red().WithAlpha(0.5), Color::Blue().WithAlpha(0.5), + Color::Green().WithAlpha(0.5), Color::Red().WithAlpha(0.5), + Color::Blue().WithAlpha(0.5), Color::Green().WithAlpha(0.5), + }; + auto geometry = std::make_shared( + vertices, indices, texture_coordinates, vertex_colors, + Rect::MakeLTRB(0, 0, 1, 1), VerticesGeometry::VertexMode::kTriangles); + + canvas.DrawVertices(geometry, BlendMode::kColorBurn, paint); + ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); +} + TEST_P(AiksTest, MatrixImageFilterMagnify) { Canvas canvas; canvas.Scale(GetContentScale()); diff --git a/impeller/entity/BUILD.gn b/impeller/entity/BUILD.gn index 42d0a32a3f244..61ca78ca7eca6 100644 --- a/impeller/entity/BUILD.gn +++ b/impeller/entity/BUILD.gn @@ -52,6 +52,8 @@ impeller_shaders("entity_shaders") { "shaders/filters/linear_to_srgb_filter.frag", "shaders/filters/morphology_filter.frag", "shaders/filters/morphology_filter.vert", + "shaders/blending/vertices_uber.frag", + "shaders/blending/vertices_uber.vert", ] if (impeller_debug) { diff --git a/impeller/entity/contents/content_context.cc b/impeller/entity/contents/content_context.cc index bd3e05c135f6a..31d4f45ca78fa 100644 --- a/impeller/entity/contents/content_context.cc +++ b/impeller/entity/contents/content_context.cc @@ -445,6 +445,7 @@ ContentContext::ContentContext( yuv_to_rgb_filter_pipelines_.CreateDefault(*context_, options_trianglestrip); porter_duff_blend_pipelines_.CreateDefault(*context_, options_trianglestrip, {supports_decal}); + vertices_uber_shader_.CreateDefault(*context_, options); // GLES only shader that is unsupported on macOS. #if defined(IMPELLER_ENABLE_OPENGLES) && !defined(FML_OS_MACOSX) if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) { diff --git a/impeller/entity/contents/content_context.h b/impeller/entity/contents/content_context.h index 361cd6650dc2e..7c877b34ba9e8 100644 --- a/impeller/entity/contents/content_context.h +++ b/impeller/entity/contents/content_context.h @@ -81,6 +81,9 @@ #include "impeller/entity/framebuffer_blend.frag.h" #include "impeller/entity/framebuffer_blend.vert.h" +#include "impeller/entity/vertices_uber.frag.h" +#include "impeller/entity/vertices_uber.vert.h" + #ifdef IMPELLER_ENABLE_OPENGLES #include "impeller/entity/tiled_texture_fill_external.frag.h" #endif // IMPELLER_ENABLE_OPENGLES @@ -251,6 +254,10 @@ using FramebufferBlendSoftLightPipeline = RenderPipelineHandle; +/// Draw Vertices/Atlas Uber Shader +using VerticesUberShader = + RenderPipelineHandle; + /// Geometry Pipelines using PointsComputeShaderPipeline = ComputePipelineBuilder; using UvComputeShaderPipeline = ComputePipelineBuilder; @@ -721,6 +728,11 @@ class ContentContext { return GetPipeline(framebuffer_blend_softlight_pipelines_, opts); } + std::shared_ptr> GetDrawVerticesUberShader( + ContentContextOptions opts) const { + return GetPipeline(vertices_uber_shader_, opts); + } + std::shared_ptr> GetPointComputePipeline() const { FML_DCHECK(GetDeviceCapabilities().SupportsCompute()); @@ -995,6 +1007,7 @@ class ContentContext { framebuffer_blend_screen_pipelines_; mutable Variants framebuffer_blend_softlight_pipelines_; + mutable Variants vertices_uber_shader_; mutable std::shared_ptr> point_field_compute_pipelines_; mutable std::shared_ptr> diff --git a/impeller/entity/contents/vertices_contents.cc b/impeller/entity/contents/vertices_contents.cc index 9aeaa83023b83..be4f1892e5f1e 100644 --- a/impeller/entity/contents/vertices_contents.cc +++ b/impeller/entity/contents/vertices_contents.cc @@ -275,11 +275,22 @@ bool VerticesSimpleBlendContents::Render(const ContentContext& renderer, const Entity& entity, RenderPass& pass) const { FML_DCHECK(texture_); - FML_DCHECK(geometry_->HasVertexColors()); + BlendMode blend_mode = blend_mode_; + if (!geometry_->HasVertexColors()) { + blend_mode = BlendMode::kSource; + } + + auto dst_sampler_descriptor = descriptor_; + dst_sampler_descriptor.width_address_mode = + TileModeToAddressMode(tile_mode_x_, renderer.GetDeviceCapabilities()) + .value_or(SamplerAddressMode::kClampToEdge); + dst_sampler_descriptor.height_address_mode = + TileModeToAddressMode(tile_mode_y_, renderer.GetDeviceCapabilities()) + .value_or(SamplerAddressMode::kClampToEdge); - // Simple Porter-Duff blends can be accomplished without a sub renderpass. - using VS = PorterDuffBlendPipeline::VertexShader; - using FS = PorterDuffBlendPipeline::FragmentShader; + const std::unique_ptr& dst_sampler = + renderer.GetContext()->GetSamplerLibrary()->GetSampler( + dst_sampler_descriptor); GeometryResult geometry_result = geometry_->GetPositionUVColorBuffer( Rect::MakeSize(texture_->GetSize()), inverse_matrix_, renderer, entity, @@ -289,53 +300,75 @@ bool VerticesSimpleBlendContents::Render(const ContentContext& renderer, } FML_DCHECK(geometry_result.mode == GeometryResult::Mode::kNormal); + if (blend_mode <= Entity::kLastPipelineBlendMode) { + using VS = PorterDuffBlendPipeline::VertexShader; + using FS = PorterDuffBlendPipeline::FragmentShader; + +#ifdef IMPELLER_DEBUG + pass.SetCommandLabel(SPrintF("DrawVertices Porterduff Blend (%s)", + BlendModeToString(blend_mode))); +#endif // IMPELLER_DEBUG + pass.SetVertexBuffer(std::move(geometry_result.vertex_buffer)); + + auto options = OptionsFromPassAndEntity(pass, entity); + options.primitive_type = geometry_result.type; + pass.SetPipeline(renderer.GetPorterDuffBlendPipeline(options)); + + FS::BindTextureSamplerDst(pass, texture_, dst_sampler); + + VS::FrameInfo frame_info; + FS::FragInfo frag_info; + + frame_info.texture_sampler_y_coord_scale = texture_->GetYCoordScale(); + frame_info.mvp = geometry_result.transform; + + frag_info.output_alpha = alpha_; + frag_info.input_alpha = 1.0; + + auto inverted_blend_mode = + InvertPorterDuffBlend(blend_mode).value_or(BlendMode::kSource); + auto blend_coefficients = + kPorterDuffCoefficients[static_cast(inverted_blend_mode)]; + frag_info.src_coeff = blend_coefficients[0]; + frag_info.src_coeff_dst_alpha = blend_coefficients[1]; + frag_info.dst_coeff = blend_coefficients[2]; + frag_info.dst_coeff_src_alpha = blend_coefficients[3]; + frag_info.dst_coeff_src_color = blend_coefficients[4]; + // Only used on devices that do not natively support advanced blends. + frag_info.tmx = static_cast(tile_mode_x_); + frag_info.tmy = static_cast(tile_mode_y_); + + auto& host_buffer = renderer.GetTransientsBuffer(); + FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info)); + VS::BindFrameInfo(pass, host_buffer.EmplaceUniform(frame_info)); + + return pass.Draw().ok(); + } + + using VS = VerticesUberShader::VertexShader; + using FS = VerticesUberShader::FragmentShader; + #ifdef IMPELLER_DEBUG - pass.SetCommandLabel(SPrintF("DrawVertices Porterduff Blend (%s)", - BlendModeToString(blend_mode_))); + pass.SetCommandLabel(SPrintF("DrawVertices Advanced Blend (%s)", + BlendModeToString(blend_mode))); #endif // IMPELLER_DEBUG pass.SetVertexBuffer(std::move(geometry_result.vertex_buffer)); auto options = OptionsFromPassAndEntity(pass, entity); options.primitive_type = geometry_result.type; - pass.SetPipeline(renderer.GetPorterDuffBlendPipeline(options)); - - auto dst_sampler_descriptor = descriptor_; - dst_sampler_descriptor.width_address_mode = - TileModeToAddressMode(tile_mode_x_, renderer.GetDeviceCapabilities()) - .value_or(SamplerAddressMode::kClampToEdge); - dst_sampler_descriptor.height_address_mode = - TileModeToAddressMode(tile_mode_y_, renderer.GetDeviceCapabilities()) - .value_or(SamplerAddressMode::kClampToEdge); + pass.SetPipeline(renderer.GetDrawVerticesUberShader(options)); + FS::BindTextureSampler(pass, texture_, dst_sampler); - const std::unique_ptr& dst_sampler = - renderer.GetContext()->GetSamplerLibrary()->GetSampler( - dst_sampler_descriptor); - FS::BindTextureSamplerDst(pass, texture_, dst_sampler); - - FS::FragInfo frag_info; VS::FrameInfo frame_info; + FS::FragInfo frag_info; frame_info.texture_sampler_y_coord_scale = texture_->GetYCoordScale(); - frag_info.output_alpha = alpha_; - frag_info.input_alpha = 1.0; - - auto inverted_blend_mode = - InvertPorterDuffBlend(blend_mode_).value_or(BlendMode::kSource); - auto blend_coefficients = - kPorterDuffCoefficients[static_cast(inverted_blend_mode)]; - frag_info.src_coeff = blend_coefficients[0]; - frag_info.src_coeff_dst_alpha = blend_coefficients[1]; - frag_info.dst_coeff = blend_coefficients[2]; - frag_info.dst_coeff_src_alpha = blend_coefficients[3]; - frag_info.dst_coeff_src_color = blend_coefficients[4]; + frame_info.mvp = geometry_result.transform; + frag_info.alpha = alpha_; auto& host_buffer = renderer.GetTransientsBuffer(); FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info)); - - frame_info.mvp = geometry_result.transform; - - auto uniform_view = host_buffer.EmplaceUniform(frame_info); - VS::BindFrameInfo(pass, uniform_view); + VS::BindFrameInfo(pass, host_buffer.EmplaceUniform(frame_info)); return pass.Draw().ok(); } diff --git a/impeller/entity/geometry/vertices_geometry.cc b/impeller/entity/geometry/vertices_geometry.cc index a352a212c59d5..83b27e9e7ba24 100644 --- a/impeller/entity/geometry/vertices_geometry.cc +++ b/impeller/entity/geometry/vertices_geometry.cc @@ -256,6 +256,7 @@ GeometryResult VerticesGeometry::GetPositionUVColorBuffer( auto uv_transform = texture_coverage.GetNormalizingTransform() * effect_transform; auto has_texture_coordinates = HasTextureCoordinates(); + auto has_colors = HasVertexColors(); size_t total_vtx_bytes = vertices_.size() * sizeof(VS::PerVertexData); auto vertex_buffer = renderer.GetTransientsBuffer().Emplace( @@ -274,7 +275,7 @@ GeometryResult VerticesGeometry::GetPositionUVColorBuffer( .texture_coords = Point(std::clamp(uv.x, 0.0f, 1.0f - kEhCloseEnough), std::clamp(uv.y, 0.0f, 1.0f - kEhCloseEnough)), - .color = colors_[i], + .color = has_colors ? colors_[i] : Color::BlackTransparent(), }; std::memcpy(vtx_contents++, &vertex_data, sizeof(VS::PerVertexData)); } diff --git a/impeller/entity/shaders/blending/porter_duff_blend.frag b/impeller/entity/shaders/blending/porter_duff_blend.frag index 2b6631f9d57f7..9535f1e806b8f 100644 --- a/impeller/entity/shaders/blending/porter_duff_blend.frag +++ b/impeller/entity/shaders/blending/porter_duff_blend.frag @@ -21,6 +21,8 @@ uniform FragInfo { float16_t dst_coeff_src_color; float16_t input_alpha; float16_t output_alpha; + float tmx; + float tmy; } frag_info; @@ -29,16 +31,20 @@ in f16vec4 v_color; out f16vec4 frag_color; -f16vec4 Sample(f16sampler2D texture_sampler, vec2 texture_coords) { +f16vec4 Sample(f16sampler2D texture_sampler, + vec2 texture_coords, + float tmx, + float tmy) { if (supports_decal > 0.0) { return texture(texture_sampler, texture_coords); } - return IPHalfSampleDecal(texture_sampler, texture_coords); + return IPHalfSampleDecal(texture_sampler, texture_coords, tmx, tmy); } void main() { - f16vec4 dst = - texture(texture_sampler_dst, v_texture_coords) * frag_info.input_alpha; + f16vec4 dst = Sample(texture_sampler_dst, v_texture_coords, frag_info.tmx, + frag_info.tmy) * + frag_info.input_alpha; f16vec4 src = v_color; frag_color = src * (frag_info.src_coeff + dst.a * frag_info.src_coeff_dst_alpha) + diff --git a/impeller/entity/shaders/blending/vertices_uber.frag b/impeller/entity/shaders/blending/vertices_uber.frag new file mode 100644 index 0000000000000..472c3da377aa3 --- /dev/null +++ b/impeller/entity/shaders/blending/vertices_uber.frag @@ -0,0 +1,33 @@ +// 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 "blend_select.glsl" + +uniform FragInfo { + float16_t alpha; + float16_t blend_mode; +} +frag_info; + +uniform f16sampler2D texture_sampler; + +in highp vec2 v_texture_coords; +in mediump f16vec4 v_color; + +out f16vec4 frag_color; + +// A shader that implements the required src/dst blending for drawVertices and +// drawAtlas advanced blends without requiring an offscreen render pass. This is +// done in a single shader to reduce the permutations of PSO needed at runtime +// for rarely used features. +void main() { + f16vec4 dst = IPHalfUnpremultiply(v_color); + f16vec4 src = IPHalfUnpremultiply(texture(texture_sampler, v_texture_coords)); + f16vec3 blend_result = + AdvancedBlend(dst.rgb, src.rgb, int(frag_info.blend_mode - 14.0)); + frag_color = IPApplyBlendedColor(dst, src, blend_result); + frag_color *= frag_info.alpha; +} diff --git a/impeller/entity/shaders/blending/vertices_uber.vert b/impeller/entity/shaders/blending/vertices_uber.vert new file mode 100644 index 0000000000000..a15472a925714 --- /dev/null +++ b/impeller/entity/shaders/blending/vertices_uber.vert @@ -0,0 +1,25 @@ +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include +#include + +uniform FrameInfo { + mat4 mvp; + float texture_sampler_y_coord_scale; +} +frame_info; + +in vec2 vertices; +in vec2 texture_coords; +in vec4 color; + +out vec2 v_texture_coords; +out mediump f16vec4 v_color; + +void main() { + gl_Position = frame_info.mvp * vec4(vertices, 0.0, 1.0); + v_color = f16vec4(color); + v_texture_coords = + IPRemapCoords(texture_coords, frame_info.texture_sampler_y_coord_scale); +} From 1b7f3704d1d0cf1d7e0151d3898408a56ad37e03 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 22 Apr 2024 21:49:22 -0700 Subject: [PATCH 3/7] ++ --- impeller/entity/shaders/blending/vertices_uber.vert | 1 + testing/impeller_golden_tests_output.txt | 3 +++ 2 files changed, 4 insertions(+) diff --git a/impeller/entity/shaders/blending/vertices_uber.vert b/impeller/entity/shaders/blending/vertices_uber.vert index a15472a925714..f7fe022c14a3d 100644 --- a/impeller/entity/shaders/blending/vertices_uber.vert +++ b/impeller/entity/shaders/blending/vertices_uber.vert @@ -1,3 +1,4 @@ +// 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. diff --git a/testing/impeller_golden_tests_output.txt b/testing/impeller_golden_tests_output.txt index 491482dabf944..33562e0ffd6d5 100644 --- a/testing/impeller_golden_tests_output.txt +++ b/testing/impeller_golden_tests_output.txt @@ -757,6 +757,9 @@ impeller_Play_AiksTest_TranslucentSaveLayerWithColorMatrixColorFilterDrawsCorrec impeller_Play_AiksTest_TranslucentSaveLayerWithColorMatrixImageFilterDrawsCorrectly_Metal.png impeller_Play_AiksTest_TranslucentSaveLayerWithColorMatrixImageFilterDrawsCorrectly_OpenGLES.png impeller_Play_AiksTest_TranslucentSaveLayerWithColorMatrixImageFilterDrawsCorrectly_Vulkan.png +impeller_Play_AiksTest_VerticesGeometryColorUVPositionDataAdvancedBlend_Metal.png +impeller_Play_AiksTest_VerticesGeometryColorUVPositionDataAdvancedBlend_OpenGLES.png +impeller_Play_AiksTest_VerticesGeometryColorUVPositionDataAdvancedBlend_Vulkan.png impeller_Play_AiksTest_VerticesGeometryColorUVPositionData_Metal.png impeller_Play_AiksTest_VerticesGeometryColorUVPositionData_OpenGLES.png impeller_Play_AiksTest_VerticesGeometryColorUVPositionData_Vulkan.png From ca67acecec2b8bd92651974ae8d3247b4966fcd1 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 22 Apr 2024 22:08:16 -0700 Subject: [PATCH 4/7] ++ --- impeller/entity/shaders/blending/porter_duff_blend.frag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impeller/entity/shaders/blending/porter_duff_blend.frag b/impeller/entity/shaders/blending/porter_duff_blend.frag index 9535f1e806b8f..348253387e187 100644 --- a/impeller/entity/shaders/blending/porter_duff_blend.frag +++ b/impeller/entity/shaders/blending/porter_duff_blend.frag @@ -38,7 +38,7 @@ f16vec4 Sample(f16sampler2D texture_sampler, if (supports_decal > 0.0) { return texture(texture_sampler, texture_coords); } - return IPHalfSampleDecal(texture_sampler, texture_coords, tmx, tmy); + return IPHalfSampleWithTileMode(texture_sampler, texture_coords, tmx, tmy); } void main() { From 60a15580668ea182423007448b640d6c493a6d2d Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 22 Apr 2024 22:38:49 -0700 Subject: [PATCH 5/7] ++ --- impeller/aiks/canvas.cc | 32 +++++++++---------- impeller/entity/contents/vertices_contents.cc | 1 + 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/impeller/aiks/canvas.cc b/impeller/aiks/canvas.cc index efab9b302d6c4..d5ba43fe7e8c8 100644 --- a/impeller/aiks/canvas.cc +++ b/impeller/aiks/canvas.cc @@ -938,23 +938,21 @@ void Canvas::DrawVertices(const std::shared_ptr& vertices, // If there is are per-vertex colors, an image, and the blend mode // is simple we can draw without a sub-renderpass. - if (blend_mode <= BlendMode::kModulate && vertices->HasVertexColors()) { - if (std::optional maybe_image_data = - GetImageColorSourceData(paint.color_source)) { - const ImageData& image_data = maybe_image_data.value(); - auto contents = std::make_shared(); - contents->SetBlendMode(blend_mode); - contents->SetAlpha(paint.color.alpha); - contents->SetGeometry(vertices); - - contents->SetEffectTransform(image_data.effect_transform); - contents->SetTexture(image_data.texture); - contents->SetTileMode(image_data.x_tile_mode, image_data.y_tile_mode); - - entity.SetContents(paint.WithFilters(std::move(contents))); - AddRenderEntityToCurrentPass(std::move(entity)); - return; - } + if (std::optional maybe_image_data = + GetImageColorSourceData(paint.color_source)) { + const ImageData& image_data = maybe_image_data.value(); + auto contents = std::make_shared(); + contents->SetBlendMode(blend_mode); + contents->SetAlpha(paint.color.alpha); + contents->SetGeometry(vertices); + + contents->SetEffectTransform(image_data.effect_transform); + contents->SetTexture(image_data.texture); + contents->SetTileMode(image_data.x_tile_mode, image_data.y_tile_mode); + + entity.SetContents(paint.WithFilters(std::move(contents))); + AddRenderEntityToCurrentPass(std::move(entity)); + return; } auto src_paint = paint; diff --git a/impeller/entity/contents/vertices_contents.cc b/impeller/entity/contents/vertices_contents.cc index be4f1892e5f1e..4e00c9cbbffc3 100644 --- a/impeller/entity/contents/vertices_contents.cc +++ b/impeller/entity/contents/vertices_contents.cc @@ -365,6 +365,7 @@ bool VerticesSimpleBlendContents::Render(const ContentContext& renderer, frame_info.texture_sampler_y_coord_scale = texture_->GetYCoordScale(); frame_info.mvp = geometry_result.transform; frag_info.alpha = alpha_; + frag_info.blend_mode = static_cast(blend_mode); auto& host_buffer = renderer.GetTransientsBuffer(); FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info)); From 708e595c70a85207b274618285418c5d088d96a7 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 22 Apr 2024 22:41:06 -0700 Subject: [PATCH 6/7] ++ --- ci/licenses_golden/licenses_flutter | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index b52c469b2f816..294be38c5868a 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -40377,6 +40377,8 @@ ORIGIN: ../../../flutter/impeller/entity/shaders/blending/framebuffer_blend.frag 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/blending/vertices_uber.frag + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/entity/shaders/blending/vertices_uber.vert + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/border_mask_blur.frag + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/border_mask_blur.vert + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/shaders/clip.frag + ../../../flutter/LICENSE @@ -43257,6 +43259,8 @@ 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/blending/vertices_uber.frag +FILE: ../../../flutter/impeller/entity/shaders/blending/vertices_uber.vert FILE: ../../../flutter/impeller/entity/shaders/border_mask_blur.frag FILE: ../../../flutter/impeller/entity/shaders/border_mask_blur.vert FILE: ../../../flutter/impeller/entity/shaders/clip.frag From 72affa14abc02dbc658bf4d89c4e51839f0a1bb4 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 22 Apr 2024 23:26:22 -0700 Subject: [PATCH 7/7] ++ --- impeller/entity/contents/vertices_contents.cc | 1 - impeller/entity/contents/vertices_contents.h | 4 +- impeller/tools/malioc.json | 459 ++++++++++++++++++ 3 files changed, 461 insertions(+), 3 deletions(-) diff --git a/impeller/entity/contents/vertices_contents.cc b/impeller/entity/contents/vertices_contents.cc index 4e00c9cbbffc3..dafc7b6e9edfb 100644 --- a/impeller/entity/contents/vertices_contents.cc +++ b/impeller/entity/contents/vertices_contents.cc @@ -243,7 +243,6 @@ void VerticesSimpleBlendContents::SetAlpha(Scalar alpha) { } void VerticesSimpleBlendContents::SetBlendMode(BlendMode blend_mode) { - FML_DCHECK(blend_mode <= BlendMode::kModulate); blend_mode_ = blend_mode; } diff --git a/impeller/entity/contents/vertices_contents.h b/impeller/entity/contents/vertices_contents.h index 8a28a8d6751c2..01bd369c4e5a0 100644 --- a/impeller/entity/contents/vertices_contents.h +++ b/impeller/entity/contents/vertices_contents.h @@ -108,8 +108,8 @@ class VerticesUVContents final : public Contents { VerticesUVContents& operator=(const VerticesUVContents&) = delete; }; -/// A vertices contents for per-color vertices + texture and porter duff -/// blended. +/// A vertices contents for (optional) per-color vertices + texture and any +/// blend mode. class VerticesSimpleBlendContents final : public Contents { public: VerticesSimpleBlendContents(); diff --git a/impeller/tools/malioc.json b/impeller/tools/malioc.json index a0e3a966be0aa..550bc626a14d3 100644 --- a/impeller/tools/malioc.json +++ b/impeller/tools/malioc.json @@ -6062,6 +6062,280 @@ } } }, + "flutter/impeller/entity/gles/vertices_uber.frag.gles": { + "Mali-G78": { + "core": "Mali-G78", + "filename": "flutter/impeller/entity/gles/vertices_uber.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": 0, + "has_stack_spilling": false, + "performance": { + "longest_path_bound_pipelines": [ + "arith_total", + "arith_fma" + ], + "longest_path_cycles": [ + 1.2625000476837158, + 1.2625000476837158, + 0.699999988079071, + 0.3125, + 0.0, + 0.5, + 0.25 + ], + "pipelines": [ + "arith_total", + "arith_fma", + "arith_cvt", + "arith_sfu", + "load_store", + "varying", + "texture" + ], + "shortest_path_bound_pipelines": [ + "varying" + ], + "shortest_path_cycles": [ + 0.390625, + 0.375, + 0.390625, + 0.0, + 0.0, + 0.5, + 0.25 + ], + "total_bound_pipelines": [ + "arith_total", + "arith_fma" + ], + "total_cycles": [ + 3.862499952316284, + 3.862499952316284, + 2.825000047683716, + 0.9375, + 0.0, + 0.5, + 0.25 + ] + }, + "stack_spill_bytes": 0, + "thread_occupancy": 100, + "uniform_registers_used": 14, + "work_registers_used": 32 + } + } + }, + "Mali-T880": { + "core": "Mali-T880", + "filename": "flutter/impeller/entity/gles/vertices_uber.frag.gles", + "has_uniform_computation": false, + "type": "Fragment", + "variants": { + "Main": { + "has_stack_spilling": true, + "performance": { + "longest_path_bound_pipelines": [ + "arithmetic" + ], + "longest_path_cycles": [ + 14.1899995803833, + 5.0, + 1.0 + ], + "pipelines": [ + "arithmetic", + "load_store", + "texture" + ], + "shortest_path_bound_pipelines": [ + "arithmetic" + ], + "shortest_path_cycles": [ + 4.289999961853027, + 1.0, + 1.0 + ], + "total_bound_pipelines": [ + "arithmetic" + ], + "total_cycles": [ + 47.33333206176758, + 6.0, + 1.0 + ] + }, + "thread_occupancy": 50, + "uniform_registers_used": 1, + "work_registers_used": 8 + } + } + } + }, + "flutter/impeller/entity/gles/vertices_uber.vert.gles": { + "Mali-G78": { + "core": "Mali-G78", + "filename": "flutter/impeller/entity/gles/vertices_uber.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.015625, + 0.015625, + 0.015625, + 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.015625, + 0.015625, + 0.015625, + 0.0, + 4.0, + 0.0 + ], + "total_bound_pipelines": [ + "load_store" + ], + "total_cycles": [ + 0.015625, + 0.015625, + 0.015625, + 0.0, + 4.0, + 0.0 + ] + }, + "stack_spill_bytes": 0, + "thread_occupancy": 100, + "uniform_registers_used": 10, + "work_registers_used": 9 + } + } + }, + "Mali-T880": { + "core": "Mali-T880", + "filename": "flutter/impeller/entity/gles/vertices_uber.vert.gles", + "has_uniform_computation": false, + "type": "Vertex", + "variants": { + "Main": { + "has_stack_spilling": false, + "performance": { + "longest_path_bound_pipelines": [ + "load_store" + ], + "longest_path_cycles": [ + 2.9700000286102295, + 7.0, + 0.0 + ], + "pipelines": [ + "arithmetic", + "load_store", + "texture" + ], + "shortest_path_bound_pipelines": [ + "load_store" + ], + "shortest_path_cycles": [ + 2.9700000286102295, + 7.0, + 0.0 + ], + "total_bound_pipelines": [ + "load_store" + ], + "total_cycles": [ + 3.0, + 7.0, + 0.0 + ] + }, + "thread_occupancy": 100, + "uniform_registers_used": 6, + "work_registers_used": 2 + } + } + } + }, "flutter/impeller/entity/gles/yuv_to_rgb_filter.frag.gles": { "Mali-G78": { "core": "Mali-G78", @@ -8932,6 +9206,191 @@ } } }, + "flutter/impeller/entity/vertices_uber.frag.vkspv": { + "Mali-G78": { + "core": "Mali-G78", + "filename": "flutter/impeller/entity/vertices_uber.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": [ + "arith_total", + "arith_fma" + ], + "longest_path_cycles": [ + 1.1124999523162842, + 1.1124999523162842, + 0.84375, + 0.3125, + 0.0, + 0.5, + 0.25 + ], + "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.5625, + 0.5625, + 0.21875, + 0.125, + 0.0, + 0.5, + 0.25 + ], + "total_bound_pipelines": [ + "arith_total", + "arith_fma" + ], + "total_cycles": [ + 3.875, + 3.875, + 2.40625, + 0.9375, + 0.0, + 0.5, + 0.25 + ] + }, + "stack_spill_bytes": 0, + "thread_occupancy": 100, + "uniform_registers_used": 14, + "work_registers_used": 32 + } + } + } + }, + "flutter/impeller/entity/vertices_uber.vert.vkspv": { + "Mali-G78": { + "core": "Mali-G78", + "filename": "flutter/impeller/entity/vertices_uber.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, + 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.015625, + 0.015625, + 0.015625, + 0.0, + 4.0, + 0.0 + ], + "total_bound_pipelines": [ + "load_store" + ], + "total_cycles": [ + 0.015625, + 0.015625, + 0.015625, + 0.0, + 4.0, + 0.0 + ] + }, + "stack_spill_bytes": 0, + "thread_occupancy": 100, + "uniform_registers_used": 22, + "work_registers_used": 9 + } + } + } + }, "flutter/impeller/entity/yuv_to_rgb_filter.frag.vkspv": { "Mali-G78": { "core": "Mali-G78",