Closed orels1 closed 11 months ago
Sometimes there is a need to include a whole Template section per-shader conditionally.
E.g. a special pass for a shader that needs it.
While it can be done with PrePasses and PostPasses that is very limited as it doesn't utilize the actual template logic (although maybe it should!
PrePasses
PostPasses
A solution to this could be created in a form of Template Features.
Template Features
E.g. you add a block to the template that looks something like this
%TemplateFeature("MyFeature") { // some feature code } %TemplateFeature("MyOtherFeature") { // some feature code }
And then in the shader code you simply add
TemplateFeatures("MyFeature", "MyOtherFeature")
And that automatically includes those scoped blocks in the main template before it gets processed.
An example of this used in practice is a conditional Depth PrePass for shaders that need it
Sometimes there is a need to include a whole Template section per-shader conditionally.
E.g. a special pass for a shader that needs it.
While it can be done with
PrePasses
andPostPasses
that is very limited as it doesn't utilize the actual template logic (although maybe it should!A solution to this could be created in a form of
Template Features
.E.g. you add a block to the template that looks something like this
And then in the shader code you simply add
And that automatically includes those scoped blocks in the main template before it gets processed.
An example of this used in practice is a conditional Depth PrePass for shaders that need it