Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGLES 2.0 Shader program linking hang and crash #468
Comments
|
What happens if you move the contents of the else clause before the if statement? |
|
I tried your suggestion and got the same result, but I think I understand a little better now. I think with the |
|
Yeah, it was optimizing out the call to Trace which is defined as float Trace(vec3 ro, vec3 rd)
{
float t = 0.0;
float dist = 1.0;
for (int i=0; i < traceDepth; i++)
{
if(abs(dist) < epsilon || t > drawDistance || t < 0.0)
continue;
dist = Isosurface(ro+rd*t);
t = t+dist;
}
return t;//vec4(ro+rd*t,dist);
}when I comment out this call, the if statements work |
|
If I replace this function with a random noise function, then I get no issues. So I guess it doesn't like ray marching. |
|
What is traceDepth? I've played with a lot of the shadertoy examples and haven't seen any ray marching ones simple enough to work. Note: The firmware GLES driver is being replaced with the vc4 arm side driver ( |
|
Yeah I was hoping to do 128x128x2 which I figured would be manageable. traceDepth was 100 which explains the massive hang. When I set it to 1, it only hangs for about 100ms but generates glGetError 0x505 at glDrawArrays. I'll test a little bit more to see if I can isolate whatever's causing that error to generate. The gpu should have 256MB of memory though so I can't imagine it running out on this simple program. |
|
The shader compiler wasn't really designed for shaders of this complexity. Everything gets inlined and unrolled (so you'll have 100 copies of Isosurface), and typically the register allocation fails on large programs. I believe the arm side vc4 driver doesn't have this register allocation issue so is more likely to handle larger programs. |
|
All right, I'll definitely give that a shot. Thanks for all the helpful suggestions. I'll post the results of that soon. |
|
I'm on the latest firmware and I'm sure I set up config.txt correctly, but can't initialize display. I think maybe I need X running. Tried on both the brcm and mesa libraries. Will try with X tomorrow. With the brcm library, I get
|
|
Yes, you'll need X running and you'll need to link with mesa libs rather than broadcom. |
|
Thanks. While waking up, I came up with a great idea. Since the geometry and camera will be static, I'll just precompute the depth and normal maps on the cpu and use them on the gpu as textures, that way performance is increased considerably and it hopefully fixes this issue. If I need more performance or it still has issues, I'll give the new driver a try. Thanks again for all the help. |
|
I've started working on it again and saw that there was no way to have floating point textures with the brcm driver, so I switched to mesa and got it working. However I'm still having trouble. I'm getting GL_INVALID_VALUE with GL_RGBA32F, GL_RGB32F, GL_RGBA16F, GL_RGBA32F
position.cols, position.rows are both 128 so that can't be the issue. any ideas? I'll try doing the ray marching again instead of this method. |
|
I noticed those enums were defined in a block labeled as GL_VERSION_3_0. I guess that's why. Then I guess there's no way to do floats in textures. |
|
(Actually I just realized the geometry isn't static after all) |
|
Also I just found HALF_FLOAT_OES which I think I can use, but oh well the geometry isn't static. |
I'm not entirely sure if this is the right place, but I've encountered this strange issue I've posted more details here, https://www.raspberrypi.org/forums/viewtopic.php?f=68&t=215384
Seems android might also suffer from this?
https://stackoverflow.com/questions/43740848/after-call-gllinkprogram-the-app-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 his solution won't work for my shader. I was wondering if anyone has any suggestions?