Bug 246335
Summary: | 'flat' vertex shader output is extremely slow with 'WebGL via Metal' | ||
---|---|---|---|
Product: | WebKit | Reporter: | Marcin <msokalski> |
Component: | WebGL | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | dino, kbr, kkinnunen, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari 15 | ||
Hardware: | Unspecified | ||
OS: | iOS 15 |
Marcin
Declaring vertex shader output with 'flat' specifier makes drawing very slow.
It is not suffering from it when drawing POINTS primitive.
Also, problem does not occur when WebGL via Metal is disabled.
in vec2 clip_space_pos;
in vec4 just_color;
flat out vec4 flat_color;
void main()
{
gl_Position = vec4(clip_space_pos,0.0,1.0);
flat_color = just_color * clip_space_pos.x;
}
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Kimmo Kinnunen
Thanks for filing.
This is one other area where Metal has to emulate: the provoking vertex is different in Metal than it is in OpenGL. At the moment the emulation is likely not the fastest.
If you are using drawElements, you may find drawArrays faster. However, this will still suffer a perf penalty.
We're also working on a provoking vertex extension in case your shader does not depend on the provoking vertex.
See:
https://github.com/KhronosGroup/WebGL/issues/3401
This extension is available in current WebKit trunk builds (e.g. in minibrowser) under experimental features, experimental WebGL extensions. If you try out the provoking vertex extension, please provide feedback in both cases: if you find it does not improve or improves perf.
Marcin
Having EXT_provoking_vertex extension would be great, but I don't see it on my iPhone Safari settings and getExtension("EXT_provoking_vertex") returns null. Hopefully with next OS update I can use it.
Regarding performance of drawElements and drawArrays, I have actually opposite experience, drawElements is significantly faster.
Anyway thanks for the info, I was able to work around need for flat varyings, and now Metal backend seams to outperform the older thing.
Radar WebKit Bug Importer
<rdar://problem/101288278>
Kimmo Kinnunen
*** Bug 251506 has been marked as a duplicate of this bug. ***