diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index e2b2d2724317f..cb9bd0c1f3b05 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -1280,8 +1280,6 @@ FILE: ../../../flutter/impeller/entity/shaders/rrect_blur.frag FILE: ../../../flutter/impeller/entity/shaders/rrect_blur.vert FILE: ../../../flutter/impeller/entity/shaders/solid_fill.frag FILE: ../../../flutter/impeller/entity/shaders/solid_fill.vert -FILE: ../../../flutter/impeller/entity/shaders/solid_stroke.frag -FILE: ../../../flutter/impeller/entity/shaders/solid_stroke.vert FILE: ../../../flutter/impeller/entity/shaders/srgb_to_linear_filter.frag FILE: ../../../flutter/impeller/entity/shaders/srgb_to_linear_filter.vert FILE: ../../../flutter/impeller/entity/shaders/sweep_gradient_fill.frag diff --git a/impeller/entity/BUILD.gn b/impeller/entity/BUILD.gn index e2c9f4944da10..bce02deec6153 100644 --- a/impeller/entity/BUILD.gn +++ b/impeller/entity/BUILD.gn @@ -49,8 +49,6 @@ impeller_shaders("entity_shaders") { "shaders/rrect_blur.frag", "shaders/solid_fill.frag", "shaders/solid_fill.vert", - "shaders/solid_stroke.frag", - "shaders/solid_stroke.vert", "shaders/srgb_to_linear_filter.frag", "shaders/srgb_to_linear_filter.vert", "shaders/sweep_gradient_fill.frag", diff --git a/impeller/entity/contents/content_context.cc b/impeller/entity/contents/content_context.cc index c2c7e4e93f6c8..0e514334f358d 100644 --- a/impeller/entity/contents/content_context.cc +++ b/impeller/entity/contents/content_context.cc @@ -204,8 +204,6 @@ ContentContext::ContentContext(std::shared_ptr context) CreateDefaultPipeline(*context_); srgb_to_linear_filter_pipelines_[{}] = CreateDefaultPipeline(*context_); - solid_stroke_pipelines_[{}] = - CreateDefaultPipeline(*context_); glyph_atlas_pipelines_[{}] = CreateDefaultPipeline(*context_); glyph_atlas_sdf_pipelines_[{}] = diff --git a/impeller/entity/contents/content_context.h b/impeller/entity/contents/content_context.h index 5a38cdb94fc58..8601b4e80c92f 100644 --- a/impeller/entity/contents/content_context.h +++ b/impeller/entity/contents/content_context.h @@ -53,8 +53,6 @@ #include "impeller/entity/rrect_blur.vert.h" #include "impeller/entity/solid_fill.frag.h" #include "impeller/entity/solid_fill.vert.h" -#include "impeller/entity/solid_stroke.frag.h" -#include "impeller/entity/solid_stroke.vert.h" #include "impeller/entity/srgb_to_linear_filter.frag.h" #include "impeller/entity/srgb_to_linear_filter.vert.h" #include "impeller/entity/sweep_gradient_fill.frag.h" @@ -145,8 +143,6 @@ using LinearToSrgbFilterPipeline = using SrgbToLinearFilterPipeline = RenderPipelineT; -using SolidStrokePipeline = - RenderPipelineT; using GlyphAtlasPipeline = RenderPipelineT; using GlyphAtlasSdfPipeline = @@ -271,11 +267,6 @@ class ContentContext { return GetPipeline(srgb_to_linear_filter_pipelines_, opts); } - std::shared_ptr> GetSolidStrokePipeline( - ContentContextOptions opts) const { - return GetPipeline(solid_stroke_pipelines_, opts); - } - std::shared_ptr> GetClipPipeline( ContentContextOptions opts) const { return GetPipeline(clip_pipelines_, opts); @@ -420,7 +411,6 @@ class ContentContext { color_matrix_color_filter_pipelines_; mutable Variants linear_to_srgb_filter_pipelines_; mutable Variants srgb_to_linear_filter_pipelines_; - mutable Variants solid_stroke_pipelines_; mutable Variants clip_pipelines_; mutable Variants glyph_atlas_pipelines_; mutable Variants glyph_atlas_sdf_pipelines_; diff --git a/impeller/entity/contents/solid_stroke_contents.cc b/impeller/entity/contents/solid_stroke_contents.cc index 0a89e6a7c835e..8ff982c667d14 100644 --- a/impeller/entity/contents/solid_stroke_contents.cc +++ b/impeller/entity/contents/solid_stroke_contents.cc @@ -73,7 +73,7 @@ static VertexBuffer CreateSolidStrokeVertices( const SolidStrokeContents::JoinProc& join_proc, Scalar miter_limit, const SmoothingApproximation& smoothing) { - using VS = SolidStrokeVertexShader; + using VS = SolidFillVertexShader; VertexBufferBuilder vtx_builder; auto polyline = path.CreatePolyline(); @@ -187,9 +187,6 @@ bool SolidStrokeContents::Render(const ContentContext& renderer, return true; } - using VS = SolidStrokePipeline::VertexShader; - using FS = SolidStrokePipeline::FragmentShader; - VS::VertInfo vert_info; vert_info.mvp = Matrix::MakeOrthographic(pass.GetRenderTargetSize()) * entity.GetTransformation(); @@ -209,7 +206,7 @@ bool SolidStrokeContents::Render(const ContentContext& renderer, options.stencil_compare = CompareFunction::kEqual; options.stencil_operation = StencilOperation::kIncrementClamp; } - cmd.pipeline = renderer.GetSolidStrokePipeline(options); + cmd.pipeline = renderer.GetSolidFillPipeline(options); cmd.stencil_reference = entity.GetStencilDepth(); auto smoothing = SmoothingApproximation( @@ -255,7 +252,6 @@ Scalar SolidStrokeContents::GetStrokeMiter() { void SolidStrokeContents::SetStrokeCap(Cap cap) { cap_ = cap; - using VS = SolidStrokeVertexShader; switch (cap) { case Cap::kButt: cap_proc_ = [](VertexBufferBuilder& vtx_builder, @@ -266,7 +262,7 @@ void SolidStrokeContents::SetStrokeCap(Cap cap) { cap_proc_ = [](VertexBufferBuilder& vtx_builder, const Point& position, const Point& offset, const SmoothingApproximation& smoothing) { - SolidStrokeVertexShader::PerVertexData vtx; + VS::PerVertexData vtx; Point forward(offset.y, -offset.x); Point forward_normal = forward.Normalize(); @@ -293,7 +289,7 @@ void SolidStrokeContents::SetStrokeCap(Cap cap) { cap_proc_ = [](VertexBufferBuilder& vtx_builder, const Point& position, const Point& offset, const SmoothingApproximation& smoothing) { - SolidStrokeVertexShader::PerVertexData vtx; + VS::PerVertexData vtx; vtx.position = position; Point forward(offset.y, -offset.x); @@ -316,11 +312,11 @@ SolidStrokeContents::Cap SolidStrokeContents::GetStrokeCap() { } static Scalar CreateBevelAndGetDirection( - VertexBufferBuilder& vtx_builder, + VertexBufferBuilder& vtx_builder, const Point& position, const Point& start_offset, const Point& end_offset) { - SolidStrokeVertexShader::PerVertexData vtx; + SolidFillVertexShader::PerVertexData vtx; vtx.position = position; vtx_builder.AppendVertex(vtx); @@ -336,7 +332,6 @@ static Scalar CreateBevelAndGetDirection( void SolidStrokeContents::SetStrokeJoin(Join join) { join_ = join; - using VS = SolidStrokeVertexShader; switch (join) { case Join::kBevel: join_proc_ = [](VertexBufferBuilder& vtx_builder, @@ -371,7 +366,7 @@ void SolidStrokeContents::SetStrokeJoin(Join join) { } // Outer miter point. - SolidStrokeVertexShader::PerVertexData vtx; + VS::PerVertexData vtx; vtx.position = position + miter_point * dir; vtx_builder.AppendVertex(vtx); }; @@ -409,7 +404,7 @@ void SolidStrokeContents::SetStrokeJoin(Join join) { middle_handle, middle) .CreatePolyline(smoothing); - SolidStrokeVertexShader::PerVertexData vtx; + VS::PerVertexData vtx; for (const auto& point : arc_points) { vtx.position = position + point * dir; vtx_builder.AppendVertex(vtx); diff --git a/impeller/entity/contents/solid_stroke_contents.h b/impeller/entity/contents/solid_stroke_contents.h index 72534ba06ba25..526d0d3c7d198 100644 --- a/impeller/entity/contents/solid_stroke_contents.h +++ b/impeller/entity/contents/solid_stroke_contents.h @@ -9,8 +9,10 @@ #include #include "flutter/fml/macros.h" +#include "impeller/entity/contents/content_context.h" #include "impeller/entity/contents/contents.h" -#include "impeller/entity/solid_stroke.vert.h" +#include "impeller/entity/solid_fill.frag.h" +#include "impeller/entity/solid_fill.vert.h" #include "impeller/geometry/color.h" #include "impeller/geometry/path_component.h" #include "impeller/geometry/point.h" @@ -18,6 +20,9 @@ namespace impeller { class SolidStrokeContents final : public Contents { + using VS = SolidFillVertexShader; + using FS = SolidFillFragmentShader; + public: enum class Cap { kButt, @@ -31,18 +36,18 @@ class SolidStrokeContents final : public Contents { kBevel, }; - using CapProc = std::function& vtx_builder, - const Point& position, - const Point& offset, - const SmoothingApproximation& smoothing)>; - using JoinProc = std::function& vtx_builder, - const Point& position, - const Point& start_offset, - const Point& end_offset, - Scalar miter_limit, - const SmoothingApproximation& smoothing)>; + using CapProc = + std::function& vtx_builder, + const Point& position, + const Point& offset, + const SmoothingApproximation& smoothing)>; + using JoinProc = + std::function& vtx_builder, + const Point& position, + const Point& start_offset, + const Point& end_offset, + Scalar miter_limit, + const SmoothingApproximation& smoothing)>; SolidStrokeContents(); diff --git a/impeller/entity/shaders/solid_stroke.frag b/impeller/entity/shaders/solid_stroke.frag deleted file mode 100644 index 5d9c83604dd68..0000000000000 --- a/impeller/entity/shaders/solid_stroke.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. - -uniform FragInfo { - vec4 color; -} -frag_info; - -out vec4 frag_color; - -void main() { - frag_color = frag_info.color; -} diff --git a/impeller/entity/shaders/solid_stroke.vert b/impeller/entity/shaders/solid_stroke.vert deleted file mode 100644 index 8fdc5b1ea3f1e..0000000000000 --- a/impeller/entity/shaders/solid_stroke.vert +++ /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. - -uniform VertInfo { - mat4 mvp; -} -vert_info; - -in vec2 position; - -void main() { - gl_Position = vert_info.mvp * vec4(position, 0.0, 1.0); -}