Implement BEFORE stages for extra control #1857
Draft
+182
−42
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.
This is a relatively naive modification to the existing RenderLevelStageEvent system to implement an additional set of BEFORE stages. The goal is to give more control over geometry rendering at a per-rendertype level. For example, currently, it is rather difficult to render translucent non-chunk based geometry (e.g. the contents of a multi-block tank which spans multiple chunks) as the current events are fired after the game has already rendered to the appropriate buffers, breaking depth sorting and blending.
Admittedly, it is likely that this would then introduce the reverse issue: geometry rendered by a mod will interfere with vanilla geometry (hence my opening of this PR as a draft) but providing these hooks should in theory provide for more control while fitting into the constraints of the existing system.
I think that going forward we need to completely redesign this interface, instead giving modders access to the FrameGraphBuilder in order to configure their own render passes. However, this will need a lot more thought as the frame graph is intended to be a DAG where resources are only written once.