SlideShare a Scribd company logo
1 of 36
Leszek Godlewski
Programmer, Nordic Games
OpenGL (ES) debugging
Nordic Games GmbH
● Started in 2011 as a sister company to Nordic Games
Publishing (We Sing)
● Base IP acquired from JoWooD and DreamCatcher (SpellForce,
The Guild, Aquanox, Painkiller)
● Initially focusing on smaller, niche games
● Acquired THQ IPs in 2013 (Darksiders, Titan Quest, Red
Faction, MX vs. ATV)
● Now shifting towards being a production company with
internal devs
● Since fall 2013: internal studio in Munich, Germany (Grimlore
Games)
Who is this guy?
Leszek Godlewski
Programmer, Nordic Games (early 2014 – now)
– Linux port of Darksiders
Freelance Programmer (Sep 2013 – early 2014)
– Linux port of Painkiller Hell & Damnation
– Linux port of Deadfall Adventures
Generalist Programmer, The Farm 51 (Mar 2010 – Aug
2013)
– Painkiller Hell & Damnation, Deadfall Adventures
Demo code available
is.gd/GDCE14Linux
Agenda
Overview of available IHV tools
Debug callback
– Setup and implementation
– Verbosity control
– Noise filtering
API call tracing and replaying
– Using apitrace
– Annotating the call trace
Resource leak checking
NVIDIA Nsight
NVIDIA Nsight (cont.)
Supports CUDA, OpenGL and Direct3D
Plugin for Visual Studio and Eclipse
Very good feature set
– Including debugging shaders just like CPU code! See [PLASTIC13]
– Operation on one machine is slow, it's suggested to have two (sic!)
Hardware limitations
– Recent NVIDIA GPUs only
Software limitations
– Windows only (Visual Studio edition)
– Windows or Linux (Eclipse edition)
– OpenGL 4.2 or newer
AMD CodeXL
AMD CodeXL (cont.)
Supports OpenCL, OpenGL and advanced AMD CPU
features
Stand-alone applicaiton + plugin for Visual Studio
Reasonable feature set
– Includes functionality of gDEBugger
– No shader debugging (although OpenCL kernels can be debugged)
Hardware limitations
– Some functionality limited to AMD GPUs
AMD GPU PerfStudio
AMD GPU PerfStudio (cont.)
Supports OpenGL and Direct3D
Cross-platform client, Windows stand-alone server/GUI
Reasonable feature set
– Shader debugging only for Direct3D
Hardware limitations
– Some functionality limited to AMD GPUs
Software limitations
– OpenGL 4.2 or newer
Intel Graphics Performance Analyzer
Intel Graphics Performance Analyzer (cont.)
Supports OpenGL ES and Direct3D
Windows/Android client, Windows/Linux stand-alone
server/GUI
Reasonable feature set
– No shader debugging
Hardware limitations
– Only Intel GPUs
Software limitations
– Windows or Android only
– OpenGL ES only (Android)
Agenda
Overview of available IHV tools
Debug callback
– Setup and implementation
– Verbosity control
– Noise filtering
API call tracing and replaying
– Using apitrace
– Annotating the call trace
Resource leak checking
Ye Olde Way
Call glGetError() after each OpenGL call
Get 1 of 8 (sic!) error codes
Look the call up in the manual
See what this particular error means in this particular
context
Check which of the parameters was wrong
– Usually by attaching a regular debugger and replaying the scenario
…
This sucks!
Ye Olde Way
Call glGetError() after each OpenGL call
Get 1 of 8 (sic!) error codes
Look the call up in the manual
See what this particular error means in this particular
context
Check which of the parameters was wrong
– Usually by attaching a regular debugger and replaying the scenario
…
This sucks! used to suck ☺
Debug callback
Never call glGetError() again!
Much more detailed information
– Including Performance tips from the driver
– Good to check what different drivers say
May not work without a debug OpenGL context
– GLX_CONTEXT_DEBUG_BIT_ARB
– WGL_CONTEXT_DEBUG_BIT_ARB
Debug callback (cont.)
Provided by either of (ABI-compatible):
GL_KHR_debug or
GL_ARB_debug_output
Debug callback (cont.)
void callback(GLenum source,
GLenum type,
GLuint id,
GLenum severity,
GLsizei length,
const GLchar* message,
const void* userParam);
Filter by
source, type,
severity or
individual
messages
Debug callback (cont.)
Verbosity can be controlled
– glDebugMessageControl[ARB]()
– [OPENGL01][OPENGL02]
Turn to 11 for valuable perf information:
– Which memory type a buffer is backed by
– Memory wasted by unused mip levels
– More!
– glDebugMessageControl(GL_DONT_CARE,
GL_DONT_CARE, GL_DONT_CARE, 0, 0, GL_TRUE);
Agenda
Overview of available IHV tools
Debug callback
– Setup and implementation
– Verbosity control
– Noise filtering
API call tracing and replaying
– Using apitrace
– Annotating the call trace
Resource leak checking
API call tracing
Record a trace of the run of the application
Replay and review the trace
– Look up OpenGL state at a particular call
– Inspect state variables, resources and objects:
●
Textures
●
Shaders
●
Buffers
●
…
apitrace or VOGL
Well, this is not helpful...
Much better!
Annotating the call stream
Annotating the call stream (cont.)
All aforementioned extensions supported by apitrace
even if not by driver
Recommended: GL_KHR_debug
– Best vendor coverage
●
GL_KHR_debug is slightly less common
●
GL_ARB_debug_output has no debug groups or object labels
– Emulation wrapper for Mac OS X [PIPELINE13]
Annotating the call stream (cont.)
Call grouping
– glPushDebugGroup()/glPopDebugGroup() (KHR_debug)
One-off messages
– glDebugMessageInsert()
(KHR_debug/ARB_debug_output)
– glStringMarkerGREMEDY() (GREMEDY_string_marker)
Object labelling
Buffer, shader, program, vertex array, query, program
pipeline, transform feedback, sampler, texture, render
buffer, frame buffer, display list
– glObjectLabel(), glGetObjectLabel()
Sync objects
– glObjectPtrLabel(), glGetObjectPtrLabel()
Annotation caveats
Multi-threaded/multi-context OpenGL application may
break debug group hierarchy
glDebugMessageInsert() calls the debug callback,
polluting error streams
– Workaround: drop if source ==
GL_DEBUG_SOURCE_APPLICATION
Agenda
Overview of available IHV tools
Debug callback
– Setup and implementation
– Verbosity control
– Noise filtering
API call tracing and replaying
– Using apitrace
– Annotating the call trace
Resource leak checking
Resource leak checking
When created correctly (glGen*()), object names are
integers, consecutive & recycled
– Not necessarily!
– Desktop GL names may be user-supplied
– GLES may be not recycled
Stupid idea: iterate over names [1; ∞)?
Resource leak checking (cont.)
Courtesy of Eric Lengyel & Fabian Giesen
static void check_for_leaks()
{
GLuint max_id = 10000; // better idea would be to keep track of assigned names.
GLuint id;
// if brute force doesn't work, you're not applying it hard enough
for ( id = 1 ; id <= max_id ; id++ )
{
#define CHECK( type ) if ( glIs##type( id ) ) 
fprintf( stderr, "GLX: leaked " #type " handle 0x%xn", (unsigned int) id )
CHECK( Texture );
CHECK( Buffer );
CHECK( Framebuffer );
CHECK( Renderbuffer );
CHECK( VertexArray );
CHECK( Shader );
CHECK( Program );
CHECK( ProgramPipeline );
#undef CHECK
}
}
Takeaway
IHV tools are cool, but complex & have their limits
– Valuable, so pick what works best for your HW+SW combo
Debug callbacks work everywhere
Debug callbacks will show you exactly what the problem
is (most of the time)
API call tracing works everywhere across-the-board
Annotating the trace helps you find your way
Resource leak checks? glIs*()!
@ l g o d l e w s k i @ n o r d i c ga m e s . a t
t @ T h e I n e Q u a t i o n
K w ww . i n e qu a t i o n . o r g
Questions?
F u rt h e r N o rd i c G a m e s i n f o rm a t i o n :
K w w w . n o r d i c g a m e s . a t
D e v e l o p me n t i n f o r ma t i o n :
K ww w . g ri ml o re ga m e s . c o m
Thank you!
References
 PLASTIC13 – Staniszewski, M., Szymczyk, M. ”Nsight” [link]
 OPENGL01 – “ARB_debug_output” [link]
 OPENGL02 – “KHR_debug” [link]
 PIPELINE13 – Menzer, R. ”(Simulating) KHR_debug on MacOS X” [link]

More Related Content

What's hot

A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)Matthias Brugger
 
