Is it allowed to declare input variable for vertex shader as array type in ESSL 3.2?

Hi, I read about input variable type for vertex shader in GLSL_ES_Specification_3.20

quoting from 4.3.4. Input Variables at P48

It is a compile-time error to declare a vertex shader input with, or that contains, any of the
following types:
• A boolean type
• An opaque type
• An array
• A structure
Example declarations in a vertex shader:

in vec4 position;
in vec3 normal;
in vec2 texCoord[4];

I’m confused with the last example in vec2 texCoord[4];. Does it exemplify an illegal declaration ? Or doesn’t texCoord[4] count as AN ARRAY? Is anyone clear that if it is allowed to declare an array input variable in vertex shader in ESSL 3.20?

If that’s what it says, then that’s what it says. They may have just copied those examples from the GLSL 4.x section.

I’m fairly sure that it’s a copy-paste error. I.e. the examples are of valid declarations, but the texCoord one shouldn’t be there.

Section 11.1.1 (Vertex Attributes) of the OpenGL 4.6 specification says

The same section of the OpenGL ES 3.2 specification starts with similar language, but the “array type” case is absent. This reinforces the normative language of the ES 3.2 Shading Language specification which includes arrays in the list of prohibited types (the GLSL 4.6 specification doesn’t have that restriction).

I do note that (in ES 3.2) glGetProgramResource accepts GL_ARRAY_SIZE as a property in conjunction with GL_PROGRAM_INPUT as an interface, and glGetActiveAttrib has a size parameter. But that’s probably just for compatibility with desktop OpenGL. Presumably the property will always have the value 1, although there’s no actual language which either confirms or contradicts that.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.