0
\$\begingroup\$

I just can't understand this. The code works perfectly on the emulator(Which is supposed to give more problems than phones…), but when I try it on a LG-E610 it doesn't compile the vertex shader. This is my log error(Which contains the shader code as well):

EDITED

Shader:

uniform mat4 u_Matrix;

uniform int u_XSpritePos;
uniform int u_YSpritePos;
uniform float u_XDisplacement;
uniform float u_YDisplacement;

attribute vec4 a_Position;
attribute vec2 a_TextureCoordinates;

varying vec2 v_TextureCoordinates;

void main(){
    v_TextureCoordinates.x= (a_TextureCoordinates.x + u_XSpritePos) * u_XDisplacement;
    v_TextureCoordinates.y= (a_TextureCoordinates.y + u_YSpritePos) * u_YDisplacement;

    gl_Position = u_Matrix * a_Position;
}

Log reports this before loading/compiling shader:

11-05 18:46:25.579: D/memalloc(1649): /dev/pmem: Mapped buffer base:0x51984000 size:5570560 offset:4956160 fd:46
11-05 18:46:25.629: D/memalloc(1649): /dev/pmem: Mapped buffer base:0x5218d000 size:5836800 offset:5570560 fd:49

Maybe it has something to do with that men alloc? The phone is also giving a constant error while plugged: ERROR FBIOGET_ESDCHECKLOOP fail, from msm7627a.gralloc

Edited: "InfoLog:" refers to glGetShaderInfoLog, and it's returning nothing. Since I removed the log in a previous edit I will just say i'm looking for feedback on compiling shaders.

Solution + More questions: Ok, the problem seems to be that either ints are not working(generally speaking) or that you can't mix floats with ints. That brings to me the question, why on earth glGetShaderInfoLog is returning nothing? Shouldn't it tell me something is wrong on those lines? It surely does when I misspell something.

I solved by turning everything into floats, but If someone can add some light into this, It would be appreciated. Thanks.

\$\endgroup\$
  • \$\begingroup\$ I think you need to post more specific error, since I doubt anyone would like to go through all this log. \$\endgroup\$ – concept3d Nov 5 '13 at 19:10
  • \$\begingroup\$ E/Adreno200-ES20(1649): <qgl2DrvAPI_glAttachShader:403>: GL_INVALID_VALUE might be something. Try to narrow your problem down to something a bit more specific. Your shader program isn't linking. This could be something specific with the drivers to the phone. Make sure the your phone supports the functionality you're implementing. Try contacting the phone manufacturer for more support. \$\endgroup\$ – MichaelHouse Nov 5 '13 at 19:22
  • \$\begingroup\$ @concept3d Last edit clarifies? \$\endgroup\$ – Project Dumbo Dev Nov 5 '13 at 19:50
  • \$\begingroup\$ @Byte56 That's because you can't attach a shader if you haven't compile it previously. I removed that log thing for not getting ppl confused. \$\endgroup\$ – Project Dumbo Dev Nov 5 '13 at 19:51
  • 1
    \$\begingroup\$ "That brings to me the question, why on earth glGetShaderInfoLog is returning nothing" -- Use glGetProgramInfoLog for linking errors. Also keep in mind that GLSL compilers are not standardized regarding error output or diagnostic quality. \$\endgroup\$ – Sean Middleditch Nov 6 '13 at 0:01
0
\$\begingroup\$

I've tried that same shader program in other mobile devices and it works. Apparently, compiling issues like that one, have to do with the GPU drivers installed on the device, and the way it handles the compiling. So, if you want compatibility with all devices, just stick to correct programming and don't mix var types, although it is supposed to work.

Apart from that, Casting/Conversion in glsl does work but done this way:

float(int_var);

In posterior versions of glsl there are other functions to make this happen.

My source: glsl version 1.10

why on earth glGetShaderInfoLog is returning nothing? Shouldn't it tell me something is wrong on those lines?

No It doesn't have to if it is not programmed to, as Sean Middleditch said, it is not standardized.

\$\endgroup\$
  • \$\begingroup\$ Implicit type conversion is not supposed to work. It probably works on the emulator as that likely just passes through to the underlying desktop GL driver and full GL does support implicit type conversion in shaders. GLES does not. The doc you're linking is the wrong version of GLSL for an entirely different version of OpenGL. You want khronos.org/registry/gles/specs/2.0/… (for GLES 2.0) or khronos.org/registry/gles/specs/3.0/… (for GLES 3.0). \$\endgroup\$ – Sean Middleditch Nov 6 '13 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.