Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[g-webgl] Path 应适当降级成 Line 渲染 #1113

Closed
xiaoiver opened this issue Aug 7, 2022 · 0 comments
Closed

[g-webgl] Path 应适当降级成 Line 渲染 #1113

xiaoiver opened this issue Aug 7, 2022 · 0 comments
Assignees
Labels

Comments

@xiaoiver
Copy link
Contributor

xiaoiver commented Aug 7, 2022

目前 Path 的开销非常大,原因是为了支持 lineJoin lineCap 等一系列特性,只能采用非 instanced 方式绘制,每个 Path 需要一个 drawcall:

https://github.com/pixijs/graphics-smooth#what-are-we-working-on-1

这也是 sigma.js 的边绘制高效的原因,仅支持直线。

一个可能的优化点是,有些 Path 实际可以上可以简化成(甚至就是)Line,这样就可以使用 instanced array 大幅减少 drawcall,例如仅包含一个 M 和 L 命令的路径,或者 C 命令控制点重合。同理 Polyline 也应当如此。判断标准如下:

  • Path 转换后包含 M C 命令各一条,其中端点和 C 命令两个控制点都在一条直线上
  • Polyline 所有顶点在一条直线上

测试例子:

/en/examples/perf#webgl-circle-path

@xiaoiver xiaoiver self-assigned this Aug 7, 2022
@xiaoiver xiaoiver closed this as completed Aug 8, 2022
xiaoiver added a commit that referenced this issue Aug 12, 2022
* feat: init annotation plugin

* feat: create selectable ui

* fix: change to the latest renderer plugin usage

* feat: add drawers

* feat: add draw & hover style

* feat: support selectable rect

* fix: move inheritable properties to parent group element #1108

* fix: use radial gradient cache in g-svg

* feat: support marker-start/end in g-webgl

* feat: support marker for polygon in g-webgl

* fix: remove annotation

* fix: resolve merge conflict

* feat: support marker offset for path #1077

* chore: add test case for marker

* chore: add integration testcase for marker

* refactor: split selectable plugin from annotation

* chore: add testcase for clippath

* Publish

 - @antv/g-canvas@1.7.0
 - @antv/g-canvaskit@0.6.0
 - @antv/g-components@1.7.0
 - @antv/g-devtool@0.10.0
 - @antv/g-gesture@0.0.19
 - @antv/g-image-exporter@0.5.0
 - @antv/g-layout-blocklike@1.7.0
 - @antv/g-math@1.7.0
 - @antv/g-mobile-canvas-element@0.6.0
 - @antv/g-mobile-canvas@0.7.0
 - @antv/g-mobile-svg@0.7.0
 - @antv/g-mobile-webgl@0.7.0
 - @antv/g-plugin-3d@1.7.0
 - @antv/g-plugin-a11y@0.4.0
 - @antv/g-plugin-annotation@0.1.0
 - @antv/g-plugin-box2d@1.7.0
 - @antv/g-plugin-canvas-path-generator@1.1.0
 - @antv/g-plugin-canvas-picker@1.7.0
 - @antv/g-plugin-canvas-renderer@1.7.0
 - @antv/g-plugin-canvaskit-renderer@1.1.0
 - @antv/g-plugin-control@1.7.0
 - @antv/g-plugin-css-select@1.7.0
 - @antv/g-plugin-device-renderer@1.7.0
 - @antv/g-plugin-dom-interaction@1.7.0
 - @antv/g-plugin-dragndrop@1.6.0
 - @antv/g-plugin-gpgpu@1.7.0
 - @antv/g-plugin-html-renderer@1.7.0
 - @antv/g-plugin-image-loader@1.1.0
 - @antv/g-plugin-matterjs@1.7.0
 - @antv/g-plugin-mobile-interaction@0.7.0
 - @antv/g-plugin-physx@1.7.0
 - @antv/g-plugin-rough-canvas-renderer@1.7.0
 - @antv/g-plugin-rough-svg-renderer@1.7.0
 - @antv/g-plugin-svg-picker@1.7.0
 - @antv/g-plugin-svg-renderer@1.7.0
 - @antv/g-plugin-webgl-device@1.7.0
 - @antv/g-plugin-webgpu-device@1.7.0
 - @antv/g-plugin-yoga@1.7.0
 - @antv/g-shader-components@1.7.0
 - @antv/g-svg@1.7.0
 - @antv/g-web-components@1.7.0
 - @antv/g-webgl@1.7.0
 - @antv/g-webgpu@1.7.0
 - @antv/g@5.7.0
 - @antv/react-g@1.7.0
 - @antv/g-site@1.7.0

* fix: custom element should trigger attribute changed callback after connected

* fix: make clippath valid on ancestor #1109

* fix: picking should account for clippath on ancestor #1109

* fix: event on/off

* Publish

 - @antv/g-canvas@1.7.1
 - @antv/g-canvaskit@0.6.1
 - @antv/g-gesture@0.0.20
 - @antv/g-mobile-canvas@0.7.1
 - @antv/g-plugin-annotation@0.1.1
 - @antv/g-plugin-canvas-picker@1.7.1
 - @antv/g-plugin-canvas-renderer@1.7.1
 - @antv/g@5.7.1
 - @antv/react-g@1.7.1

* fix: support relative length unit for dx/dy #1111

* Publish

 - @antv/g-canvas@1.7.2
 - @antv/g-canvaskit@0.6.2
 - @antv/g-gesture@0.0.21
 - @antv/g-mobile-canvas@0.7.2
 - @antv/g-mobile-webgl@0.7.1
 - @antv/g-plugin-annotation@0.1.2
 - @antv/g-plugin-canvas-renderer@1.7.2
 - @antv/g-plugin-canvaskit-renderer@1.1.1
 - @antv/g-plugin-device-renderer@1.7.1
 - @antv/g-plugin-image-loader@1.1.1
 - @antv/g-webgl@1.7.1
 - @antv/g-webgpu@1.7.1
 - @antv/g@5.7.2
 - @antv/react-g@1.7.2

* fix: use native isPointInPath method first #1112

* fix: emit draw:move event

* fix: disable drawing with right mouse

* fix: downgrade Path / Polyline to Line for better perf in g-webgl #1113

* fix: apply filter to Image & Text correctly #1114

* chore: add testcase for filter

* Publish

 - @antv/g-canvas@1.7.3
 - @antv/g-canvaskit@0.6.3
 - @antv/g-gesture@0.0.22
 - @antv/g-mobile-canvas@0.7.3
 - @antv/g-mobile-svg@0.7.1
 - @antv/g-mobile-webgl@0.7.2
 - @antv/g-plugin-annotation@0.1.3
 - @antv/g-plugin-canvas-picker@1.7.2
 - @antv/g-plugin-canvas-renderer@1.7.3
 - @antv/g-plugin-device-renderer@1.7.2
 - @antv/g-plugin-svg-renderer@1.7.1
 - @antv/g-svg@1.7.1
 - @antv/g-webgl@1.7.2
 - @antv/g-webgpu@1.7.2
 - @antv/g@5.7.3
 - @antv/react-g@1.7.3
 - @antv/g-site@1.7.1

* fix: use viewport point to render drawer

* feat: interactive event such as PointerEvent and WheelEvent can be cloned #1115

* fix: draw rect with rotation

* fix: copy event point

* fix: account for camera rotation when clearing dirty rectangle #1116

* fix: reduce re-ordering on fcp #1117

* chore: update annotation docs

Co-authored-by: yuqi.pyq <yuqi.pyq@antgroup.com>
Co-authored-by: yuanzi <liaopei.lp@antgroup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant