Error c5121 wile creating Minecraft shaders
  • charli55
    -- Veteran Member --
    -- Veteran Member --
    Posts: 303
    Joined: Wed Feb 19, 2020 12:29 pm

    Error c5121 wile creating Minecraft shaders

    by charli55 » Tue May 12, 2026 8:10 am

    keep getting error

    c5121 multiple bindings to output semantic "ATTR1"

    while trying to create a shader for Minecraft with the latest version of iris and fabric.

    this is my code:

    #version 330 compatibility
    #extension GL_ARB_separate_shader_objects : enable

    out vec2 lmcoord;
    out vec2 texcoord;
    out vec4 glcolor;
    out vec3 normal;

    uniform mat4 gbufferModelViewInverse;

    /* DRAWBUFFERS:012 */

    layout(location = 0) out vec4 color;
    layout(location = 1) out vec4 lightmapData;
    layout(location = 2) out vec4 encodedNormal;

    void main() {

    gl_Position = ftransform();
    texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
    lmcoord = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy;
    lmcoord = (lmcoord * 33.05 / 32.0) - (1.05 / 32.0);
    glcolor = gl_Color;
    normal = gl_NormalMatrix * gl_Normal;
    normal = mat3(gbufferModelViewInverse) * normal;
    lightmapData = vec4(lmcoord, 0.0, 1.0);
    encodedNormal = vec4(normal * 0.5 + 0.5, 1.0);

    }

    has to do with lightmapData = vec4(lmcoord, 0.0, 1.0);
    and layout(location = 1) out vec4 lightmapData;
    because when I delete them it works just fine. I’m on windows ten with a gtx 1660ti with updated drivers.


  • User avatar
    Zeero
    -- Veteran Member --
    -- Veteran Member --
    Posts: 156
    Joined: Fri Sep 10, 2021 12:41 pm

    Re: Error c5121 wile creating Minecraft shaders

    by Zeero » Tue May 12, 2026 9:20 am

    The c5121 message usually pops up when two outputs end up sharing the same location, even if the code doesn’t make that obvious. I’d try giving each out variable a manual layout location to force the linker to stop guessing. Something like layout(location = 0) for texcoord, 1 for lmcoord, etc. I had fewer headaches doing that while working on shaders for a map I grabbed through ModsCraft.

Who is online

Users browsing this forum: No registered users and 4 guests