thegrb93
Posts: 3
Joined: Thu Jun 07, 2018 4:35 am

GLES 2.0 glLinkProgram freeze depending on if statement structure

Thu Jun 07, 2018 4:56 am

This is the weirdest most annoying bug I've ever had, mainly because the pi will freeze and be unable to create a new context until it unfreezes (approx 2 minutes). I've narrowed it down to a single line of code with testing over a span of a few days.

It's my fragment shader eyes.frag that's doing it and the single line of code is this:

Image


This definitely seems like a driver problem. I was wondering if anyone had any suggestions. My project is also linked here if anyone wants to try it. https://www.dropbox.com/s/u8xfxuzhdkj5e9o/eyes.zip?dl=0

thegrb93
Posts: 3
Joined: Thu Jun 07, 2018 4:35 am

Re: GLES 2.0 glLinkProgram freeze depending on if statement structure

Fri Jun 08, 2018 4:09 am

Seems it can happen in some android too?

https://stackoverflow.com/questions/437 ... pp-freezes

"I experienced the same issue. The Nexus 7 (2013) was freezing when I called gllinkprogram(). I found that this only happened when I had 'if statements' in my shader. I was able to change both of my 'if statements' into 'conditional operators' and it worked.

E.g. (cond)? cond1:cond2"


Unfortunately this solution won't work for my shader.

thegrb93
Posts: 3
Joined: Thu Jun 07, 2018 4:35 am

Re: GLES 2.0 glLinkProgram freeze depending on if statement structure

Fri Jun 08, 2018 10:18 pm

Thanks to popcornmix, we found that the if statement dependence was due to optimization in the shader, and the reason for the hanging was a for-loop in the shader which doesn't work nicely with the pi's legacy driver i.e. the shader is too complex. More details https://github.com/raspberrypi/userland/issues/468

I might try the new beta driver, but first I'm going to try making the shader simpler.

Return to “OpenGLES”