Angle Shader Compile Issues In Windows.

176 views
Skip to first unread message

栗韶远

unread,
Dec 20, 2021, 10:29:24 AM12/20/21
to angleproject
Hi,
We (developer team) are in the process of rendering effects between DirectX and OpenGL ES(Based on Angle-DirectX) which connect our 3d mobile rendering engine and old desktop codes.

We are at a point where complicated shaders are compiled so slowly. I try my best to search and consult, there are several (uncertain) solutions at present:

1. Shaders are compiled so slowly mainly due to the translation from "GLSL to HLSL"I think it might be possible to create GLES program from a HLSL shader (pre-cached) But didn't find any extensions for pre-translation and create program from HLSL shader. Is it feasible?

2. Every shader are compiled and could retrieve binary data with glGetProgramBinary. Is the binary format compatible with "same angle library and difference hardware devices" ? If it's true I could pre-compiled all shaders to file and create program from cached binary fast.

3. EGL_ANGLE_program_cache_control could cache program binary for display. Is the results of eglProgramCacheQueryANGLE compatible with "same angle library and difference hardware devices" ? If it's true I could save results of eglProgramCacheQueryANGLE to file and start program with cached binary file and the compile would be also fast.


Which of these three solutions is correct?
If it is not feasible, is there a recommended way to solve my problem?

Thanks in advance!

Jamie Madill

unread,
Dec 20, 2021, 11:44:49 AM12/20/21
to lisha...@bytedance.com, angleproject
Hello!

Regarding time, most of the time in a compile is spent in the D3D compiler itself which we cannot avoid. Because the particular GPU or system configuration can affect the compile, the recommended practice for program binaries is to compile the shader on first startup, then cache the shaders with Program Binary in your own application's cache. Then subsequent loads can retrieve and load the binaries significantly faster. Note that you need to re-cache the binaries if you upgrade ANGLE.

--
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/42052505-05f3-4155-b58c-e71455fb97d6n%40googlegroups.com.

Jamie Madill

unread,
Dec 20, 2021, 12:10:05 PM12/20/21
to 栗韶远, angleproject
That's correct.

On Mon, Dec 20, 2021 at 12:06 PM 栗韶远 <lisha...@bytedance.com> wrote:
Thanks!
Do you mean program cache and program binary can only be used on the same device and the same angle library
It seems the recommended solution is caching the program cache or program binary on the first startup and using caches subsequently and no universal shaders (no restricted by application hardware) can improve the compile time of Angle-D3D.

LASHY

unread,
Dec 23, 2021, 1:45:53 AM12/23/21
to angleproject

Is BinaryFormat  GL_ANGLE_program_binary not unified in the same graphics-backend and the same angle?

As far as I understand (with angle source code), GL_ANGLE_program_binary return a binary which include header information(such as angle commit&version), reflection information  (such as uniform&inputs&outputs), backend bytecode(such as results of D3DCompiler).

The  results of D3DCompiler are unified bytecodes in accordance with D3D Spec.

If I use:
same angle library
same bakcend (D3D11 or D3D9 clearly)
difference devices(for example, a win 10 device with RTX2060 and another device with RTX 2070)
Can i get a same binary by glGetProgramBinary in two devices? 
Reply all
Reply to author
Forward
0 new messages