Advertisement Jump to content
Sign in to follow this  

Custom preprocessor directives in HLSL

This topic is 4098 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it possible to define a custom preprocessor directive in HLSL? For example, let's say I wanted to make something like:

Can I define a setting in the compiler to execute a certain macro when the given directive is found in a file?

Share this post

Link to post
Share on other sites
FoxHunter2 is correct if you only want conditional compilation of c-style constants, but for anything more elaborate (like true macros or pragmas) you're out of luck with the standard HLSL compiler.

I'm sure there will be other regular text parsing/processing tools that can offer this functionality if you really need it. Ultimately the C/C++ compilers tend to run this stuff as a pre-processing pass before sending it on to the real compiler...


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!