Search Issue Tracker
Fixed in 2023.1.0a23
Fixed in 2022.2.X, 2022.2.2f1, 2023.1.X
Votes
8
Found in
2022.2.0b2
Issue ID
UUM-20505
Regression
Yes
[Shader Graph] Shader instance property gets added to CBUFFER, which causes GPU instancing with instanced properties to not work
Steps to reproduce:
1. Open the attached user's project "HDRP Tests.zip"
2. Open the "Assets/OutdoorsScene.unity" Scene
3. Open Frame Debugger
4. Enter Play Mode
5. In the Frame Debugger, enable it and one of the Draw Mesh calls
6. Observe it no longer getting instanced and message "Non-instanced properties set for instanced shader"
Expected results: Shader instance property gets correctly declared using UNITY_DEFINE_INSTANCED_PROP and GPU instancing works
Actual Results: Shader instance property gets added to CBUFFER, which causes GPU instancing with instanced properties to not work
Reproducible on: 2022.1.11f1, 2022.2.0b2, 2023.1.0a4
Not reproducible on: 2021.3.8f1
Could not test on 2020.3.37f1 and below 2022.1.0f1 due to project errors when downgrading or shader compilation errors
Notes:
-The test project spawns 20k instances of a model, and a shader graph shader that uses instance properties to modulate their emissive intensity on a per-instance basis using SetPropertyBlock(). The property is defined in the shader blackboard as "shader declaration = hybrid per instance". The material is set to enable GPU instancing
-This works correctly in 2021.3, all the instances got GPU instanced, and drawn in a few dozen passes (see images "Screenshot A 1.png" and "Screenshot A 2.png")
-However, in 2022.1.x, this no longer works and each individual building gets drawn in its own draw call, resulting in more than 10,000 passes (see images "Screenshot B 1.png" and "Screenshot B 2.png")
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Font character thickness does not adjust properly in UI Toolkit text when changing Bold Weight in Font Asset
- Multiple "[...] is inaccessible due to its protection level" errors are thrown when opening project with Unity Version Control installed
- Sorting icons are tiny and misaligned in Import Activity window
- The Undo system does not record HideFlags.HideInHierarchy changes
- [Linux] Bug Reporter window is in Light mode when the Editor theme is Dark mode
Resolution Note (fix version 2023.1):
Replaced the hardcoded dots defines in our property collector to use the defines provided by UnityInstancing.cs
Resolution Note (fix version 2022.2):
Backported this fix from the 2023.1 development branch. Should land in time for 2022.2.0f1.