Dear colleagues,
could you please check the following issue:
I`m trying to make instance rendering on adreno 330
( i actually tried Nexus 5 with Andoird 4.4.4, Galaxy S5 G900F, LG G2 ) and it fails
to use gl_InstanceID with the following shader
#version 300 es
layout(location = 0) in vec4 av4position;
layout(location = 1) in vec3 av3normal;
layout(location = 2) in vec3 av3uvw;
out vec3 vNormal;
out vec3 vViewVec;
out vec3 UVW;
uniform mat4 Model;
uniform mat4 MShip[2];
layout(std140) uniform GShaderData {
mat4 Projection;
mat4 View;
mat4 Ortho;
vec4 eyePosition;
vec4 data;
};
void main() {
int instanceID = gl_InstanceID;
vNormal = av3normal;
gl_Position = Projection*View*MShip[instanceID] * av4position;
UVW = av3uvw;
vViewVec = vec3(5,5,0) - av4position.xyz;
}
The shader always returns instanceID as 0
The same shader on G900H (based on powerRX) works fine.
Thank you in advance for your help
just found out that :
void main() {
int instanceID = gl_InstanceID;
mat4 testM = MShip[instanceID];
vNormal = av3normal;
gl_Position = Projection*View*testM * av4position;
if used by this - it works fine ...
Is this made on purpose, or it`s some compilator bug?
We've done some testing here on a few devices, but can't reproduce. Could you provide an apk with the exact shader that is causing problems? It's possible it could be a shader compiler problem.