3

I'm looking at a game I'm working on in the "OpenGL ES Driver" template in Instruments. The sampler is showing that I'm spending nearly all my time in a function called gfxODataGetNewSurface with a call tree that looks like this:

  • gfxIODataGetNewSurface
  • gliGetNewIOSurfaceES
  • _ZL29native_window_begin_iosurfaceP23_EAGLNativeWindowObject
  • usleep
  • __semwait_signal

(sorry for the weird formatting, safari or stack overflow is eating my line breaks)

The game is only getting about 40 FPS (on iPhone 4) under what I don't believe is a heavy workload which makes me think I'm doing something pathological with my OpenGL code.

Does anyone know what gliGetNewIOSurfaceES/gfxIODataGetNewSurface is doing? And what it indicates is happening in my app. Is it constantly creating new renderbuffers or something?

EDIT: New info...

I've discovered that with the following pixel shader:

varying vec2 texcoord;

uniform sampler2D sampler ; 
const vec4 color = vec4(...);

void main()                 
{                           
    gl_FragColor = color*texture2D(sampler,texcoord);               
}

(yet again my formatting is getting mangled!)

If I change the const 'color' to a #define, the Renderer Utilization drops from 75% to 35% when drawing a full-screen (960x640) sprite to the screen. Really I want this color to be an interpolated 'varying' quantity from the vertex shader, but if making it a global constant kills performance I can't imagine there's any hope that the 'varying' version would be any better.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
eodabash
  • 959
  • 2
  • 8
  • 24
  • 1
    The deferred nature of the iOS GPUs makes it a little more difficult to determine hotspots in rendering via Time Profiler and the like. That said, I believe that IOSurface is involved in the transfer of image data, like with the new texture caches in iOS 5.0. Are you working with a lot of textures? Is either your Renderer or Tiler Utilization in the OpenGL ES Driver instrument near 100%? – Brad Larson Mar 31 '12 at 21:08
  • Ah I didn't know how to change the different measured statistics before... I'm fairly new to iOS development. Tiler Utilization is very low ~4% but the Renderer Utilization is 100%. According to this question http://stackoverflow.com/questions/2785640/optimizing-iphone-opengl-es-fill-rate it sounds like I'm fill-rate bound? I'm drawing a couple of full screen RGBA textures and some smaller stuff on top of that. I think I can take it from here. If you want to post your comment as an answer I will accept it. – eodabash Apr 01 '12 at 20:03

0 Answers0