Forums - Adreno 330 GLES3 gl_InstanceID does not work

3 posts / 0 new
Last post
Adreno 330 GLES3 gl_InstanceID does not work
misanthrope
Join Date: 29 Jul 14
Posts: 2
Posted: Fri, 2014-09-12 01:34

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

  • Up0
  • Down0
misanthrope
Join Date: 29 Jul 14
Posts: 2
Posted: Fri, 2014-09-12 01:49

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?

  • Up0
  • Down0
mhfeldma Moderator
Join Date: 29 Nov 12
Posts: 310
Posted: Mon, 2014-09-22 10:31

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. 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.