Open Xottab-DUTY opened 3 years ago
I'm not sure anymore how XSC treats the sample
keyword but since it's already used as an interpolation modifier, I suggest to avoid using this name for both functions and variables. HLSL has a weird case where sample float sample : Sample
is a valid declaration but sample float sample : sample
confuses DXC while FXC accepts it. This is one of many examples in which HLSL lacks a clear definition.
i suggest to avoid using this name for both functions and variables.
Unfortunately, it is not possible, we need to compile unmodified shaders. 🙁 It seems we will need to patch some existing cross-compiler or to write our own. 🙃
HLSL has a weird case where
sample float sample : Sample
is a valid declaration butsample float sample : sample
confuses DXC while FXC accepts it. This is one of many examples in which HLSL lacks a clear definition.
Interesting case... Thank you 😃
Unfortunately, it is not possible, we need to compile unmodified shaders.
In that case, I suggest to add another token type like InterpModifierOrIdent
alongside InterpModifier
just for the keyword sample
and handle it at places like this one.
I see you already considered ShaderConductor/DXC for your purpose. I would recommend that compiler toolchain as its more advanced and has a strong support from Microsoft and Google. Only downside is that it's a much larger code base and not a small single library project, i.e. it takes some effort to integrate it into a graphics pipeline.
Cannot use certain words when naming a function or variable.
XSC fails, allowed in FXC.
Example shader:
Error log: