Skip to content

Uber shaders still require on-demand compilation #21

@michael-fadely

Description

@michael-fadely

The current uber shader implementation still requires on-demand compilation when in the absence of a shader permutation/variant cache.

Although mitigated by reducing the number of variants and unrolling "texture stage state" loops to reduce compilation time, the shader--sometimes both vertex and pixel--must be minimally recompiled for each vertex format (FVF) rendered. Below is a list of all flags which contribute to uber shader variants:

Vertex shaders:

  • Vertex format (FVF)

Pixel shaders:

  • Texture stage count
  • Vertex format as it relates to lighting (D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_NORMAL | D3DFVF_XYZRHW)

There are two potential solutions to this requirement as I see it:

  1. Skip rendering until the desired uber shader is ready
  2. Calculate all valid vertex flag permutations on startup and compile (maybe with a startup-specific async option)

Option 1 would be nice to have for all shaders so that the fallback path can be configured (e.g. user could disable uber shaders all together and instead just skip rendering until optimized shaders are available).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions