leon-o / iris-flw-compat

Enable Flywheel's optimizations when using shaderpacks.
MIT License
49 stars 25 forks source link
minecraft-mod

Logo

Iris & Oculus Flywheel Compat
CF Supported Versions Modrinth Downloads License

Iris & Oculus Flywheel Compat

Allow Flywheel instancing optimization to be enabled when using iris.

Principle

Flywheel uses a method called GPU Instancing to render entities. It is very efficient when rendering a large number of repeating entities (e.g. gears in Create mod). But when you use iris and enable shaderpack, this optimization is disabled. Because flywheel needs to use its own shader to render these entities and flywheel's shader will no longer work when you enable shaderpack.

This mod will automatically merge flywheel's shader with the shader in shaderpack when shaderpack is enabled to be able to render entities using Instancing.

When you have a large number of entities to render, there is a huge CPU bottleneck with the original rendering method.

Implementation details

This mod replaces the ProgramCompiler::getProgram method. When Flywheel trys to generate shaders, this mod will merge the shader generated by flywheel with the gbuffer_block shader in the shaderpack.

Credit

This project uses the glsl-transformer to transformer the shaders.