The Listening: Email Client Backdoor
The Listening: Email Client BackdoorThe Listening: Email Client Backdoor
The Listening: Email Client BackdoorMichael Scovetta
 
Jollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-levelJollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-levelJollen Chen
 
[COSCUP 2021] A trip about how I contribute to LLVM
[COSCUP 2021] A trip about how I contribute to LLVM[COSCUP 2021] A trip about how I contribute to LLVM
[COSCUP 2021] A trip about how I contribute to LLVMDouglas Chen
 
Game Programming 12 - Shaders
Game Programming 12 - ShadersGame Programming 12 - Shaders
Game Programming 12 - ShadersNick Pruehs
 
Alessandro Abbruzzetti - Kernal64
Alessandro Abbruzzetti - Kernal64Alessandro Abbruzzetti - Kernal64
Alessandro Abbruzzetti - Kernal64Scala Italy
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsLinaro
 
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...44CON
 
Doom Technical Review
Doom Technical ReviewDoom Technical Review
Doom Technical ReviewAli Salehi
 
Advanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/GapzAdvanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/GapzAlex Matrosov
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UIOpersys inc.
 
Exploring Your Apple M1 devices with Open Source Tools
Exploring Your Apple M1 devices with Open Source ToolsExploring Your Apple M1 devices with Open Source Tools
Exploring Your Apple M1 devices with Open Source ToolsKoan-Sin Tan
 
