Imagination PowerVR SDK Blog

Possible bug in Android PVR SDK ?


#1


This is the basic pfx shader code which works just fine in my windows emulator and also on iPhone device.



On PVR Android, I am getting a error message

"TEXTURE basetex missing matching UNIFORM in [EFFECT] on line 54"



Can someone tell me what this problem is ????







[HEADER]

     VERSION          01.00.00.00

     DESCRIPTION texture example

     COPYRIGHT     VirtualMaze Avighna

[/HEADER]



[TEXTURES]

     FILE basetex      Basetex.pvr          LINEAR-LINEAR-LINEAR

[/TEXTURES]



[VERTEXSHADER]

     NAME           VertexShader



     // LOAD GLSL AS CODE

     [GLSL_CODE]

          attribute highp vec3 inVertex;

          attribute highp vec3 inNormal;

          attribute highp vec2 inTexCoord;



          uniform highp   mat4 WVPMatrix;



          varying mediump vec2   TexCoord;

          varying highp vec3 PosTexC;

          

          void main()

          {

               gl_Position = WVPMatrix * vec4(inVertex + inNormal*0.0001,1);               

               TexCoord = inTexCoord;     

               PosTexC = inVertex;

          }

     [/GLSL_CODE]

[/VERTEXSHADER]

    

[FRAGMENTSHADER]

     NAME           FragmentShader



     // LOAD GLSL AS CODE

     [GLSL_CODE]

          uniform sampler2D sBaseTex;

          //uniform samplerCube sBaseTex;



          varying mediump vec2   TexCoord;

          varying highp vec3 PosTexC;

          

     

          void main()

          {

               gl_FragColor.rgba = texture2D(sBaseTex, TexCoord).rgba;                    

               //gl_FragColor.rgb = textureCube(sBaseTex, PosTexC).rgb;          

          }

     [/GLSL_CODE]

[/FRAGMENTSHADER]



[EFFECT]

     NAME      Effect

          

     // GLOBALS UNIFORMS

     UNIFORM WVPMatrix                WORLDVIEWPROJECTION

     UNIFORM     sBaseTex               FTEX_IDX0



     // ATTRIBUTES

     ATTRIBUTE      inVertex     POSITION

     ATTRIBUTE     inNormal     NORMAL

     ATTRIBUTE     inTexCoord     UV



     VERTEXSHADER   VertexShader

     FRAGMENTSHADER FragmentShader

     TEXTURE 0 basetex

[/EFFECT]


#2

Hi mkandula.





In the latest SDK PFX semantics have been moved to tools code, so the semantic TEXTURE[0-n] should be used instead of your own FTEX_IDX0 as PFX doesn’t know what this semantic is, hence the error.





To correct your error change to the following code:





Code:

     // GLOBALS UNIFORMS
     UNIFORM WVPMatrix               WORLDVIEWPROJECTION
     UNIFORM     sBaseTex              TEXTURE0

#3

Yes…I just got that figured out an hour ago…also I was using the older SDK for windows EMULATOR. With the newer SDK the bug is reproduced on the windows EMULATOR as well.





Thanks for the reply !!