worrying and love the debugger renderdoc or: how i learned to … · 2018. 6. 8. · d3d11...

36
RenderDoc or: How I Learned to Stop Worrying and Love the Debugger Baldur Karlsson

Upload: others

Post on 13-Oct-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

RenderDoc or: How I Learned to Stop Worrying and Love the Debugger

Baldur Karlsson

Page 2: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

My background● Graphics Programmer at Crytek

● Joined in late 2010

● Shipped Crysis 2 in early 2011

● Worked on both PC and Console versions

Page 3: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

My background● Over 2011 worked on Crysis console port

● Exclusively working with console graphics tools

● Joined Crysis 3 at the end of 2011

● PC graphics tools compared very poorly

Page 4: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Crysis 3 - © Crytek/EA 2013

Page 5: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

● PC graphics bugs a particular pain point

● Where possible tested on consoles

● Used console tools in preference

● Often on PC reduced to ‘printf’ debugging

PC graphics tools

Page 6: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

D3D11 Debuggers (2012)

Page 7: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

● DIY graphics debugger hobby project

● In essence what does a graphics debugger do?

● At its core, inspect intermediate values

● Requires concrete & reproducible frame

A better way?

Page 8: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

“It can’t be that hard.”

- Some sucker, Summer 2012

Page 9: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Naïve plan● Intercept & record all graphics API calls

● Replay all calls up to point then stop

● Do any extra display/inspection/analysis then

● API guarantees identical results given identical

inputs & commands*

* Not really, but mostly. Let’s pretend.

Page 10: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

“I have not failed. I've just found 10000 ways that won't work.”

- Thomas Edison

Page 11: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Naïve plan● Essentially describes how RenderDoc works

● Slightly simplified, but not inaccurate

● Devil’s in the details

● First commit: 27th June 2012

Page 12: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Text log - 1 week later

ID3D11Device::CreateBuffer (6){ Descriptor = D3D11_BUFFER_DESC (0) { ByteWidth: 0x3960 Usage: D3D11_USAGE_DYNAMIC BindFlags: 0x1 CPUAccessFlags: 0x10000 MiscFlags: 0x0 StructureByteStride: 0xCCCCCCCC } // Descriptor = D3D11_BUFFER_DESC HasInitialData: False MemPitch: 0x0 MemSlicePitch: 0x0 pBuffer: 0x00AD4B4C} // ID3D11Device::CreateBuffer

Page 13: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

UI Visualiser - Several weeks in

Page 14: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

UI Visualiser - Several weeks in

Texture raw pointer value

Page 15: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

UI Visualiser - Several weeks in

Drawcall index

Page 16: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Initial Scope● Low expectations at the time

● If possible the tool will scratch my own itch

● Maybe others in the office will try it sometimes

● That’s about it

Page 17: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Further iteration

Page 18: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

● Without grand plans I could iterate simply

● Easy little things to add e.g. min/max range

● Small scope - just make the tool I want

● Keep motivated by working on fun things

Simple steps

Page 19: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Even more iteration

Page 20: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Even more iteration

Page 21: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Even more iteration

Page 22: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

● alpha1 build tagged 27th May 2013

● Able to capture CryEngine (ish)

● Too late for Crysis 3 :(

● D3D11 active in later projects

alpha1

Page 23: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

The saviour has arrived!● Finally, a reliable tool on PC!

Page 24: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

The saviour has ... not quite arrived.● Crashes every 5 minutes

● Corrupted replay output

● Lacking features

● Bottom line: Not production ready

Page 25: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Home-grown = Home-fixed● With source and understanding, bugs quickly

fixed

● Turnaround time in minutes or days, not months

● Direct response to feature requests

● Highly tailored experience

Page 26: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Public Release● Very promising progression

● Would be good to share with the world

● Nothing to lose by letting others try

● Goal: September 2013

Page 27: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Public Release● Build ready by September 2013

● Internal delays

● Steam Dev Days Feb 2014 - VOGL released

● Final release shortly after - February 2014, source

in March 2014

Page 28: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Public Release - v0.18

Page 29: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Public Release - v0.18● alpha1 .. alpha12 internal builds

● v0.13 . .v0.17 private builds

● v0.18 first public build

● Windows-only, DX11 only

Page 30: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Continuing the project● Left Crytek in late 2014

● Spare-time project continued

● Continual improvements, features, additions

● Worked on what was most interesting/useful

Page 31: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

OpenGL support● v0.22 - 27th Feb 2015

● Support for ‘modern’ Core profile GL: 3.2 - 4.5

● Windows-only still

● Headless linux support

Page 32: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Vulkan Support● Approached by LunarG at SIGGRAPH 2015

● Discussed adding Vulkan support for

simultaneous release with 1.0 spec

● With support from Unity, dedicated time to

implementing

● Released with Vulkan 1.0 - v0.27 16th Feb 2016

Page 33: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Linux Support● Linux support in earlier versions but only

headless

● UI rewritten from scratch in Qt

● v0.33 - 23rd Feb 2017

● Qt UI finally released cross platform in v1.0 one

year later

Page 34: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

The Present● Contracting for Valve full time for past 2 years

● Used by many companies and ~1000 people

● ~7100 commits and ~295k SLOC

● RenderDoc 1.0 supports:

○ Windows, Linux, Android

● Using any of:

○ Vulkan, D3D11, D3D12, OpenGL & GLES

Page 35: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

The Future● Continued support and plan for future

● Latest github code supports Vulkan 1.1

● Contributions from companies such as AMD,

Samsung, Google, Imagination

● Many years of work ahead

Page 36: Worrying and Love the Debugger RenderDoc or: How I Learned to … · 2018. 6. 8. · D3D11 Debuggers (2012) DIY graphics debugger hobby project In essence what does a graphics debugger

Questions?