Why kernelspace sucks?
Why kernelspace sucks?Why kernelspace sucks?
Why kernelspace sucks?OpenFest team
 
A Quick Introduction to Programmable Logic
A Quick Introduction to Programmable LogicA Quick Introduction to Programmable Logic
A Quick Introduction to Programmable LogicOmer Kilic
 
Binary art - Byte-ing the PE that fails you (extended offline version)
Binary art - Byte-ing the PE that fails you (extended offline version)Binary art - Byte-ing the PE that fails you (extended offline version)
Binary art - Byte-ing the PE that fails you (extended offline version)Ange Albertini
 
Android Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and ResourcesAndroid Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and ResourcesOpersys inc.
 

What's hot (20)

A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
 
The Listening: Email Client Backdoor
The Listening: Email Client BackdoorThe Listening: Email Client Backdoor
The Listening: Email Client Backdoor
 
Jollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-levelJollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-level
 
[COSCUP 2021] A trip about how I contribute to LLVM
[COSCUP 2021] A trip about how I contribute to LLVM[COSCUP 2021] A trip about how I contribute to LLVM
[COSCUP 2021] A trip about how I contribute to LLVM
 
Game Programming 12 - Shaders
Game Programming 12 - ShadersGame Programming 12 - Shaders
Game Programming 12 - Shaders
 
