compile error

Hi,


I tested version 1.16 on Galaxy S, Transformer TF101, Xperia arc SO-01C.


It works, but it doesn’t work on Galaxy NEXUS.





1. Push menu button.


2. Select model “Megurine Luka piron”. (It doesn’t work.)


3. Select model “Megurine Luka M2 student 18”.


Android OS reboots.





http://chototsumoushinp.dip.jp/miku/download/AndroidSample_tinyar-116-rc2.apk





Thanks.

Hi,


Ver1.16-rc2 works on Galaxy S, Galaxy Tab(SC-01C), but it doesn’t work on Galaxy NEXUS, EPSON MOVERIO(PowerVR SGX530).


http://chototsumoushinp.dip.jp/miku/download/AndroidSample_tinyar-116-rc2.apk





I changed my shader:





[Ver1.16rc2]


uniform mat4 m_BoneMatrices[50];


[Ver1.17-b2]


uniform mat4 m_BoneMatrices[15];





http://chototsumoushinp.dip.jp/miku/download/AndroidSample_tinyar-117-b2.apk





A compile error happens again on EPSON MOVERIO, but no compile error happens on Galaxy NEXUS.





I only changed array size.


Why does the compile error happen on EPSON MOVERIO?





Thanks.


Hi chototsu.


This is a strange problem. I’ve run your application and can’t seem to reproduce the compile error and unfortunately we don’t have any Epson Moverios to test this on.





One thing that I would like to mention is that you may wish to check the maximum amount of uniforms available to pass to the vertex shader as you may be overrunning the limit by passing 50 mat4s. This can be performed as follows:





Code:

GLint numVecs;
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &numVecs);



This returns the maximum number of 4-component vectors so you'll need to calculate how much space your matrices are taking up in regards to the size of vectors.



Obviously this isn't the compile error issue but it may cause problems on older devices such as the Galaxy S and Nexus S.

Hi Arron.


Thank you for your fast reply.


I read this and changed it from 20 to 50.


https://www.imgtec.com/forum/forum_posts.asp?TID=962


I read your advice and changed it to calculate the size at run time.


I send this to the user who reported the problem.


http://chototsumoushinp.dip.jp/miku/download/AndroidSample_tinyar-118b7.apk


I will report the result from him.





Thanks.


Hi Arron.


Ver.118b7 works on Galaxy NEXUS, but some textures are not displayed.


Ver.118b7 doesn’t work on GALAXY Tab SC-01C, a compile error occurred.


I only changed uniform size in my shader.


Why does the compile error happen on SC-01C?





Thanks.

Hi,


Sorry, I made a mistake in b118b7.


I used too many shaders in it.


I’ll fix it and send it to the user again.


Thanks.


Hi chototsu.


Unfortunately the Galaxy Tab doesn’t contain PowerVR hardware so it would be hard for us to debug this device. However if you’ve managed to fix this issue then I’m glad you found the problem.

Hi,


Finally it works!





My skinning code




attribute vec2 inBoneWeight;

attribute vec2 inBoneIndex;

#ifdef USE_HWSKINNING

void Skinning_Compute(inout vec4 position, inout vec4 normal){

//    vec4 index = inBoneIndices;

    vec2 index = inBoneIndex;

    vec2 weight = inBoneWeight;



    vec4 newPos;

    vec4 newNormal;



    //for (float i = 1.0; i < 2.0; i += 1.0){

        mat4 skinMat;

#if NUM_BONES != 1

        if (weight.x == 1.0) {

            skinMat = m_BoneMatrices[int(index.x)];

            newPos    = (skinMat * position);

            newNormal = (skinMat * normal);

        } else if (weight.x == 0.0) {

            skinMat = m_BoneMatrices[int(index.y)];

            newPos    = (skinMat * position);

            newNormal = (skinMat * normal);

        } else {

            skinMat = m_BoneMatrices[int(index.x)];

            newPos    = weight.x * (skinMat * position);

            newNormal = weight.x * (skinMat * normal);



            skinMat = m_BoneMatrices[int(index.y)];

            newPos    = newPos + weight.y * (skinMat * position);

            newNormal = newNormal + weight.y * (skinMat * normal);

        }

#else

            skinMat = m_BoneMatrices[0];

            newPos    = (skinMat * position);

            newNormal = (skinMat * normal);

#endif

        //index = index.yzwx;

        //weight = weight.yzwx;

    //}



    position = newPos;

    normal = newNormal;

}

#endif





Case 1:

inBoneWeight = vec2(0.5, 0.5)

inBoneIndex = vec2(1, 2)



It works.



Case 2:



inBoneWeight = vec2(1.0, 0.0)

inBoneIndex = vec2(1, 2)



It works.



Case 3:



inBoneWeight = vec2(1.0, 0.0)

inBoneIndex = vec2(1, -1)



It doesn't work on Galaxy NEXUS(but it works fine on Tegra2).





I think that if weight.x == 1.0, the shader doesn't get m_BoneMatrices[-1].

However, Galaxy NEXUS seems to always get m_BoneMatrices[-1].



The latest version of my application is here.

It works on Galaxy NEXUS, MOVERIO,

http://chototsumoushinp.dip.jp/miku/download/AndroidSample_tinyar-118b21.apk



