Fix solid stroke bindings in GLES (flutter/engine#33908)

This commit is contained in:
Brandon DeRosier
2022-06-09 11:12:08 -07:00
committed by GitHub
parent 2a3733969b
commit e976003ff0
2 changed files with 5 additions and 12 deletions

View File

@@ -182,10 +182,8 @@ bool SolidStrokeContents::Render(const ContentContext& renderer,
VS::FrameInfo frame_info; VS::FrameInfo frame_info;
frame_info.mvp = Matrix::MakeOrthographic(pass.GetRenderTargetSize()) * frame_info.mvp = Matrix::MakeOrthographic(pass.GetRenderTargetSize()) *
entity.GetTransformation(); entity.GetTransformation();
frame_info.color = color_.Premultiply();
VS::StrokeInfo stroke_info; frame_info.size = stroke_size_;
stroke_info.color = color_.Premultiply();
stroke_info.size = stroke_size_;
Command cmd; Command cmd;
cmd.primitive_type = PrimitiveType::kTriangleStrip; cmd.primitive_type = PrimitiveType::kTriangleStrip;
@@ -205,8 +203,6 @@ bool SolidStrokeContents::Render(const ContentContext& renderer,
cap_proc_, join_proc_, cap_proc_, join_proc_,
miter_limit_, smoothing)); miter_limit_, smoothing));
VS::BindFrameInfo(cmd, pass.GetTransientsBuffer().EmplaceUniform(frame_info)); VS::BindFrameInfo(cmd, pass.GetTransientsBuffer().EmplaceUniform(frame_info));
VS::BindStrokeInfo(cmd,
pass.GetTransientsBuffer().EmplaceUniform(stroke_info));
pass.AddCommand(cmd); pass.AddCommand(cmd);

View File

@@ -4,12 +4,9 @@
uniform FrameInfo { uniform FrameInfo {
mat4 mvp; mat4 mvp;
} frame_info;
uniform StrokeInfo {
vec4 color; vec4 color;
float size; float size;
} stroke_info; } frame_info;
in vec2 vertex_position; in vec2 vertex_position;
in vec2 vertex_normal; in vec2 vertex_normal;
@@ -20,8 +17,8 @@ out float v_pen_down;
void main() { void main() {
// Push one vertex by the half stroke size along the normal vector. // Push one vertex by the half stroke size along the normal vector.
vec2 offset = vertex_normal * vec2(stroke_info.size * 0.5); vec2 offset = vertex_normal * vec2(frame_info.size * 0.5);
gl_Position = frame_info.mvp * vec4(vertex_position + offset, 0.0, 1.0); gl_Position = frame_info.mvp * vec4(vertex_position + offset, 0.0, 1.0);
stroke_color = stroke_info.color; stroke_color = frame_info.color;
v_pen_down = pen_down; v_pen_down = pen_down;
} }