KhronosGroup / KhronosGroup/glslang

layout location not working on output for glsl 330

Open
#3,824 2 comments 0 reactions 0 assignees View on GitHub
bug GLSL/ESSL
Dominant language
C++
Stars
3.6k
Forks
989
Avg merge
1d 2h
Merged PRs (30d)
31

Description

Hello, i have this very simple code (vertex shader) which i want to pass to glslang:
```
#version 330 core

layout(location = 0) in vec3 aPosition;
layout(location = 1) in vec3 aColor;

out vec3 vColor;

uniform mat4 uModel;
uniform mat4 uView;
uniform mat4 uProjection;

void main() {
gl_Position = uProjection * uView * uModel * vec4(aPosition, 1.0);
vColor = aColor;
}

```

I want to compile it to spirv.
but when i do i get:
```
Parser info result: ERROR: 0:6: 'location' : SPIR-V requires location for user input/output
ERROR: 1 compilation errors. No code generated.
```

Then it change to output to:
```layout(location = 0) out vec3 vColor;```

And now i got the error:
```
Parser info result: ERROR: 0:6: 'location qualifier on output' : not supported for this version or the enabled extensions
ERROR: 1 compilation errors. No code generated.
```

So i get the error if i dont specify the location and i get an error if i do specify a location, i am caught in loop 22.
Is this a bug?

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported vertex shader with glslang and the shown GLSL 330 input/output qualifiers, recording the exact compiler options and version. Start by tracing glslang's handling of SPIR-V location requirements and GLSL 330 output qualifiers; done means the behavior is explained and a regression test or clearly documented expected result covers the case.

Written by the indexing model from the issue text.

Assessment

Domain
compilers, computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.