Alessandro Abbruzzetti - Kernal64
Alessandro Abbruzzetti - Kernal64Alessandro Abbruzzetti - Kernal64
Alessandro Abbruzzetti - Kernal64
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 
Code Injection in Windows
Code Injection in WindowsCode Injection in Windows
Code Injection in Windows
 
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
 
Doom Technical Review
Doom Technical ReviewDoom Technical Review
Doom Technical Review
 
Advanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/GapzAdvanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/Gapz
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UI
 
Exploring Your Apple M1 devices with Open Source Tools
Exploring Your Apple M1 devices with Open Source ToolsExploring Your Apple M1 devices with Open Source Tools
Exploring Your Apple M1 devices with Open Source Tools
 
Why kernelspace sucks?
Why kernelspace sucks?Why kernelspace sucks?
Why kernelspace sucks?
 
A Peek into TFRT
A Peek into TFRTA Peek into TFRT
A Peek into TFRT
 
A Quick Introduction to Programmable Logic
A Quick Introduction to Programmable LogicA Quick Introduction to Programmable Logic
A Quick Introduction to Programmable Logic
 
There is more to C
There is more to CThere is more to C
There is more to C
 
Binary art - Byte-ing the PE that fails you (extended offline version)
Binary art - Byte-ing the PE that fails you (extended offline version)Binary art - Byte-ing the PE that fails you (extended offline version)
Binary art - Byte-ing the PE that fails you (extended offline version)
 
Android Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and ResourcesAndroid Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and Resources
 
Android ndk
Android ndkAndroid ndk
Android ndk
 

Viewers also liked

Flying machine Business Profile
Flying machine Business ProfileFlying machine Business Profile
Flying machine Business ProfileSandeep Malkar
 
Crisis Subprime en España
Crisis Subprime en EspañaCrisis Subprime en España
Crisis Subprime en Españaespejodeoesed
 
El presidencialismo mexicano antes y después
El presidencialismo mexicano antes y después El presidencialismo mexicano antes y después
El presidencialismo mexicano antes y después espejodeoesed
 
CriminalEFS-PowerPoint
CriminalEFS-PowerPointCriminalEFS-PowerPoint
CriminalEFS-PowerPointJenn Amabile
 
Social Media For Busy Entrepreneurs and Small Businesses
Social Media For Busy Entrepreneurs and Small Businesses Social Media For Busy Entrepreneurs and Small Businesses
Social Media For Busy Entrepreneurs and Small Businesses Fikriyyah George
 
Cross-platform game engine development with SDL 2.0
Cross-platform game engine development with SDL 2.0Cross-platform game engine development with SDL 2.0
Cross-platform game engine development with SDL 2.0Leszek Godlewski
 
каталог керасис
каталог керасискаталог керасис
каталог керасисNastasik
 
Хипстеры в энтерпрайзе
Хипстеры в энтерпрайзеХипстеры в энтерпрайзе
Хипстеры в энтерпрайзеAleksandr Tarasov
 
Service Discovery. Spring Cloud Internals
Service Discovery. Spring Cloud InternalsService Discovery. Spring Cloud Internals
Service Discovery. Spring Cloud InternalsAleksandr Tarasov
 

Viewers also liked (17)

Flying machine Business Profile
Flying machine Business ProfileFlying machine Business Profile
Flying machine Business Profile
 
Crisis Subprime en España
Crisis Subprime en EspañaCrisis Subprime en España
Crisis Subprime en España
 
Ecosistemas
EcosistemasEcosistemas
Ecosistemas
 
El presidencialismo mexicano antes y después
El presidencialismo mexicano antes y después El presidencialismo mexicano antes y después
El presidencialismo mexicano antes y después
 
El barrroco
El barrrocoEl barrroco
El barrroco
 
CriminalEFS-PowerPoint
CriminalEFS-PowerPointCriminalEFS-PowerPoint
CriminalEFS-PowerPoint
 
