Reputation: 41
I am currently trying to get pixel information back out of the GPU so it can be processed/saved/fed back through the loop.
To do this, I am attempting to implement transform feedback. I am encountering issues splitting up the GPU's pipeline. This separation of the vertex and fragment shader programs means also separating the compilation and shader program creation. In implementing this, the compiler is giving me catch-22 feedback in which it tells me that if I separate the shaders, then I need to redeclare certain builtin per-vertex variables such as gl_Position.
ERROR: Built-in variable 'gl_Position' must be redeclared before use,
with separate shader objects.
But when I do that it tells me that I'm not allowed to redeclare builtin variables:
highp vec4 gl_Position;
ERROR: 0:1: Regular non-array variable 'gl_Position' may not be redeclared.
I tried redefining gl_PerVertex as in examples I’ve found, but it fails to recognize that gl_PerVertex is a built-in thing:
// Below ins, outs, and uniforms in the vertex shader:
out gl_PerVertex
{
vec4 gl_Position;
float gl_PointSize;
float gl_ClipDistance[];
};
ERROR: 0:1: Identifier name 'gl_PerVertex' cannot start with 'gl_'
Does anyone know specifically which variable(s) to redeclare in the vertex shader for iOS to effectively redeclare gl_Position? Or was something wrong in either of the two things that I already tried?
Upvotes: 2
Views: 913
Reputation: 864
Annoying, and surprisingly little information out there. I managed to resolve this issue with the following defined in my shaders:
#version 300 es
#extension GL_EXT_separate_shader_objects : enable
out highp vec4 gl_Position;
Tested on an iPhone 5S and the simulator.
Upvotes: 0
Reputation: 577
The GLES 3.0 reference pages say that gl_Position is declared as
out highp vec4 gl_Position ;
Maybe the "out" will help.
Upvotes: 1