Thanks.



P.S.

I think that Galaxy Tab SC-01C contains PowerVR SGX540 200MHz.

Is it wrong nformation?

Hi,


I removed “if” in my skinning code.


http://chototsumoushinp.dip.jp/miku/download/AndroidSample_tinyar-118b22.apk


Thanks.


Hi chototsu.


Apologies - The Galaxy Tab does indeed contain PowerVR hardware.





I’ll take a look at 118b22.

Hi again chototsu.


I noticed that you have GL_SCISSOR_TEST enabled throughout your application but the scissor coordinates are the same as the viewport coordinates. Using glScissor isn’t an optimal function to use and I’m not sure you need it enabled anyway.





We usually recommend developers to instead use the stencil buffer but I can’t see why you’re using scissoring anyway so if you can disable this you may get a performance increase.

Hi Arron.


Thank you for your advice.





Because my application uses a customized version of jMonkeyEngine3.


http://hg.sourceforge.jp/view/mikumikustudio/MikuMikuStudio/


It supports multi viewports.


However this application doesn’t use multi viewports.


I removed GL_SCISSOR_TEST.


http://chototsumoushinp.dip.jp/miku/download/AndroidSample_tinyar-118b23.apk





Thanks.

Hi again chototsu.


I’ve profiled your application again and we are still seeing huge amounts of CPU usage and little GPU usage.





If you are looking at improving performance I recommend looking into CPU profiling to see where all the CPU cycles are being taken up.





We are seeing per frame, approximately 10% of the time is taken up by the GPU while the 90% is taken by the CPU.





Is your code base solely Android or can you build for other platforms such as generic X86 Linux?





Best regards.

Hi.


My game engine supports many OS(Windows, Linux, MacOSX, Solaris, Android) and many architectures(x86, ppc, arm, mips).





The CPU usage is very low on Windows, but it’s very high on Android because Dalvik is very slow.


I moved skin morphing code from java to C++ after 118b9.


It improved performance.





performance(118b22)


ASUS Transformer TF101:


model fps(motion and physics on, motion and physics off)


Hatsune Miku                   50,60


Kagamine Rin, Ren, pawn 60,60


Sakune Meiko                  50,50


Megurine Luka piron        22,22





MacBook Pro AMD Radeon 6750M:


Hatsune Miku                 1300,1300


pawn                             1700,1700


Megurine Lika piron        350,400





I think GPU usage > CPU usage except Hatsune Miku.


But is the GPU usage only 10%?


Hmm, it’s strange.


I’ll investigate the cause.





Thanks.


Hi chototsu.


Do you think you could provide me with a Linux X86 32bit build of your application which also uses OpenGL ES 2.0? I may be able to get some further information if you could build this.





Thanks.Arron2012-02-28 11:30:09

Hi Arron.


My game engine uses OpenGL 2.x on Linux.


it doesn’t support OpenGL ES2.0, still are you all right?


It uses LWJGL library for using OpenGL API. http://lwjgl.org/


All shaders are same and it doesn’t use fixed-function.





Java Web Satart demo is here.


http://chototsumoushinp.dip.jp/miku/souko/hakoiri/


However it’s very old version.


I don’t yet commit newest source to sourceforge.





I’ll commit the latest source and tell you.





Thanks.


Hi chototsu.


I can only really profile ES2.0 applications on our hardware unfortunately.





However, I recorded your application with our utility ‘PVRTrace’ (which you can also use as it’s in our SDK). I then played back the recording of your application on our development hardware. This particular hardware has an SGX540 @ 100MHz (so clocked twice as slow as a Galaxy S) and the application ran at 20-30fps. This recording eliminates the CPU calculations per frame and purely uses the GPU. So if the recording runs at 20-30fps on slower GPU hardware than the Galaxy S (which runs your application at 10fps) then it seems to be an issue with the CPU.





Also looking at the trace you seem to call glTexParameter for every mesh batch per frame. This adds up to over 500 unnecessary GL calls as they texture options look to remain exactly the same.


You could set glTexParamater when a specific texture is first loaded, and then you should not need to call glTexParameter again (as long as you don’t want to change the filtering modes, for example, but I don’t think you do).





I’ll continue to see if I can find any more information for you and let you know if I do.Arron2012-02-28 17:18:31

Hi.


My application is optimized for multi core CPU.


Galaxy S contains a single core CPU.


It may be a cause.





Dalvik is very slow.


I should change all code into C++ to be improved.


However, it needs very big labor.


I hope that Dalvik becomes fast.





> it seems to be an issue with the CPU.





I understood it.





I’ll work on improvement of my library.





> glTexParameter





It’s a test code.


I forgot to remove that.


I removed that again.


http://chototsumoushinp.dip.jp/miku/download/AndroidSample_tinyar-118b24.apk





Thanks.


Hi again chototsu.


The trace of your application is looking much better and the FPS on the Galaxy S has risen from 4-5fps in 112 beta 3 to 15fps in 118 beta 4 so that’s good :).





As you say, Dalvik is very slow and any code that you could move to C++ would be beneficial but I know from experience that moving code from Java to C++ takes a long time :(.





Good job so far and good luck with development!

My application came to work on PowerVR.


I’m very happy.


Thank you very much.