Forums - Integer branching crash

3 posts / 0 new
Last post
Integer branching crash
MattEnright
Join Date: 1 Apr 14
Posts: 3
Posted: Wed, 2014-09-24 10:43

Using integers in branch conditions can cause the shader compiler to crash.

The following vertex shader kills the program during compilation:

#version 300 es
precision mediump float;
 
uniform vec4 g_vector;
uniform float g_scalar;
uniform int g_integer;
 
void main()
{
    vec4 Temp = g_vector;
    
    // Commenting out this condition allows the program to compile.
    if (g_integer != 0)
    {
        Temp.w = g_scalar;
    }
    
    // Or commenting out this line succeeds.
    Temp.x = dot(Temp.xy, Temp.zw);
 
    gl_Position = Temp;
}
Unfortunately, there is no shader log to recover and no useful logcat messages. The device simply returns to the Android OS. Using the Adreno Profiler 3.8 produces the same behavior, killing the program it's connected to without reporting any details.
 
I've tested this shader on the following hardware:
Fire TV, Adreno 320, System Version 51.1.2.0
Kindle Fire HDX, Adreno 330, System Version 14.3.2.6

 

  • Up0
  • Down0
formisk
Join Date: 24 Jan 15
Posts: 8
Posted: Thu, 2015-03-12 04:02

Yes, I have seen similar crashes, in my case with uints and the > operator.. if(a > b) {blah}. Often crashes the compiler.

 

 

  • Up0
  • Down0
Ayo Moderator
Profile picture
Join Date: 23 Jan 15
Posts: 31
Posted: Fri, 2015-03-13 16:53

Hello Matt.

I wrote a small sample app using your shader and tested on an 8974 Snapdragon ("801") device [Adreno 330], and there were no problems with the integer branch.

I tried to test my sample on a Fire TV and discovered (using "CPU-Z", which is available for free download on the app store) that the device is OpenGL ES 2.0 only, and does not appear to support 3.0, which would explain your findings. My device has a "Software Version of 51.1.4.3_user_514020320", which appears newer than your version, so that couldn't be the issue.

I have so far been unable to test on a Kindle Fire HDX because the devices I have are running Android Jellybean, and so it is not possible to run my sample app on them. I will probably get an updated Fire HDX on Monday.

In the meantime, could you try running "CPU-Z" on the Kindle Fire HDX device you are testing on, and verify that it supports OpenGL ES 3.0?

Thanks.

 

  • 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.