opengl-esglslglsles

OpenGL ES 3.2 doesn't recognize gl_in in geometry shader


I have the following shader code:

#version 320 es

layout(points) in;
layout(points, max_vertices=1) out;

uniform mat4 transform;

void main() {
    gl_Position = gl_in[0].gl_Position * transform;
    EmitVertex();

    EndPrimitive();
}

But when creating the shader program I get the following error:

'gl_in' : undeclared identifier
'gl_in' : left of '[' is not of type array, matrix, or vector
'gl_Position' : field selection requires structure, vector, or matrix on left hand side
'assign' :  cannot convert from 'const highp float' to 'Position 4-component vector of highp float

But in https://www.khronos.org/registry/OpenGL/specs/es/3.2/GLSL_ES_Specification_3.20.html it explicitly states the existance of gl_in (as a built-in variable).


Solution

  • It is related to Intel UHD graphics not supporting OpenGLES explictly. When I checked what GLSL version was requested it was requesting OpenGL 2.0 which does not support gl_in as a built in.