advanced debugging and profiling with gdebugger es

29
© Copyright Khronos Group, 2006 - Page 1 Advanced Debugging and Advanced Debugging and Profiling with gDEBugger Profiling with gDEBugger ES ES Yaki Tebeka Avi Shapira

Upload: holland

Post on 25-Feb-2016

54 views

Category:

Documents


4 download

DESCRIPTION

Advanced Debugging and Profiling with gDEBugger ES. Yaki Tebeka Avi Shapira. OpenGL ES debugging model. Application is sending API calls. Something happens here!. Why is OpenGL ES debugging difficult?. A general purpose debugger views the graphic system as a “ black box ” - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 1

Advanced Debugging and Advanced Debugging and Profiling with gDEBugger ESProfiling with gDEBugger ES

Yaki TebekaAvi Shapira

Page 2: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 2

OpenGL ES debugging modelOpenGL ES debugging model

Something happens here!

Application is sending API calls

Page 3: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 3

Why is OpenGL ES debugging difficult?Why is OpenGL ES debugging difficult?A general purpose debugger views the graphic system as a

“black box”• A render context is a huge “global” state machine• Commonly used features use a lot of state variables• You cannot watch OpenGL ES state variable values• You cannot break on state variables access functions• You cannot view allocated graphic objects (textures, buffers,

etc)• OpenGL ES is a low level API: few thousand calls per frame• OpenGL ES error model: It takes time to locate the place that

generated the error

Page 4: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 4

Use an OpenGL ES debugger!Use an OpenGL ES debugger!An OpenGL ES debugger transforms your debugging task into a

“white box” model• Lets you watch OpenGL ES state variable values• Lets you put a breakpoint on an OpenGL ES function• Lets you view allocated graphic objects (textures, etc)• Breaks automatically when an OpenGL error occurs• View the application call stack and source code when the

application breaks• Displays the OpenGL ES calls log

Saves debugging time Improves product quality

Page 5: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 5

Let’s jump into the water …Let’s jump into the water …

Page 6: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 6

Problem #1Problem #1

• The rendered object does not appear on the screen.

Page 7: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 7

Remedy #1Remedy #1• Use the State Variables view:

- Break the application run when the relevant object is being rendered

- Watch the values of the state variable associated with the described problem

Page 8: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 8

Problem #2Problem #2

• A rendered objects material is incorrect. • This happens in a certain mode / scenario.

Page 9: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 9

Remedy #2Remedy #2• Use the State Variables Comparison Viewer:

- Break the application run when things are ok- Take a snapshot of the entire state machine- Break the application run when things go wrong- Compare the current state machine values to the saved snapshot

Page 10: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 10

But how do I…But how do I…• Break the application run when the relevant object is being

rendered?- Breakpoints Dialog- Interactive Mode Toolbar- “Draw Step” Command

• Find the place that changed the state variable value?- Call Stack View- Source code Viewer

• Locate geometry related problems- Raster mode toolbar: force OpenGL ES raster mode to points, lines or fill- View the rendered geometry to locate Skinning / Level of details / Culling problems

Page 11: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 11

If the problem is related to textures?If the problem is related to textures?• Use the Textures viewer

- Lets you view textures allocated by the debugged application- Displays textures properties- Displays the bound textures for each bind target in each texture unit- Supports 1D, 2D, 3D, Cube map and rectangle textures- Textures data can be saved to disk as an image- Updates in real time

Page 12: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 12

If the problem is related to Shaders?If the problem is related to Shaders?• Use the Shaders Source Code Editor

- Lets you view shaders and programs allocated by the debugged application- Displays shaders and programs properties- Displays programs active uniforms values- Displays the active program- Programs and Shaders can be edited, compiled, linked and validated “on the fly”- Updates in real time

Page 13: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 13

OpenGL ES profiling modelOpenGL ES profiling model

Something happens here!

Application is sending API calls

Page 14: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 14

A profiling nightmare…A profiling nightmare…• A general purpose profiler views the GPU as a “black box”• A pipelined system• Pipeline stages are highly parallel• Pipeline stages are highly programmable (usually SIMD or

MIMD arrays)• Few actions per processor cycle• Caching is used in different stages• Hardware uses a lot of algorithms• IHVs keep implementation details secret…

Page 15: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 15

Before you start the profiling effort Before you start the profiling effort • Clean your OpenGL ES usage!

- Remove OpenGL ES errors- Remove redundant OpenGL ES calls

- Redundant state changes- Repeatedly turning on and off the same mechanisms- Redundant API calls- etc.

Page 16: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 16

Remove OpenGL errorsRemove OpenGL errors• OpenGL usually ignores commands that cause errors• These commands may have significant impact on render

performance!• It’s easy to test for errors, but much harder to locate them:

// End of frame test:GLenum openGLError = glGetError();if (openGLError != GL_NO_ERROR){

assert(0);

// But, who generated this error?}

Page 17: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 17

Remove OpenGL errors - contRemove OpenGL errors - cont• gDEBugger ES enables you to “break on”

