-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
WebGL Renderer #1790
WebGL Renderer #1790
Conversation
@Tyriar Have not yet looked at the code but could not resist to do a few tests on my own. Therefore first a few notes about the perf results. I see about the same perf boost (rendering being 3-5x faster) on Linux with either intel graphics or nvidia GT520M (very old) and GTX 960. With my typical Your results also show a big perf decrease on the MacBook for the bigger terminal view. I wonder how fullscreen would perform. Note that I cant resemble this decrease with Linux (even tried 500x100), I see only slightly worse runtime for intel or nvidia gc. Maybe thats a resolution problem (retina?) and could be tweaked further? What I see now for my benchmark in the demo:
Last but not least: since many peeps nowadays are on laptops - does anyone know if the gl renderer would drain more power than the canvas renderer? Note that the canvas renderer also relies on hardware acc, still unsure whether this might trigger a more costly power profile. |
On support, according to https://webglstats.com/ 68% of desktops support WebGL2. I looked into downgrading to WebGL1 (98% support) but there doesn't appear to be an extension for https://caniuse.com/#search=webgl2 says that Chrome, Firefox, Opera support WebGL2. |
@Tyriar Yeah seems only Safari cant do Webgl2, I am not sure if Safari will ever see this as Apple is pushing WebGPU based on Metal/Vulkan. Webgl1/2 is based on OpenGL which got deprecated on macOS. |
Currently experimenting with minimizing the amount of data uploaded to the GPU via |
This is ready for review/merge, it's still a work in progress as these won't work:
However it's a standalone addon now, the only thing that affects the core is the very small diff outside of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot not really review this monster :P - still I have a few questions/remarks.
Could you please republish the addon with the fixed typings file? |
@Eugeny done |
@Eugeny I didn't think that ever worked because we don't detect unicode version we have to guess? |
Let's do this! 🚀 I've created a bunch of issues tracking the remaining issues under the |
This PR introduces the
'webgl'
renderer which is basically canvas but much lower level and much faster. I see this eventually replacing the canvas renderer but it will need some time before that happens.But there's already a canvas renderer?
To illustrate the difference when drawing, the canvas renderer basically does this:
0,0
from texturea
1,0
from texturea
2,0
from texturea
These individual instructions are costly, the webgl renderer instead builds a
Float32Array
containing all the data needed to draw and a "webgl program" (a vertex shader and a fragment shader) that knows how to draw things from theFloat32Array
is uploaded to the GPU which does the actual drawing. Of course the details are much more involved than this, but that's the basics of why the webgl renderer will be superior to the canvas renderer.Features
Notes
drawElementsInstanced
.CursorRenderLayer
andLinkRenderLayer
in order to simplify the rendering logic (and because they're pretty fast anyway).Issues
🛑= merge blocker
allowTransparency
is not supported yet.Comparing to canvas renderer
Summary
This table shows the average time to draw the frame before and after, see below for more details.
Methodology
Wrapping
_renderRows
of Renderer.ts (canvas) and WebglRenderer.ts:Parts of the chrome timelines are also presented. Note that the injected code is necessary because it's difficult to measure otherwise as the number of frames and average frame time isn't captured by the timeline.
The Macbook Pro is mid 2014 with an Intel Iris Pro 1536 MB, the Windows box has a GTX 760.
Macbook Viewport 87x26 (demo default),
ls -lR .
Canvas Renderer (dynamic atlas)
WebGL Renderer
Macbook Viewport 300x80,
ls -lR .
Canvas Renderer (dynamic atlas)
WebGL Renderer
Windows Viewport 87x26 (demo default),
tree
Canvas Renderer (dynamic atlas)
WebGL Renderer
Windows Viewport 300x80,
tree
Canvas Renderer (dynamic atlas)
WebGL Renderer
Macbook Viewport 87x26,
cat zh_wcag_100.txt
zh_wcag_100.txt contains this contents of https://www.w3.org/Translations/WCAG20-zh/ 100 times to help test throughput for wide characters.
Canvas Renderer (dynamic atlas)
WebGL Renderer
Macbook Viewport 87x26,
cat emoji_100.txt
emoji_100.txt contains this contents of https://getemoji.com/ times to help test throughput for combined characters.
Canvas Renderer (dynamic atlas)
WebGL Renderer
Fixes #720
Fixes #1138 (microsoft/vscode#35901)
Fixes #1170 (I think)
Obsoletes a bunch of issues related to the canvas renderer: #941, #955, #1389, #1614