pouët.net

Go to bottom

Looping in GLSL on android?

category: code [glöplog]
 
trying to loop in a glsl shader on android but it wont allow any kind of looping? what kind of bs is this? do i need to specifiy a specific version of glsl code to compilie or something?
static for loops still allowed.. :) just had to write it so that it was unrollable
Woah, massive unrolled shader for sphere tracing? XD
added on the 2012-09-21 08:28:45 by mudlord mudlord
I once circumvented the "no variable length loops, and no messing around with the loop control variable" restriction with something like this

Code: for (int i=0;i<99;i++) { if (i<variable) { ... } }
added on the 2012-09-21 09:27:18 by yzi yzi
Didn't GLSL ES allow using "break" and "continue" within loops? From what I remember, it had, and the "predictable index" restriction was mainly to assure that shader is going to finish some day.
added on the 2012-09-21 10:51:18 by KK KK
Whether or not whis would work on actual device is still to be argued, though - Samsung Galaxy S certainly lives in different galaxy than GLSL spec and its GLSL compiler can crash badly in some cases.
added on the 2012-09-21 10:53:57 by KK KK
KK: Well, it's PowerVR on a non-Nokia, non-Apple device ... what did you expect? :)
added on the 2012-09-21 11:34:52 by KeyJ KeyJ
Desktop GPU Performance and OpenGL 4.3 - that's what I expected! Come it's 2012.
added on the 2012-09-21 11:52:04 by las las
*Come on it's 2012.

And I forgot to add a ";)".
added on the 2012-09-21 11:52:57 by las las
":D"
added on the 2012-09-21 18:51:50 by reed reed
ended up being able to make fractals on android after all, but the performance is dismal, even on a shader
BB Image
You ARE benchmarking it on real hardware, and not AVD, yes?
yes on a nexus 7
AVD doesn't do shaders
It does now
added on the 2012-09-22 12:42:48 by fragment fragment
just tried it in an avd and it does work, but at the same framerate i was seeing on the nexus 7, i think maybe i have some kind of frame limit set
Tested any other (non-Tegra) Android HW?
nope, but i did find something interesting: if i lower the iteration count and therefore loop less in the shader, the shader still updates slowly but the actuall framerate is high. The frames will update at a reasonable rate (~30 fps) and i can see the quad rotating smoothly, but the shader will update the texture on the quad at 1 fps (really slowly) . also for some reason at low iteration counts, i see weird artifacts and glitches on the quad

login

Go to top