google / google/shaderc

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

Open
#1,517 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
2.2k
Forks
445
Avg merge
11h 6m
Merged PRs (30d)
6

Description

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:

```glsl
#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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.