Social Media For Busy Entrepreneurs and Small Businesses
Social Media For Busy Entrepreneurs and Small Businesses Social Media For Busy Entrepreneurs and Small Businesses
Social Media For Busy Entrepreneurs and Small Businesses
 
Imágenes inmersivas
Imágenes inmersivasImágenes inmersivas
Imágenes inmersivas
 
Suir img
Suir imgSuir img
Suir img
 
Gamedev-grade debugging
Gamedev-grade debuggingGamedev-grade debugging
Gamedev-grade debugging
 
Green Peace y WWF
Green Peace y WWFGreen Peace y WWF
Green Peace y WWF
 
Cross-platform game engine development with SDL 2.0
Cross-platform game engine development with SDL 2.0Cross-platform game engine development with SDL 2.0
Cross-platform game engine development with SDL 2.0
 
каталог керасис
каталог керасискаталог керасис
каталог керасис
 
Хипстеры в энтерпрайзе
Хипстеры в энтерпрайзеХипстеры в энтерпрайзе
Хипстеры в энтерпрайзе
 
Open gl
Open glOpen gl
Open gl
 
Docker In Bank Unrated
Docker In Bank UnratedDocker In Bank Unrated
Docker In Bank Unrated
 
Service Discovery. Spring Cloud Internals
Service Discovery. Spring Cloud InternalsService Discovery. Spring Cloud Internals
Service Discovery. Spring Cloud Internals
 

Similar to OpenGL (ES) debugging

Hacking with Reverse Engineering and Defense against it
Hacking with Reverse Engineering and Defense against it Hacking with Reverse Engineering and Defense against it
Hacking with Reverse Engineering and Defense against it Prakashchand Suthar
 
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012DefCamp
 
The Next Mainstream Programming Language: A Game Developer's Perspective
The Next Mainstream Programming Language: A Game Developer's PerspectiveThe Next Mainstream Programming Language: A Game Developer's Perspective
The Next Mainstream Programming Language: A Game Developer's Perspectivekfrdbs
 
Reverse code engineering
Reverse code engineeringReverse code engineering
Reverse code engineeringKrishs Patil
 
02 direct3 d_pipeline
02 direct3 d_pipeline02 direct3 d_pipeline
02 direct3 d_pipelineGirish Ghate
 
Gdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glGdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glchangehee lee
 
The Hacking Games - Operation System Vulnerabilities Meetup 29112022
The Hacking Games - Operation System Vulnerabilities Meetup 29112022The Hacking Games - Operation System Vulnerabilities Meetup 29112022
The Hacking Games - Operation System Vulnerabilities Meetup 29112022lior mazor
 
Game development
Game developmentGame development
Game developmentAsido_
 
Android Things in action
Android Things in actionAndroid Things in action
Android Things in actionStefano Sanna
 
cinema_time_new.pdf
cinema_time_new.pdfcinema_time_new.pdf
cinema_time_new.pdfMaxDmitriev
 
Native client (Евгений Эльцин)
Native client (Евгений Эльцин)Native client (Евгений Эльцин)
Native client (Евгений Эльцин)Ontico
 
Baby Demuxed's First Assembly Language Function
Baby Demuxed's First Assembly Language FunctionBaby Demuxed's First Assembly Language Function
Baby Demuxed's First Assembly Language FunctionKieran Kunhya
 
Embedded Graphics Drivers in Mesa (ELCE 2019)
Embedded Graphics Drivers in Mesa (ELCE 2019)Embedded Graphics Drivers in Mesa (ELCE 2019)
Embedded Graphics Drivers in Mesa (ELCE 2019)Igalia
 
TensorFlow - La IA detrás de Google
TensorFlow - La IA detrás de GoogleTensorFlow - La IA detrás de Google
TensorFlow - La IA detrás de GoogleIsrael Blancas
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)JiandSon
 
