Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Can I have different CBuffer for different pass when enable SRP Batcher?

Discussion in 'General Graphics' started by zhutianlun810, Aug 18, 2021.

  1. zhutianlun810

    zhutianlun810

    Joined:
    Sep 17, 2017
    Posts:
    165
    I am using different keyword for different passes. I have some shader code like:
    Code (CSharp):
    1. CBUFFER_START(UnityPerMaterial)
    2. #if _keyword
    3. ...
    4. #endif
    5. CBUFFER_END
    I find some objects are rendered incorrectly. If I removed #if, #endif from the block of CBuffer(UnityPerMaterial). Everything are rendered correctly.

    I guess that different passes must share same CBuffer to let SRP Batcher works well?