sodium-fabric icon indicating copy to clipboard operation
sodium-fabric copied to clipboard

Tracking issue for improved extensibility by mods like Iris

Open jellysquid3 opened this issue 2 years ago • 0 comments

Per a conversation with @coderbot16 on Discord...

  • [x] Add the missing OpenGL enum values to our own typed enums. i.e. GL_GEOMETRY_SHADER and other values for the ShaderType enum (Relatively easy, helps avoid fragile mixins in other mods. This is a good first issue too, for anyone who wants to take it up.)

  • [x] Move implementation-specific logic out of ShaderChunkRenderer, and don't directly reference a concrete program interface type from it. We should add a type argument to ShaderChunkRenderer which defines the program interface type, and just make it a simple shader cache. (This work is already being done with the GPU-driven occlusion culling code, but I'm not certain if that code will make it into mainline.)

  • [x] Chunk renderers should not set up draw calls themselves, but rather be passed the built list of draw calls and resources. This makes caching more performant and would move a lot of logic out of the chunk renderer code. (See above point.)

  • [x] Chunk renderer construction should be done in a static method so that other mods can replace it more easily via mixins. In the future, we probably want a proper interface that mods can register, and give users a graphical UI to select which renderer they want to use. (Trivial change, but the second part is much more work and not something we want to focus on right now.)

  • [ ] Some kind of mechanism for more nicely using custom vertex formats in chunk building. This is currently a mess in the current codebase since we hardcode the vertex format in a few places. This should be supplied during renderer initialization. Additionally, the geometry builder (i.e. BlockRenderer and FluidRenderer) should not directly access the vertex sink, but rather pass the entire quad's data to an abstraction which then writes it out to a geometry sink. This would allow other mods (notably Iris) to compute additional information, like the quad normal, for each vertex before writing it out to a sink.

jellysquid3 avatar Jan 17 '22 20:01 jellysquid3