TSC Summit #3 - Reverse engineering and anti debugging techniques
TSC Summit #3 - Reverse engineering and anti debugging techniquesTSC Summit #3 - Reverse engineering and anti debugging techniques
TSC Summit #3 - Reverse engineering and anti debugging techniquesMikal Villa
 
3 boyd direct3_d12 (1)
3 boyd direct3_d12 (1)3 boyd direct3_d12 (1)
3 boyd direct3_d12 (1)mistercteam
 
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...Hafez Kamal
 

Similar to OpenGL (ES) debugging (20)

Hacking with Reverse Engineering and Defense against it
Hacking with Reverse Engineering and Defense against it Hacking with Reverse Engineering and Defense against it
Hacking with Reverse Engineering and Defense against it
 
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
 
NvFX GTC 2013
NvFX GTC 2013NvFX GTC 2013
NvFX GTC 2013
 
The Next Mainstream Programming Language: A Game Developer's Perspective
The Next Mainstream Programming Language: A Game Developer's PerspectiveThe Next Mainstream Programming Language: A Game Developer's Perspective
The Next Mainstream Programming Language: A Game Developer's Perspective
 
Reverse code engineering
Reverse code engineeringReverse code engineering
Reverse code engineering
 
02 direct3 d_pipeline
02 direct3 d_pipeline02 direct3 d_pipeline
02 direct3 d_pipeline
 
Gdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glGdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_gl
 
The Hacking Games - Operation System Vulnerabilities Meetup 29112022
The Hacking Games - Operation System Vulnerabilities Meetup 29112022The Hacking Games - Operation System Vulnerabilities Meetup 29112022
The Hacking Games - Operation System Vulnerabilities Meetup 29112022
 
Game development
Game developmentGame development
Game development
 
Android Things in action
Android Things in actionAndroid Things in action
Android Things in action
 
cinema_time_new.pdf
cinema_time_new.pdfcinema_time_new.pdf
cinema_time_new.pdf
 
Native client (Евгений Эльцин)
Native client (Евгений Эльцин)Native client (Евгений Эльцин)
Native client (Евгений Эльцин)
 
Baby Demuxed's First Assembly Language Function
Baby Demuxed's First Assembly Language FunctionBaby Demuxed's First Assembly Language Function
Baby Demuxed's First Assembly Language Function
 
Embedded Graphics Drivers in Mesa (ELCE 2019)
Embedded Graphics Drivers in Mesa (ELCE 2019)Embedded Graphics Drivers in Mesa (ELCE 2019)
Embedded Graphics Drivers in Mesa (ELCE 2019)
 
TensorFlow - La IA detrás de Google
TensorFlow - La IA detrás de GoogleTensorFlow - La IA detrás de Google
TensorFlow - La IA detrás de Google
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
 
TSC Summit #3 - Reverse engineering and anti debugging techniques
TSC Summit #3 - Reverse engineering and anti debugging techniquesTSC Summit #3 - Reverse engineering and anti debugging techniques
TSC Summit #3 - Reverse engineering and anti debugging techniques
 
3 boyd direct3_d12 (1)
3 boyd direct3_d12 (1)3 boyd direct3_d12 (1)
3 boyd direct3_d12 (1)
 
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
 
Vxcon 2016
Vxcon 2016Vxcon 2016
Vxcon 2016
 

Recently uploaded

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 

Recently uploaded (20)

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 

