Long shader compile times on iPhone 3G S
I am getting shader compile times of up to 8 seconds on the iPhone 3G S (OS 3.1.2). The 8 second example consists of an 18 line vertex shader and a 110 line fragment shader, plus a few #define lines. Shark on Mac OS X tells me that 96.7% of the time is being spent in response to glValidateProgram, of which nearly all goes into CompileShader in the IMGSGX535GLDriver library. An excerpt:
96.7%, glValidateProgram, OpenGLES
96.7%, glValidateProgramARB_Exec, GLEngine
96.7%, gldUpdateDispatch, IMGSGX535GLDriver
96.7%, glrLoadCurrentPipelinePrograms, IMGSGX535GLDriver
94.0%, glrUpdateFragmentProgramInline, IMGSGX535GLDriver
94.0%, glrUpdateCtxSysFragmentProgram, IMGSGX535GLDriver
93.9%, sgxUpdateCtxSysProgram, IMGSGX535GLDriver
93.9%, ppimgCompile, IMGSGX535GLDriver
93.9%, PVRUniFlexCompileToHw, IMGSGX535GLDriver
93.8%, CompileShader, IMGSGX535GLDriver
I have a detailed decomposition. As a point of comparison, when running on the iPhone simulator on a MacBook Pro, I get glValidateProgram durations of 0.0006 to 0.01 seconds.
I'm guessing there is some sort of super-linear (and maybe exponential) analysis going on during compilation in the IMGSGX535GL driver.
Strangely, I've been unable to find other reports of this problem of terribly slow compile times.
Any ideas on what's going on and how I can speed things up dramatically? I'm happy to share my shader programs if anyone is interested.
When I skip glValidateProgram, I get these same sort of delay, but during the first render call.
I am completely baffled, and I would sure appreciate help.
96.7%, glValidateProgram, OpenGLES
96.7%, glValidateProgramARB_Exec, GLEngine
96.7%, gldUpdateDispatch, IMGSGX535GLDriver
96.7%, glrLoadCurrentPipelinePrograms, IMGSGX535GLDriver
94.0%, glrUpdateFragmentProgramInline, IMGSGX535GLDriver
94.0%, glrUpdateCtxSysFragmentProgram, IMGSGX535GLDriver
93.9%, sgxUpdateCtxSysProgram, IMGSGX535GLDriver
93.9%, ppimgCompile, IMGSGX535GLDriver
93.9%, PVRUniFlexCompileToHw, IMGSGX535GLDriver
93.8%, CompileShader, IMGSGX535GLDriver
I have a detailed decomposition. As a point of comparison, when running on the iPhone simulator on a MacBook Pro, I get glValidateProgram durations of 0.0006 to 0.01 seconds.
I'm guessing there is some sort of super-linear (and maybe exponential) analysis going on during compilation in the IMGSGX535GL driver.
Strangely, I've been unable to find other reports of this problem of terribly slow compile times.
Any ideas on what's going on and how I can speed things up dramatically? I'm happy to share my shader programs if anyone is interested.
When I skip glValidateProgram, I get these same sort of delay, but during the first render call.
I am completely baffled, and I would sure appreciate help.
File a bug. http://bugreport.apple.com/ . Include your shader code.
conal Wrote:As a point of comparison, when running on the iPhone simulator on a MacBook Pro, I get glValidateProgram durations of 0.0006 to 0.01 seconds.
Comparing the compilation time in the simulator is not meaningful.
The simulator is a software renderer, and is able to draw immediately while shader JIT compilation is being done on a second thread. Hardware renderers can't do that.
In any event, file a bug.
arekkusu Wrote:The simulator is a software renderer, and is able to draw immediately while shader JIT compilation is being done on a second thread. Hardware renderers can't do that.
Do you mean that the simulator first renders via the GPU (some sort of GLSL interpreter) and then switches to GPU code once that code is generated? I've wondered why it's slow at first and then speeds up significantly.
No, the simulator is always rendering via the CPU. From the programming guide:
For this, and many other reasons, it's not meaningful to compare the simulator performance to any other renderer.
Quote:(The) simulator provides an optimized software rasterizer that takes advantage of the vector processing capabilities of your Macintosh computer.
For this, and many other reasons, it's not meaningful to compare the simulator performance to any other renderer.
I submitted a bug report, but I can't tell whether it went through or not. I got back a message saying that I need Safari 1.0 or better. I'd submitted in Firefox, and i thought maybe it was telling me that Firefox wouldn't work. I redid in Safari (4.0.4), and i got the same result (saying I need Safari 1.0 or better).
Does anyone know how I can tell whether my report got into the bug tracking system or just got lost?
Does anyone know how I can tell whether my report got into the bug tracking system or just got lost?
arekkusu: Thanks for the additional details about shader execution in the simulator. Please disregard my previous iPhone-vs-simulator comparisons.
Does anyone have info on these terribly long compilations times (e.g., 8 seconds for 120 uncrowded lines of shader)?
Does anyone have info on these terribly long compilations times (e.g., 8 seconds for 120 uncrowded lines of shader)?
You can tell if it worked because it will show up in "my originated bugs"
I have yet to see this on the iPhone, but on the Mac side, I've seen incredibly long (eg upwards of 30s) compilation times for some graphics hardware.
please tell me *you* at least filed a bug...
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| OpenGL ES Template: createFramebuffer called several times? | SparkyNZ | 2 | 4,989 |
Apr 16, 2011 02:46 PM Last Post: SparkyNZ |
|
| Sharing uniforms across shader programs | iamflimflam1 | 4 | 3,432 |
Sep 3, 2010 12:25 PM Last Post: Frogblast |
|
| typedef struct - lossing data on some levels at random times | jjslay | 6 | 3,655 |
Jun 26, 2010 02:36 PM Last Post: jjslay |
|
| Submitting Updates to iTunes Connect and Review Times | Bersaelor | 4 | 8,699 |
May 26, 2010 09:51 AM Last Post: AnotherJake |
|
| Downloading the same game multiple times | EndeavorBros | 0 | 2,325 |
Nov 17, 2009 12:57 AM Last Post: EndeavorBros |
|

