Search Issue Tracker

By Design

Votes

4

Found in

2020.3

2020.3.0f1

2021.1

2021.2

Issue ID

1323721

Regression

No

SRP Batcher is not compatible due to property being declared outside of shader property section when it's actually inside it

Shader System

-

How to reproduce:
1. Create a new project using the Universal RP template
2. Import the provided Shader
3. In the Project Window, select the imported Shader
4. In the Inspector, view the provided information

Expected result: There's no message regarding the "shader property section"
Actual result: There's a message that a property is declared outside the "shader property section", thus SRP Batcher is not compatible

Reproducible with: 2020.3.4f1, 2021.1.3f1, 2021.2.0a13
Couldn't test with: 2018.4.34f1, 2019.4.24f1 (user's provided Shader throws errors when downgrading)

  1. Resolution Note:

    Uniforms in the UnityPerMaterial cbuffer have to be declared as properties as well. The error clearly indicates that.

Comments (5)

  1. HexGrimm

    Sep 13, 2021 15:34

    Guys! Seems most of shaders from URP package have the same error. Please check Lit shader in URP 10.5 and Unity 2020.3.12f1

  2. JasonBooth

    Apr 12, 2021 23:08

    Yes, it appears to come from the CBUFFER_START(UnityPerDraw) in ShaderVariables.hlsl which is included.

  3. JasonBooth

    Apr 12, 2021 23:06

    So following this more; there was a misnamed variable in the cbuffer, however, after fixing that I get:

    "The builtin property isn't supported by the SRP Batcher [unity_lightmapindex]"

    However, that string does not exist in this shader - and I would guess is coming from a Unity include. Also, even though several variations of the shader are built from the same source, some show these errors and some don't. (IE: The non-tessellated ones show no errors, even though they had the same misnamed cbuffer variable).

  4. JasonBooth

    Apr 12, 2021 22:45

    But the shader is declared as a property as well, did you even look at the shader?

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.