-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Support #define in shader preprocessor #7494
Copy link
Copy link
Closed
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-FeatureA new feature, making something new possibleA new feature, making something new possible
Description
What problem does this solve or what need does it fill?
if we have 3 shader files common.wgsl, util1.wgsl, util2.wgsl, and if both util1.wgsl and util2.wgsl includes common.wgsl, then if the main shader file include both util1.wgsl and util2.wgsl, it will cause a problem, because function re-definition (i.e. common.wgsl imported twice).
What solution would you like?
one solution would be to support #define in the shader preprocess (i.e. define a label used for #ifdef #ifndef). Then we can write an include guard similar to the include file in C.
What alternative(s) have you considered?
there could be several other method,
- have
#import oncedeclarative indicate this file should only be imported once. - bevy preprocessor automatically remove the duplicate function (however, how to define duplicate function is questionable)
- do nothing, and let user keep track of import and make sure no duplicate imports happen.
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-FeatureA new feature, making something new possibleA new feature, making something new possible