"Capture GPU Frame" in XCode -- iOS only? - xcode

I am trying to profile a desktop OpenGL program with XCode. Neither instruments nor XCode's "capture GPU Frame" seem to be doing anything.
Are these features iOS only and just not labeled as such? If so, what are the options for profiling OSX OpenGL programs?

Yes, the Xcode "capture GPU frame" is only functional when running on iOS (at least, in Xcode 6.3 - perhaps this will be enabled in a future version). You can use the the OpenGL Profiler provided by Apple, which offers the similar functionality.

Related

Why is there no GLES option in GPU Frame Capture in xcode edit scheme

I was trying to capture a gpu frame of an MAC openGL program (https://github.com/JohnTargaryen/LearnOpenGL/blob/master/src/1.getting_started/2.1.hello_triangle/hello_triangle.cpp) using xcode. The camera icon used to capture frame didn't show up when i ran the program, so I did as the link below suggested, meaning to change GPU Frame Capture to GLES. However, there is no GLES option for me to choose.
no GLES option in GPU Frame Capture in xcode edit scheme
https://developer.apple.com/documentation/metal/frame_capture_debugging_tools/enabling_frame_capture?language=objc
What's the possible cause and how I can solve it? Thx in advance!
Apple has deprecated OpenGL ES in iOS 12, the XCode GPU tools now only support the Metal API.
Also, OpenGL-ES is not available on MacOS, only OpenGL, which is also deprecated.
See the warning mention for example in https://developer.apple.com/library/archive/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/Introduction/Introduction.html
Important OpenGL ES was deprecated in iOS 12. To create high-performance code on GPUs, use the Metal framework instead. See Metal.
For OpenGL, a similar warning mention is visible :
OpenGL was deprecated in macOS 10.14. To create high-performance code on GPUs, use the Metal framework instead. See Metal.

Debugging OpenGL ES 2.0 game that runs in Windows through PowerVR emulation

I have small cross platform engine that runs my OpenGL ES 2.0 games on Android and on Windows. To run it on Windows I am using PowerVR emulator (just libraries linked to the project). It all works well.
Now I would like to debug it and inspect in any OpenGL debugger. I tried Intel GPA, AMD CodeXL, gDebugger, glslDevil. But non of them were able to do it. In case of Intel GPA it did not find the running game. In other cases it started the game but failed to pause it or do anything later.
I do not know whether it is because it is OpenGL ES instead of OpenGL. But the PowerVR emulation must work like translating OpenGL ES to OpenGL, I think?
My questions are:
Is there any (utility) way how to debug OpenGL ES 2.0 programs on Windows?
Or is there any better emulation library than PowerVR that will force the app look like OpenGL for other tools (instead of OpenGL ES)?
I am doing all this as none of debuggers work for me on Android device. I am developing with Samsung Galaxy Tab (which is Tegra GPU), but Nvida's PerfHUD ES does not currently support it (and I also do not meet Android 4.0 or higher having only 3.1)
Is there any way how to debug OpenGL ES on Android device that has Android version 3.1 and it is Samsung Galaxy Tab device?
Thanx
You're correct - PVRVFrame translates OpenGL ES calls into host OpenGL calls. This is why the likes of gDEBugger will capture the OpenGL API calls made by the emulator rather than the calls you actually submitted.
The PowerVR SDK includes an OpenGL ES/EGL API recording tool called PVRTrace that has all of the functionality you're looking for.
The PVRTrace recording libraries can be used to record applications using PVRVFrame on Windows and Linux. The SDK also includes recording libraries for Android and Linux devices.
PVRTraceGUI (analysis tool for Windows, OSX & Linux) can be used to review and inspect the data you've recorded. It also has an Image Analysis widget that allows you to step through the draw calls in your recording & some other handy features, such as a Pixel Analysis pie chart that highlights the most costly fragment shaders in your render so you know where to focus shader optimisation.
There's also a PVRTrace standalone playback tool that allows you to replay your recordings on any of the supported OS's (inc. Windows & Android).
You can find an overview of the tool on the Imagination website here & can download PVRTrace through the PowerVR SDK installer, available here
I routinely debug OpenGL ES on Windows using the PowerVR VFrame translator, which converts OpenGL ES calls to OpenGL, as you said. I think it's the best solution. VFrame has some step and tracing features, but mostly I am using the debugging features of MSVC++.
If you are using GLSurfaceView on android, it has an OpenGL ES tracing feature too. I also recommend using an X86 AVD rather than ARM or trusting the drivers on any one device. This article explains in detail:
http://software.intel.com/en-us/articles/porting-opengl-games-to-android-on-intel-atom-processors-part-1

Core Animation Instrument for Mac OS X?

For tuning the performance of an application, the Core Animation Instrument is a very useful tool for iOS developers. The layer colorization helps find potential bottlenecks quickly, and getting an FPS graph can be helpful as well.
Unfortunately, this Instrument seems to be unavailable for Mac apps.
Is there an alternative, or am I just not looking hard enough (Advanced Mac OS X Programming by Mark Dalrymple does mention the Instrument)?
Some tools can be found here:
Menu Xcode > Open Developer Tool > More Developer Tools …
Will open developer.apple.com and you'll have to sign in
Download "Graphics Tools for Xcode - January 2013"
Then use "Quartz Debug" for a Frame Meter.
There are also some Environment Variables for debugging CALayers:
CA_COLOR_FLUSH, CA_COLOR_NO_WAIT, CA_COLOR_OPAQUE, CA_LOG_IMPLICIT_TRANSACTIONS, CA_LOG_IMAGE_COPIES, CA_COLOR_COPY, CA_PRINT_OBJECTS, CA_COLOR_OFFSCREEN
Those are sadly not documented, here you'll find a list of those:
http://www.iphonedevwiki.net/index.php/QuartzCore.framework

Nvidia Nsight 3 with OpenGL 3.3 error: Thisversion of OpenGL does not support capabilities

If I start graphic debugging with Nsight 3 I get the following error:
"This version of OpenGL does not support capabilities and extensions required by Nsight."
Which OpenGL version should I use? Up to now I use glut (3.7) with glew (1.9) on OpenGl 3.3. I can see the first frame and then the application crash (as you can see in uploaded pictures). If I debug one of my DirectX applications it works.
Please refer to "Graphics Inspector and Graphics Debugger" section in http://http.developer.nvidia.com/NsightVisualStudio/3.0/Documentation/UserGuide/HTML/Content/Release_Notes_Main.htm.

xcode 3.2.5 Run with performance tool -> Zombies option disabled

I have been developing for iOS but am new to Instruments. I was going through some tutorials for using instruments but most of them use Run with performance tool->object allocations, which is not present in my XCode (3.2.5) . If I select "Allocations" (which is present in my XCode), there is no option to select zombies (as is expected in Object Allocations). And also, Run with performance tool -> Zombies is disabled. Why does XCode disable the zombies option?
This post talks about it: Xcode "Run With Performance Tool" disabled?
I believe you are building an iOS program. As said by Apple engineers, most items under Run with Performance Tool need dTrace support, but dTrace is not available for iOS yet, not even for simulators.
I'm looking into this myself right now. If I find out more, I'll update this post. I was also hoping to use the Zombies performance tool for ios development. :(
Update: You might also look at How to run iPhone program with Zombies instrument? . I'm going to try that out.

Resources