- OpenGL errors- gDEBugger detected errors- NVIDIA GLExpert driver reports

• When the debugged application breaks, view its call stack

Page 18: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 18

Remove redundant OpenGL callsRemove redundant OpenGL calls• Calls Statistics view

- Displays the number of times each OpenGL, WGL and extensions function call was called

• Calls History view- Displays a log of OpenGL, WGL and extensions function calls

• Call Stack and Source Code views- Enables you to trace the source code location that caused each redundant call

Page 19: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 19

Steps for optimizing render performanceSteps for optimizing render performance1. Identify a performance bottleneck2. Optimize the pipeline stage that causes the bottleneck3. Repeat 1 and 2 until reaching the desired performance level

or performance cannot be improved anymore

If you cannot improve performance anymore, you can add workload to pipeline stages that are not fully utilized (improve visual effects / visual fidelity)

Page 20: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 20

Profiling DemoProfiling Demo

Page 21: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 21

Performance graph and dashboard viewsPerformance graph and dashboard viewsDisplays performance counters graphs of:• gDEBugger• Win32• ATI• NVIDIA

Page 22: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 22

Available performance counters Available performance counters (Desktop)(Desktop)

gDEBugger ATI NVIDIA Win32Frames / sec % Hardware Busy % GPU Idle CPU utilization

# OGL function calls % TCL Busy (Vertex Processor) % Driver Waiting CPU user mode utilization

# Texture objects % VTX Fetch Busy % Vertex Shader BusyCPU privilege mode utilization

# Loaded texels % TCL stalled on rasteriser % Pixel Shader Busy Available physical memory

* All counters are “per render context” and available on all graphic hardware's

# pre-cull Vertices % ROP Busy Virtual memory usage

# pre-cull Prims % Shader Waits for Texture Virtual memory pages / sec

# post-cull Tri Prims % Shader Waits for ROP Drivers virtual memory usage

# Pix Passed Z Video Memory Usage

# Pix Failed Z AGP / PCI-E Memory Usage

# Pix Processed # Vertex Count

# Pix Written # Frame Batch

# Pix Blended # Frame Vertex

# Frame Primitive

And more…

Page 23: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 23

Performance Analysis ToolbarPerformance Analysis Toolbar• Turn off the graphic pipeline stages one after the other• If performance improves when turning off a certain stage, you

have found a graphic pipeline bottleneck

Page 24: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 24

Commands includeCommands include- Enter profiling mode

- Eliminate draw commands

- Eliminate raster operations

- Eliminate fixed pipeline lights

- Eliminate texture data fetch operations

- Eliminate fragment shader operations

Page 25: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 25

Other gDEBugger featuresOther gDEBugger features• Launch any OpenGL or OpenGL ES application for debug or profile session. Instrumentation or recompilation

are not needed!• Adds breakpoints for any OpenGL, OpenGL ES or extensions entry point• Views a list of active and deleted OpenGL render contexts• Display debugged process events such as: thread created, dll loaded and unloaded, breakpoint hit, etc.• Forces OpenGL to render directly into the front buffer and controls the rendering speed• Forces the OpenGL Polygon Raster mode to see the rendered geometry• Supports debugging and profiling of OpenGL ES applications• gDEBugger ES is being used as an “out of the box” OpenGL ES emulator for the embedded systems on a

Windows PC machine• Displays implementation-specific OpenGL run-time information such as pixel formats and available

extensions• Saves textures as image files to disk• Views OpenGL state variables values in the watch view• Supports applications that render using multiple threads and multiple render contexts.• Saves performance counters data into a file (.csv). This enables you to do performance and regression tests

for your application using different hardware and driver configurations.• Output an OpenGL calls log into a formatted HTML file, containing texture imaged, vertex and fragment

shaders source code.• Supports GL_GREMEDY_string_marker extension that allows adding string markers into the reported and

recorded calls log, making the calls log much clearer.• Support OpenGL 2.0 standard and additional extensions• And more…

Page 26: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 26

gDEBugger version 2.5gDEBugger version 2.5• The first public gDEBugger ES beta• Official version is planned to be shipped in September• OpenGL ES implementation on Desktop windows• Supports OpenGL ES 1.1 and EGL 1.1

Page 27: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 27

In the pipeline…In the pipeline…• Linux port• On device debugging and profiling• EGL 1.2 support• OpenGL ES 2.0 support• Buffer Viewer• Dev Studio Integration

Page 28: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 28

Free gDEBugger License for Free gDEBugger License for Academic users!Academic users!OpenGL ARB and Graphic Remedy Academic Program:- Annual program for all OpenGL Academic users- License of the full feature version for one year- Includes all software updates- A limited number of free licenses available for

non-commercial developers who are not in academia

• More details: http://academic.gremedy.com

Page 29: Advanced Debugging and Profiling with gDEBugger ES

© Copyright Khronos Group, 2006 - Page 29

Questions / commentsQuestions / comments

www.gremedy.cominfo (at) gremedy.comNVIDIA booth Tue-Thu