Skip to content

shaderc internal error: ID <11> (OpVariable) Scalar boolean must be in a Block. %gl_PrimitiveID = OpVariable %_ptr_Input_int Input #1517

@StefanPoelloth

Description

@StefanPoelloth

Compilation of the following shader fails with this error:

shaderc: internal error: compilation succeeded but failed to optimize: According to the Vulkan spec BuiltIn PrimitiveId variable needs to be a either a boolean or an array of booleans.ID <11> (OpVariable) Scalar boolean must be in a Block.
  %gl_PrimitiveID = OpVariable %_ptr_Input_int Input

To reproduce use this shader:

#version 460
#pragma shader_stage(fragment)
#extension GL_EXT_mesh_shader : require

layout(location = 0) out float TestOut;
layout(location = 0) perprimitiveEXT flat in float Test;

void main()
{
    TestOut = gl_PrimitiveID;
}

and compile with glslc --target-env=vulkan1.4 -O shader.glsl

Additional Info:

~$ glslc --version
shaderc v2023.8 v2025.3
spirv-tools v2025.3 v2022.4-833-g33e02568
glslang 11.1.0-1253-gefd24d75

Target: SPIR-V 1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions