Files
rk35xx-android14/external/angle/doc/DynamicShaderCompilation.md
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

1.1 KiB

About

Because ANGLE can only generate full HLSL programs after we known the signatures between the vertex and pixel stages, we can not immediately call the D3D compiler at GL shader compile time. Moreover, we can insert additional optimization code right at draw-time.

ESSL 1.00 shaders treat all vertex inputs as floating point. We insert a conversion routine to transform un-normalized integer vertex attributes in the shader preamble to floating point, saving CPU conversion time.

At draw-time, we also optimize out any unused render target outputs. This improved draw call performance significantly on lower spec and integrated devices. Changing render target setups may trigger a shader recompile at draw time.

Addendum

ANGLE is not the only program to do this kind of draw-time optimization. A common complaint from application developers is that draw calls sometimes perform very slowly due to dynamic shader re-compilation. A future design direction for ANGLE, when targeting a more modern API, is to perform the vertex conversion in a separate shader pass, which would then be linked with another compiled shader.