Hi!
Last year I made a post about a PR I made for inline shader registration. (Link: [Inline Shader Implementation [Content removed] This got a good amount of attention and the PR went through a decent amount of iteration and discussion and seemed to be something that would be appreciated in the engine. You can find the original PR here (Implementing a new macro to implement a shader inline. by KeithRare · Pull Request #13198 · EpicGames/UnrealEngine).
Unfortunately, this PR got closed due to a new policy around AI, so I created a new PR for the feature that does follow this new policy. You can find this new PR here Inline shader registration by KeithRare · Pull Request #13342 · EpicGames/UnrealEngine.
I have recently updated this PR to work with the newest changes in ue5-main, and I was hoping that it could be picked up again for consideration to be merged into the engine ![]()
The benefits for the feature are:
- A single macro to implement a shader class, rather than 2
- For shader classes that are templates, instantiations can be created at the point of use. They do not have to be explicitly instantiated before they are used. This means that only the instantiations that are actually required are created. Greatly improving the usability of templated shaders.
- Enables the creation of “Shader class factories”. We can get rid of a lot of boilerplate in authoring new shaders by having a single shader class template, that can be parameterized via its template arguments to generate generic shader classes. You can find an example of this in InlineShaderImplementationTests.cpp with the `TTemplatedShaderImplTestShader` template.
Thanks,
Keith