The fix for “#pragma directives in .hlsl files are not being ignored when #include is used” got backported to LTS.
I’d like to ask: Why?
Sure, beta makes sense. But why LTS?
The fix for “#pragma directives in .hlsl files are not being ignored when #include is used” got backported to LTS.
I’d like to ask: Why?
Sure, beta makes sense. But why LTS?
I’m confused. The point of LTS is that nearly all bug fixes get backported to them, else they won’t be LTS.
It’s a fix, a valid fix. But that one causes problems for a lot of people including Asset Store publishers and implicitly the customers. This fix breaks more than it fixes
Was that really necessary?
I see - yes a fix that causes unintended side effects (causes any other regression) probably is not safe for LTS.
Hi!
We were under an impression it was a regression, but it looks like it worked this way since 2021.3.0f1.
We’ll revert it.
Sorry for the inconvenience.
The fix will be available in 2022.3.27f1.
Hey, are there cases where you don’t want pragmas to be included? I just wondering, maybe I miss someting.
Isn’t using simple #include just lead to more issues if we actually have pragmas in your files? In my oppinion #include sould work as #include_with_pragmas, and maybe to have one to not include pragmas (but as I said I can’t think of such cases)
The issue is not with how it should be but how it has been for many years and how changing this now in a minor LTS release breaks thousands of projects and Asset Store assets.
Yes, there are. And that’s why there’s #include_with_pragmas in the first place.
Sadly, it turns out it was broken for a very long time (2021.3.0f1 had it broken already), so it didn’t work as intended - ShaderLab #pragma directives from regular include files were reported as well.
We’ll keep this behaviour in 2021.3 and 2022.3, but Unity 6 will have it as specified in the manual.
We’ll fix the manual for 2021.3 and 2022.3 as well.
I’m an asset store store developer, working on shaders, nothing I haven’t seen in the past few months in a minor LTS version
I’m actually wondering why this release doesn’t get pulled. It costs so much more than what it brings.
First time I see #include_with_pragmas I will be changing my includes with that. Since 2019.X #include was the way I was doing it and it worked until I updated to 2022.3.26, which made me think that version was bugged. I will be using and replacing old #include with #include_with_variants.
Where is it written in the docs? I want to see If I’m missing other stuff.
Edit:
I just tried using #include_with_variants “somefile.hlsl” inside both a HLSLPROGRAM and CGPROGRAM and it doesn’t work when #include does. It throws the following error:
Shader error in 'Some shader': invalid preprocessor command 'include_with_variants' at SomeShader.shader(29) (on d3d11)
@forestrf it’s #include_with_pragmas
, not #include_with_variants
Unity 2019 didn’t look for pragmas in the included files at all.
Thank you. #include_with_pragmas
is working perfectly, I couldn’t see the misspelling I made.