Skip to content

Latest commit

 

History

History
45 lines (27 loc) · 1.85 KB

File metadata and controls

45 lines (27 loc) · 1.85 KB

SRP Batcher Analysis

ShaderOS checks each scanned material for SRP Batcher compatibility and reports failures as TS.SO.V003.


What compatibility requires

A shader is SRP Batcher compatible when all per-material properties are declared inside:

CBUFFER_START(UnityPerMaterial)
    float4 _BaseColor;
    float  _Smoothness;
    // all other per-material properties
CBUFFER_END

Any per-material property outside this block disqualifies the shader.


How ShaderOS assesses compatibility

Three layers in order of reliability:

Layer 1 — Native API. On Unity versions where ShaderUtil exposes a pass-level compatibility check, ShaderOS calls it. Most accurate.

Layer 2 — Source text. For custom .shader files on disk, ShaderOS reads the source and checks for CBUFFER_START(UnityPerMaterial). Present → compatible. Absent → incompatible.

Layer 3 — Unknown. Built-in shaders and Shader Graph outputs without accessible .shader source on disk cannot be assessed. These show in the Materials table. No TS.SO.V003 is emitted for Unknown state.


Limitations

  • Only meaningful when URP or HDRP is the active render pipeline. Built-in render pipeline returns Not Applicable.
  • Shader Graph outputs are typically compatible by default. An Unknown result for a Shader Graph material means the generated source is not accessible — not that it is incompatible.
  • Layer 2 source analysis is a heuristic. A shader that includes UnityPerMaterial but declares it incorrectly may be classified compatible when it is not. Layer 1 is authoritative where available.

Context

SRP Batcher incompatibility affects CPU performance (draw call batching), not rendering correctness. Materials that fail compatibility render normally. The performance cost is each draw call requiring a separate GPU state setup.