OpenGL (ES) debugging

  • 1. Leszek Godlewski Programmer, Nordic Games OpenGL (ES) debugging
  • 2. Nordic Games GmbH ● Started in 2011 as a sister company to Nordic Games Publishing (We Sing) ● Base IP acquired from JoWooD and DreamCatcher (SpellForce, The Guild, Aquanox, Painkiller) ● Initially focusing on smaller, niche games ● Acquired THQ IPs in 2013 (Darksiders, Titan Quest, Red Faction, MX vs. ATV) ● Now shifting towards being a production company with internal devs ● Since fall 2013: internal studio in Munich, Germany (Grimlore Games)
  • 3. Who is this guy? Leszek Godlewski Programmer, Nordic Games (early 2014 – now) – Linux port of Darksiders Freelance Programmer (Sep 2013 – early 2014) – Linux port of Painkiller Hell & Damnation – Linux port of Deadfall Adventures Generalist Programmer, The Farm 51 (Mar 2010 – Aug 2013) – Painkiller Hell & Damnation, Deadfall Adventures
  • 5. Agenda Overview of available IHV tools Debug callback – Setup and implementation – Verbosity control – Noise filtering API call tracing and replaying – Using apitrace – Annotating the call trace Resource leak checking
  • 7. NVIDIA Nsight (cont.) Supports CUDA, OpenGL and Direct3D Plugin for Visual Studio and Eclipse Very good feature set – Including debugging shaders just like CPU code! See [PLASTIC13] – Operation on one machine is slow, it's suggested to have two (sic!) Hardware limitations – Recent NVIDIA GPUs only Software limitations – Windows only (Visual Studio edition) – Windows or Linux (Eclipse edition) – OpenGL 4.2 or newer
  • 9. AMD CodeXL (cont.) Supports OpenCL, OpenGL and advanced AMD CPU features Stand-alone applicaiton + plugin for Visual Studio Reasonable feature set – Includes functionality of gDEBugger – No shader debugging (although OpenCL kernels can be debugged) Hardware limitations – Some functionality limited to AMD GPUs
  • 11. AMD GPU PerfStudio (cont.) Supports OpenGL and Direct3D Cross-platform client, Windows stand-alone server/GUI Reasonable feature set – Shader debugging only for Direct3D Hardware limitations – Some functionality limited to AMD GPUs Software limitations – OpenGL 4.2 or newer
  • 13. Intel Graphics Performance Analyzer (cont.) Supports OpenGL ES and Direct3D Windows/Android client, Windows/Linux stand-alone server/GUI Reasonable feature set – No shader debugging Hardware limitations – Only Intel GPUs Software limitations – Windows or Android only – OpenGL ES only (Android)
  • 14. Agenda Overview of available IHV tools Debug callback – Setup and implementation – Verbosity control – Noise filtering API call tracing and replaying – Using apitrace – Annotating the call trace Resource leak checking
  • 15. Ye Olde Way Call glGetError() after each OpenGL call Get 1 of 8 (sic!) error codes Look the call up in the manual See what this particular error means in this particular context Check which of the parameters was wrong – Usually by attaching a regular debugger and replaying the scenario … This sucks!
  • 16. Ye Olde Way Call glGetError() after each OpenGL call Get 1 of 8 (sic!) error codes Look the call up in the manual See what this particular error means in this particular context Check which of the parameters was wrong – Usually by attaching a regular debugger and replaying the scenario … This sucks! used to suck ☺
  • 17. Debug callback Never call glGetError() again! Much more detailed information – Including Performance tips from the driver – Good to check what different drivers say May not work without a debug OpenGL context – GLX_CONTEXT_DEBUG_BIT_ARB – WGL_CONTEXT_DEBUG_BIT_ARB
  • 18. Debug callback (cont.) Provided by either of (ABI-compatible): GL_KHR_debug or GL_ARB_debug_output
  • 19. Debug callback (cont.) void callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam); Filter by source, type, severity or individual messages
  • 20. Debug callback (cont.) Verbosity can be controlled – glDebugMessageControl[ARB]() – [OPENGL01][OPENGL02] Turn to 11 for valuable perf information: – Which memory type a buffer is backed by – Memory wasted by unused mip levels – More! – glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0, GL_TRUE);
  • 21. Agenda Overview of available IHV tools Debug callback – Setup and implementation – Verbosity control – Noise filtering API call tracing and replaying – Using apitrace – Annotating the call trace Resource leak checking
  • 22. API call tracing Record a trace of the run of the application Replay and review the trace – Look up OpenGL state at a particular call – Inspect state variables, resources and objects: ● Textures ● Shaders ● Buffers ● … apitrace or VOGL
  • 23. Well, this is not helpful...
  • 26. Annotating the call stream (cont.) All aforementioned extensions supported by apitrace even if not by driver Recommended: GL_KHR_debug – Best vendor coverage ● GL_KHR_debug is slightly less common ● GL_ARB_debug_output has no debug groups or object labels – Emulation wrapper for Mac OS X [PIPELINE13]
  • 27. Annotating the call stream (cont.) Call grouping – glPushDebugGroup()/glPopDebugGroup() (KHR_debug) One-off messages – glDebugMessageInsert() (KHR_debug/ARB_debug_output) – glStringMarkerGREMEDY() (GREMEDY_string_marker)
  • 28. Object labelling Buffer, shader, program, vertex array, query, program pipeline, transform feedback, sampler, texture, render buffer, frame buffer, display list – glObjectLabel(), glGetObjectLabel() Sync objects – glObjectPtrLabel(), glGetObjectPtrLabel()
  • 29. Annotation caveats Multi-threaded/multi-context OpenGL application may break debug group hierarchy glDebugMessageInsert() calls the debug callback, polluting error streams – Workaround: drop if source == GL_DEBUG_SOURCE_APPLICATION
  • 30. Agenda Overview of available IHV tools Debug callback – Setup and implementation – Verbosity control – Noise filtering API call tracing and replaying – Using apitrace – Annotating the call trace Resource leak checking
  • 31. Resource leak checking When created correctly (glGen*()), object names are integers, consecutive & recycled – Not necessarily! – Desktop GL names may be user-supplied – GLES may be not recycled Stupid idea: iterate over names [1; ∞)?
  • 32. Resource leak checking (cont.) Courtesy of Eric Lengyel & Fabian Giesen static void check_for_leaks() { GLuint max_id = 10000; // better idea would be to keep track of assigned names. GLuint id; // if brute force doesn't work, you're not applying it hard enough for ( id = 1 ; id <= max_id ; id++ ) { #define CHECK( type ) if ( glIs##type( id ) ) fprintf( stderr, "GLX: leaked " #type " handle 0x%xn", (unsigned int) id ) CHECK( Texture ); CHECK( Buffer ); CHECK( Framebuffer ); CHECK( Renderbuffer ); CHECK( VertexArray ); CHECK( Shader ); CHECK( Program ); CHECK( ProgramPipeline ); #undef CHECK } }
  • 33. Takeaway IHV tools are cool, but complex & have their limits – Valuable, so pick what works best for your HW+SW combo Debug callbacks work everywhere Debug callbacks will show you exactly what the problem is (most of the time) API call tracing works everywhere across-the-board Annotating the trace helps you find your way Resource leak checks? glIs*()!
  • 34. @ l g o d l e w s k i @ n o r d i c ga m e s . a t t @ T h e I n e Q u a t i o n K w ww . i n e qu a t i o n . o r g Questions?
  • 35. F u rt h e r N o rd i c G a m e s i n f o rm a t i o n : K w w w . n o r d i c g a m e s . a t D e v e l o p me n t i n f o r ma t i o n : K ww w . g ri ml o re ga m e s . c o m Thank you!
  • 36. References  PLASTIC13 – Staniszewski, M., Szymczyk, M. ”Nsight” [link]  OPENGL01 – “ARB_debug_output” [link]  OPENGL02 – “KHR_debug” [link]  PIPELINE13 – Menzer, R. ”(Simulating) KHR_debug on MacOS X” [link]

Editor's Notes

  1. &amp;lt;number&amp;gt;
  2. &amp;lt;number&amp;gt;
  3. &amp;lt;number&amp;gt;
  4. &amp;lt;number&amp;gt;