So with the latest render graph API we need to have some sort of PassData private class defined in a pass, and I want to understand why the API is designed like this.
Since PassData is private, and the instantiated render graph pass has the PassData as internal, then it means other passes cannot access the PassData. It seems the only way to communicate data between passes is the ContextContainer or some other hacky way.
The usage of the PassData, aside being allocated from an object pool, seems just to be a parameter passed to the render func.
This makes me wonder why we need the PassData in the first place? Why bother to create a dedicated class rather than declare the resources directly as the pass’s member fields?
It probably prevents creating a closure allocation for lambda capture, but is it the only reason?
In Unreal there’s a similar concept of Shader Parameter Struct, but that struct acts as access declaration and a template for binding resources in shaders so it has to be allocated by the render graph. However in Unity the PassData doesn’t do these, so I don’t see the point of it being allocated by render graph.
Anyway I’m just curious about the design choice.