fix(patcher): force core profile on the lines program#3159
Conversation
On macOS (OpenGL 4.1 Metal, core-profile only), any shader pack that provides a gbuffers_line shader fails to build after 1.10.8: ShaderCompileException: lines: ERROR: 0:1: '' : #version The patched lines program is emitted as `#version 330 compatibility`, which Apple's core-profile driver rejects. Root cause: TransformPatcher routes line shaders through VanillaCoreTransformer via the `isLine` branch regardless of their declared profile. The `else` branch (standard non-core shaders) explicitly sets `versionStatement.profile = CORE`, but the `if` branch (core / null / isLine) does not. When `isLine` is the sole reason for entering the branch and the incoming profile is COMPATIBILITY, it survives unchanged to the driver output. Fix: guard with a targeted profile correction immediately after the version number bump and before the transformer switch. This ensures line shaders always emit a core profile, matching the intent of the VanillaCoreTransformer path.
|
this is technically a shaderpack issue, afaik gbuffers_line is meant be written in core, and not compatibility. since it is 1.17+ only |
Thanks for taking a look! I actually agree line shaders should be core on 1.17+ — that's exactly why I think this belongs in the patcher and not the pack. A few things rule out a shaderpack-side fix:
Net: on core-only drivers (macOS GL 4.1), the patcher currently emits the lines program as |
Summary
On macOS (OpenGL 4.1 Metal — core-profile only), enabling any shader pack that provides a
gbuffers_lineshader fails after 1.10.8:The patched
linesprogram is emitted as#version 330 compatibility, which Apple's core-only driver rejects, so the entire pipeline is disabled. Regression between 1.10.8 (emitted#version 330) and 1.10.9.Reproduced on: macOS 27.0, Apple M5, MC 26.1.1, Sodium 0.8.9, with both IterationV and stock Complementary Reimagined r5.8.1.
Root cause
TransformPatcherroutes line shaders throughVanillaCoreTransformervia theisLinebranch regardless of their declared profile. Theelsebranch (standard non-core shaders) explicitly setsversionStatement.profile = Profile.COREat line 175, but theifbranch (profile == CORE || version >= 150 && profile == null || isLine) does not.When
isLineis the sole reason for entering the branch and the incoming shader has#version 330 compatibility, the profile is never updated — socompatibilitysurvives to the driver output.Fix
One targeted guard, inserted after the version-number bump and before the transformer switch:
This ensures line shaders always emit a core profile, matching the intent of the
VanillaCoreTransformerpath.Testing
lines: ERROR: 0:1: '' : syntax error: #version; shaders disabled on loadlines.vshemits#version 330 core; pipeline builds; shaders load in overworld and End