#Issue with PROCEDURAL_INSTANCING_ON keyword ONLY on 2022?

1 messages · Page 1 of 1 (latest)

valid arrow
#

Does anyone know if there has been any issues deteted, bugs created related to PROCEDURAL_INSTANCING_ON?
I'm working on a GPU instanced system that draws meshes via RenderMeshInstancedIndirect. It seems that 2021, 6.0, 6.1, 6.2 work directly just fine. But with 2022 I need to add this line to the shader.

#pragma multi_compile PROCEDURAL_INSTANCING_ON

It would be fine if that didn't make the material unsusable outside the GPU Instancing system for that version too. On the other versions, not writing it, allows the material to work standalone and via GPU instancing.
In 2022, not having that line, draws the mesh, but not the shadows

woven storm
#

What about as #pragma multi_compile _ PROCEDURAL_INSTANCING_ON
(with the extra _ to define the off state)

valid arrow
#

Testing further, seems to be Built-in 2022, both URP and HDRP work fine in 2022

valid arrow
#

I was gonna ship with
#if UNITY_VERSION <= 202300 && UNITY_VERSION <= 202200
#pragma multi_compile PROCEDURAL_INSTANCING_ON
#endif

but with URP and HDRP working without it it makes it even weirder

valid arrow
#

This is the same exact code, but on URP

#

AH WAIT

#

I belive I did the changes you recommended the wrong way, testing again seems to work!

#

Let me check all versions and get back

#

2021 working

#

2022 HDRP working

#

2022 URP working

#

2022 Built-in working

#

6.0 working

#

6.2 working

#

Thanks @woven storm ! Why was that a fix?

woven storm
# valid arrow Thanks <@357936113983291393> ! Why was that a fix?

multi_compile lets you define multiple keywords you toggle between. Unity then generates shader variants for each combination of keywords, in this case with procedural on/off.

(But as there's a maximum number of keywords, we can use _ to define those variants without actually using an additional keyword)

Tbh I had no idea if you can just define one keyword. I guess it would just be/act equivalent to #define KEYWORD (always defined/on, unless an #undef is also used)

#

Not sure why it broke only in 2022 Built-in though