HLSLMaterial
HLSLMaterial copied to clipboard
Includes are added even if they are guarded by #ifdef-s
When parsing includes in hlsl file all of them are added even if they are guarded by failed #ifdef
#include "header_a.ush"
#ifndef SOMEDEF
#include "header_b.ush"
#endif
Right now both header_a
and header_b
are included and this leads to compilation errors.
Mmh, not sure that's easily fixable.
Where is SOMEDEF defined here? In header_a?
I'd like to make sure I fully understand the context :)
Yes this define is from other header.
It's not that big of a problem right now. As a workaround I do such includes in function body or in other headers.
I don't see easy fix for that and I'm not sure if it's worth fixing.
I've added issue to see what's your stance on this 😃
Hi! Just a thought here, but it would take some refactoring: You could run an external c pre-processor on the file. In gcc, you use -E, and in msdev, it's /P (I think - I haven't done this in a while). There may be a decent c preprocessor that you could build in.
As an aside: How do you set your include paths? I've been trying to figure this out for 2 days and I can't get includes to work - Thanks! Love this thing!
As an aside: How do you set your include paths? I've been trying to figure this out for 2 days and I can't get includes to work
You need to use AddShaderSourceDirectoryMapping
in module that loads in early enough LoadingPhase
like PostConfigInit