Split Materialpipeline - shader code into two files #18549
+2,257
−1,713
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This is one part of the material shader refactoring neccesary for RFC 152 (Support for multiple Material-Types in Raytracing Hit Shaders).
This PR adds the field
"materialShaderDefines": "BasePBR_Defines.azsli"
to the abstract materialtype, that will be included by the materialpipeline - shaders before any other files.This allows us to define Pipeline-Callbacks, that are provided by the rendering-pipeline, and need a full definition of the material-defined structs and SRGs, but that are used in the material-defined functions.
With these Pipeline-Callback we can somewhat separate the material-functions from the rendering pipeline, which is necessary to use the materials in a raytracing-shader or a deferred pipeline.
Specific example from
BasePBR_VertexEval.azsli
:previously:
new:
Since i had to change the existing shader - templates, this will break custom materials.
Custom materials that use the Material - canvas will work, but the shader-code needs to be recreated by the MaterialCanvas - Editor.
How was this PR tested?
Make sure all shaders from the engine compile, and everything still looks the same.
Tested with vulkan on windows.