compile shader is too slow

65 views
Skip to first unread message

guodong chen

unread,
Jul 4, 2023, 8:57:16 AM7/4/23
to angleproject
I am trying to port google's filament renderer to angle.
But I found that after glCompileShader glGetProgramiv(); Very long, about 400 milliseconds. Native opengl takes about 5ms.

This could be some kind of problem. filament's pbr shader is around 15,000 lines, is it too much shader code?

mac platform,

Ken Russell

unread,
Jul 5, 2023, 6:00:59 PM7/5/23
to chenguodo...@gmail.com, angleproject
Which of ANGLE's two backends on macOS are you trying, OpenGL or Metal? From testing of other partners' shaders, we are confident that ANGLE's Metal backend provides significantly improved shader compilation times for complex shaders.

The ANGLE team is in the final stages of making the Metal backend the default in the Chromium browser, and we'd recommend anyone doing native development with ANGLE to use it as well.

-Ken



--
You received this message because you are subscribed to the Google Groups "angleproject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angleproject...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angleproject/ceb858e1-1d88-4b47-bf7f-279b7b034371n%40googlegroups.com.
Message has been deleted

guodong chen

unread,
Jul 5, 2023, 10:43:46 PM7/5/23
to angleproject

Indeed, I forced angle to use metal's back end last night. Found that the problem does not exist, I do not know if the use of vulkan on the linux platform is the same problem

@Kenneth Russell


Shahbaz Youssefi

unread,
Jul 6, 2023, 11:27:49 AM7/6/23
to angleproject
Hi,

> I do not know if the use of vulkan on the linux platform is the same problem

Could you please clarify what the issue is here? Our compile time on the Vulkan backend should be considerably faster than every other backend. Program link time on the other hand can be slow due to Vulkan Pipeline cache warmup. But it's not clear from your statement if you mean the Vulkan backend is being _slower_ than the GL backend on Linux, or if switching to Vulkan is _solving_ the same problem?

If Vulkan is being slow, please consider providing the contents of vulkaninfo. You can also try running with the following environment variable `ANGLE_FEATURE_OVERRIDES_DISABLED=warmUpPipelineCacheAtLink` to disable the aforementioned warmup to see if that's what was being slow.

guodong chen

unread,
Jul 9, 2023, 10:34:35 PM7/9/23
to angleproject
At present, I only have a mac machine, and the compilation speed of metal back-end shader is OK under my test, while the compilation speed of opengl back-end is very slow. vulkan and dx I'm just worried, but there are no machines to do testing at the moment.

Shahbaz Youssefi

unread,
Jul 10, 2023, 1:31:28 PM7/10/23
to angleproject
Got it. Generally speaking, expect dx to also be relatively slow as it needs to call into the directx compiler, though I can't comment on how that would compare with the slowness you saw on mac/gl (that could have come from a hard-to-digest bug workaround ANGLE applies, or your shader might have hit a pathologically slow path in the driver, or just generally low quality of mac/gl drivers. That said, the directx compiler is not known to be particularly good either).

I wouldn't worry about the Vulkan backend though, compilation there should be an order of magnitude faster than the other backends.

Geoff Lang

unread,
Jul 10, 2023, 2:56:14 PM7/10/23
to syou...@chromium.org, angleproject
ANGLE also makes use of the EGL_ANDROID_blob_cache extension to greatly speed up compilations of the same shaders on subsequent runs. You will have to pass the callbacks to ANGLE and save the data to disk between runs.

guodong chen

unread,
Jul 11, 2023, 2:27:41 AM7/11/23
to angleproject

Well I think vulkan and metal backends are good enough for now. Thanks for your reply
Reply all
Reply to author
Forward
0 new messages