12

I'm currently working on a couple of shaders for an iPad game and it seems as if Apple's GLSL compiler isn't doing any optimizations (or very few). I can move a single line in a shader and drop my FPS from 30 to 24 but I really have no idea why this is happening.

Does anyone have any references for the following:

  • what PowerVR instructions are generated from GLSL instructions?
  • what are the timings of the PowerVR instructions?
  • what sort of parallel processing units are in the PowerVR535 and how can they be exploited?

Thanks, Tristan

T Campbell
  • 133
  • 1
  • 6

2 Answers2

13

Imagination Technologies recently added Mac support for their PVRUniSCo compiler and PVRUniSCoEditor interactive shader editor. These can be downloaded for free as part of the PowerVR SDK. The compiler has support for both the PowerVR SGX 53x series as well as the 540 series in the iPad 2. Unfortunately, the editor runs as a clunky X11 application, but at least it works now.

The editor gives you line-by-line estimates of the number of GPU cycles required throughout your vertex or fragment shader, as well as more accurate best and worst case estimates of total cycles required.

I've been using it to profile my iOS shaders, and it has proven to be extremely useful in finding hotspots: PVRUniSCoEditor

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
  • Great to know Nothing was more annoying than shuffling to my PC to test timings. – T Campbell May 25 '11 at 21:14
  • 1
    April 2013 update: The latest PowerVR SDK includes tools (command-line compiler and gui editors like PVRShaman and PVRShaderEditor) which do not require X11, and can annotate estimated cycle counts on shader code. – mattorb Apr 18 '13 at 13:59
5

http://www.imgtec.net/factsheets/SDK/POWERVR%20SGX.OpenGL%20ES%202.0%20Application%20Development%20Recommendations.1.1f.External.pdf

This documet should help you to optimize your shaders for maximum performance. Apple should provide similar information as well.

Dr. Snoopy
  • 55,122
  • 7
  • 121
  • 140
  • 2
    Thanks for the answer. Unfortunately from further reading PowerVR decided to not publish the actual assembly GLSL gets compiled into. The best bet I found was using PowerVRUniSCo to give cycle counts for vertex and fragment shaders. Annoyingly this tool is only available for PC and Linux. – T Campbell Aug 04 '10 at 20:16