Comment

Comment by maximilianburke

Compiling shaders directly from a high level representation to the GPU ISA only really happens on consoles.

In DirectX on PC, shaders have been compiled into an intermediate form going back to Direct3D 8. All of these intermediate forms are lowered into an ISA-specific instruction set by the drivers.

This final compilation step is triggered lazily when a draw happens, so if you are working on a "modern" engine that uses thousands of different material types your choices to handle this are to a) endure a hiccup as these shaders are compiled the first time they are used, b) force compilation at a load stage (usually by doing like a 1x1 pixel draw), or c) restructure the shader infrastructure by going to a megashader or similar.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton