First frames: shader loading and pipeline compilation
Loading a resource does not guarantee every rendering variant is ready.
Separate the stages
| Stage | Work |
|---|---|
| Shader/material loading | Obtain the resource, code and parameters |
| Shader preparation | Parse and compile for the selected graphics path |
| Pipeline creation | Combine shader, vertex format, target, pass and other state |
| Actual drawing | Use a specific variant on the GPU |
One material may need several variants. Load<Shader> and successful source parsing do not promise a first visible frame without extra driver work.
Identify a cold appearance
Reproduce a material's first appearance in a consistent scene, then repeat it within the same run. Record renderer, device, driver and cache state. A long frame may instead involve file loading, allocation or gameplay logic; do not label every spike shader stutter without checking.
The school example creates a Shader from complete source and uses it on a real object. Shader .rdata saving/loading and actual rendering are also verified. This establishes a working resource path rather than its first-use timing.
Warm the real variant
Prepare objects and materials under a loading screen so that the required geometry actually draws. Hidden objects, empty viewports and out-of-view geometry do not guarantee the required draw variant. Match the surfaces, passes, target settings and effects the game will use.
Waiting for FramePostDraw establishes a rendering frame boundary, not a GPU timer or preparation of every future variant. Material/state changes may need other variants. Loading has no universal compile-everything-forever guarantee.
Distinguish renderers and counters
The Forward+/Mobile RD path uses specialized pipelines and preparation mechanisms. Compatibility uses OpenGL and a different path. Pipeline-compilation counters are not interchangeable readiness proofs: PipelineCompilationsMesh is 0 in the tested Compatibility run despite actual shader use.
Caches depend on graphics path, driver and device. Do not distribute a local driver cache as a universal player fix. Before release, check required variants from cold conditions on target configurations rather than relying only on repeated developer-machine runs.