Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
cippyboy
Posts: 17
Registered: ‎04-14-2013
My Device: Simulator

glGetUniformLocation on BB 10.2 returns big values, why ?

 

I just updated to BB 10.2 with my Q5 and I noticed all my native GL apps were crashing.

 

I've identified the source of the crash and the problem is that glGetUniformLocation returns multiples of 65536. This isn't a problem if you just use the values, but I had a GL state minimizer that checks for currently set constants and if they're the same, avoids setting them multiple times. This minimzer boosts performance by up to 35% which is why I used it and will still do.

 

However, this worked fine on 10.0 and 10.1 but with 10.2 I have to disable it because glGetUniformLocation returns these huge numbers which don't really make sense. The location should be a float4 register, not just some random number.

--------------------------------------------------------------------------
www.facebook.com/relativegames - My Apps
Please use plain text.
BlackBerry Development Advisor
RSperanza
Posts: 142
Registered: ‎03-08-2012
My Device: Z10

Re: glGetUniformLocation on BB 10.2 returns big values, why ?

Hi.

 

Apologies for the delay.  I thought I replied on Monday.  Multiples of 65536 implies that you are accessing a 16bit integer as a 32 but integer and there is a data shift as a result of the byte order.  I will have to look into the API to understand it a little before responding further but take a look at your code and check that this is not a result of the wrong type being passed into the function for the output.

Please use plain text.
New Developer
cippyboy
Posts: 17
Registered: ‎04-14-2013
My Device: Simulator

Re: glGetUniformLocation on BB 10.2 returns big values, why ?

 

The issue still happens on the latest version of the simulator (10.2.1) and I assume on devices as well. The numbers may be signed integers but the OpenGL spec places GLints for glGetUniform and a GLint is defined as a

 

typedef int              GLint;

 

so I have no idea what you were thinking when you decided to put short int when all other platforms respect the specification...

--------------------------------------------------------------------------
www.facebook.com/relativegames - My Apps
Please use plain text.
BlackBerry Development Advisor
RSperanza
Posts: 142
Registered: ‎03-08-2012
My Device: Z10

Re: glGetUniformLocation on BB 10.2 returns big values, why ?

Hi.

 

Sorry for the delayed followup.

 

Since my last post, I have had a chance to spend more time developing with OpenGL ES 2 so I have had more of a chance to work with this function.  I have not seen this function return values that you are seeing at all.  I always use GLint for storing the returned values from this function.

 

If you are using some utility code to boost performance, it is possible that this code makes some incorrect assumptions about default C types and their sizes, at least when it runs on ARM processors.  Why you didn't notice an issue before may be a result of some compilation flags changes that were made in 10.2 which may have affected how this utility code was compiled with the latest SDK.

 

It might be helpful if you can post some sample code in the thread showing what variables you are using to read the locations, and a section of the minimizer code that acts on those values, so that I can review the flow and possibly see what the issue is via code inspection. Thanks.

 

Please use plain text.
New Developer
cippyboy
Posts: 17
Registered: ‎04-14-2013
My Device: Simulator

Re: glGetUniformLocation on BB 10.2 returns big values, why ?

[ Edited ]

 

You couldn't see the values I'm talking about ? Well that's kind of weird or you're doing something that I'm not.

 

So I did a fresh new test. I created a new project in Momentics IDE, I haven't updated this in a while, not sure if i should though ( got version 2.0 build v201310251603 ). I created a sample GL ES 2.0 app and made it use the 10.0 SDK and not the 10.2 since I want to support 10.2 devices too.

 

I have the VM simulator version BB_10_2_1.2141 , I think this one is the latest, got it a couple of weeks ago tops.

 

In the sample in main.c line 204 there is

 

 GLuint projectionLoc = glGetUniformLocation(program, "u_projection");

Upon debugging projectionLoc gets to be 65536. Please confirm if you're seeing the same things.

 

UPDATE : I tried the 10.2 SDK, same behavior.

--------------------------------------------------------------------------
www.facebook.com/relativegames - My Apps
Please use plain text.
BlackBerry Development Advisor
RSperanza
Posts: 142
Registered: ‎03-08-2012
My Device: Z10

Re: glGetUniformLocation on BB 10.2 returns big values, why ?

Hi.

 

I do most of my testing on devices so maybe this issue you are seeing is specifically with the simulator.  I am curious what OS you are running and which version of VMWare Player you are using so that I can check with the simulator team to see if this is a known issue or a side effect of a configuration setting that may not be correct or possibly a driver issue.

Please use plain text.
New Developer
cippyboy
Posts: 17
Registered: ‎04-14-2013
My Device: Simulator

Re: glGetUniformLocation on BB 10.2 returns big values, why ?

[ Edited ]

I'm running Windows 8.0 x64 with VMware Workstation 9.0.0 build-812388 and I have a Core i7 2600 with an HD7850 running latest 14.3 driver.

 

The 10.2 issue with the uniforms existed on a Q5 I had a while ago (when I figured that removing my state minimizer fixed the issue), did you test with a Q5 and 10.2 and didn't get this uniform-related issue ?

--------------------------------------------------------------------------
www.facebook.com/relativegames - My Apps
Please use plain text.
BlackBerry Development Advisor
RSperanza
Posts: 142
Registered: ‎03-08-2012
My Device: Z10

Re: glGetUniformLocation on BB 10.2 returns big values, why ?

I have been testing my code on both the Z10 and Z30 on 10.2 and 10.2.1 builds.  I will try the sample app on one of my devices first and then see if I can try it on VMWare Fusion on my Mac next.  Beyond that, I will need to find someone else with a Windows and a VM Ware license to try this out if possible before looping in the simulator team.  I will try to reply back by the end of the week once I try a few things.

Please use plain text.
New Developer
cippyboy
Posts: 17
Registered: ‎04-14-2013
My Device: Simulator

Re: glGetUniformLocation on BB 10.2 returns big values, why ?

Any news regarding this ?

--------------------------------------------------------------------------
www.facebook.com/relativegames - My Apps
Please use plain text.
BlackBerry Development Advisor
RSperanza
Posts: 142
Registered: ‎03-08-2012
My Device: Z10

Re: glGetUniformLocation on BB 10.2 returns big values, why ?

Hi.

 

My aploogies for the delayed follow-up.  Recently, I switched teams and my schedule has been very busy and I will not be as active on the forums for the next few months.

 

I have had little luck finding anyone still using a simulator to test this for you and I currently do not have licenses to test this myself and ordering a license will take time. 

 

My suggestion is as follows:


1. We have newer simulators available now and a new one should be coming along with the 10.3 beta.  Retest with those simulators (try 10.2.1 and 10.3) and see if the problem is still present. 

2. If there is still a problem, please log an issue on the Developer Issue Tracker and then post the link in this thread so that I can get the issue escalated for you to the simulator team so that they have a chance to review it and potentially fix the issue before the 10.3 SDK Gold release.

 

Please use plain text.