RenderDoc是Cryengine团队的作品,包含在cry引擎中.作用是用来调试shader的,目前(0.34)支持 Vulkan, D3D11, D3D12, windows ?和linux上的 OpenGL .
RenderDoc工作原理
捕获日志
以下是不可视的数据
我们设置好unity的图形API,当我们切换到dx11时,相当于初始化dx11驱动
这是驱动会hook图形API,
运行程序,按下RenderDoc的捕获按钮,驱动会记录下一帧的API调用情况
将数据存储下来
重放和分析日志
以下这些数据是我们在RenderDoc中可视化的数据
载入存储下来的数据(一帧的图形API调用数据)
分析依赖关系,并检查每次调用时使用哪个资源来读取写入
重新对事件进行重新处理
从帧开始重新播放,将所有的资源初始化,恢复初始的渲染管道状态
因为重现了这一帧的调用,因此我们可以修改这一帧调用API(比如将一个红色物体改为蓝色)
windbg验证
Windbg数据
GfxDevice: creating device client; threaded=1 RDOC 010204: [21:39:07] dxgi_wrapped.cpp( 604) – Warning – Querying IDXGIAdapter for interface: GUID {7abb6563-02bc-47c4-8ef9-acc4795edbcf} RDOC 010204: [21:39:07] dxgi_wrapped.cpp( 178) – Warning – Querying IDXGIObject for interface: GUID {7abb6563-02bc-47c4-8ef9-acc4795edbcf} RDOC 010204: [21:39:07] d3d11_device.cpp( 751) – Warning – Trying to get ID3D11Device2. DX11.2 tiled resources are not supported at this time. RDOC 010204: [21:39:07] d3d11_context.cpp(1630) – Warning – Trying to get ID3D11DeviceContext2. DX11.2 tiled resources are not supported at this time. Direct3D: Version: Direct3D 11.0 [level 11.1] Renderer: NVIDIA GeForce GTX 970 (ID=0x13c2) Vendor: NVIDIA VRAM: 4058 MB Driver: 22.21.13.8476 [31:21:39:07:892][ 7816] IGIWHW Game d:\unity\editor\unity.exe found in whitelist: NOLoad scene ‘Temp/__Backupscenes/0.backup’ time: 0.034323 ms Unloading 8 Unused Serialized files (Serialized files now loaded: 0) System memory in use before: 59.5 MB. System memory in use after: 59.8 MB.
Unloading 0 unused Assets to reduce memory usage. Loaded Objects now: 4278.
Total: 6.843516 ms (FindLiveObjects: 0.381661 ms CreateObjectMapping: 0.092725 ms MarkObjects: 6.361445 ms DeleteObjects: 0.006403 ms)
[00:00:00] Enlighten: Precompute started.
[PathTracer] building lightmap data asset.
Setting up 4 worker threads for Enlighten.
Thread -> id: 794 -> priority: 1
Thread -> id: 79c -> priority: 1
Thread -> id: 329c -> priority: 1
Thread -> id: 3d60 -> priority: 1 [00:00:00] Enlighten: Finished 1 Layout Systems job (0.00s execute, 0.00s integrate, 0.20s wallclock) [00:00:00] Enlighten: Finished 1 Tetrahedralize Probes job (0.00s execute, 0.00s integrate, 0.05s wallclock)
[00:00:00] Enlighten: Precompute took 0.249160 seconds.
Enlighten scene contents: 0 geometries. 0 instances. 0 systems. 0 probe groups. 0 cube maps. Scene is up-to-date.
[00:00:00] Enlighten: Bake started.
[00:00:00] Enlighten: Finished 1 Create Input Lighting job (0.00s execute, 0.00s integrate, 0.05s wallclock)
[00:00:00] Enlighten: Bake took 0.052329 seconds. Refresh: detecting if any assets need to be imported or removed … Refresh: elapses 0.049982 seconds (Nothing changed) RDOC 010204: [21:39:51] d3d11_device.cpp(2758) – Log – Starting capture, frame 28 RDOC 010204: [21:39:51] d3d11_device.cpp(2794) – Log – Finished capture, Frame 29 RDOC 010204: [21:39:51] d3d11_device.cpp(1779) – Warning – Not serialising texture 2D initial state. ID 17474 RDOC 010204: [21:39:51] d3d11_device.cpp(1784) – Warning – Detected Write before Read of this target – assuming initial contents are unneeded. Capture again with Save All Initials if this is wrong RDOC 010204: [21:39:51] d3d11_device.cpp(1779) – Warning – Not serialising texture 2D initial state. ID 17771 RDOC 010204: [21:39:51] d3d11_device.cpp(1784) – Warning – Detected Write before Read of this target – assuming initial contents are unneeded. Capture again with Save All Initials if this is wrong RDOC 010204: [21:39:51] d3d11_device.cpp(1779) – Warning – Not serialising texture 2D initial state. ID 17775 RDOC 010204: [21:39:51] d3d11_device.cpp(1784) – Warning – Detected Write before Read of this target – assuming initial contents are unneeded. Capture again with Save All Initials if this is wrong RDOC 010204: [21:39:51] d3d11_device.cpp(1779) – Warning – Not serialising texture 2D initial state. ID 19042 RDOC 010204: [21:39:51] d3d11_device.cpp(1784) – Warning – Detected Write before Read of this target – assuming initial contents are unneeded. Capture again with Save All Initials if this is wrong RDOC 010204: [21:39:51] d3d11_device.cpp(1779) – Warning – Not serialising texture 2D initial state. ID 19045 RDOC 010204: [21:39:51] d3d11_device.cpp(1784) – Warning – Detected Write before Read of this target – assuming initial contents are unneeded. Capture again with Save All Initials if this is wrong RDOC 010204: [21:39:51] d3d11_device.cpp(1779) – Warning – Not serialising texture 2D initial state. ID 19052 RDOC 010204: [21:39:51] d3d11_device.cpp(1784) – Warning – Detected Write before Read of this target – assuming initial contents are unneeded. Capture again with Save All Initials if this is wrong RDOC 010204: [21:39:51] d3d11_device.cpp(1779) – Warning – Not serialising texture 2D initial state. ID 19057 RDOC 010204: [21:39:51] d3d11_device.cpp(1784) – Warning – Detected Write before Read of this target – assuming initial contents are unneeded.
Capture again with Save All Initials if this is wrong RDOC 010204: [21:39:51] serialiser.cpp(1471) – Log – Compressed frame capture data from 46497020 to 1269852 RDOC 010204: [21:39:51] serialiser.cpp(1317) – Log – Timer File writing – 19.941 ms RDOC 010204: [21:39:51] core.cpp(1022) – Log – Written to disk: C:\Users\veyvin\AppData\Local\Temp\RenderDoc\Unity_2017.07.31_21.35_frame29.rdc RDOC 010204: [21:39:51] win32_process.cpp( 457) – Log – Running process C:\Program Files\RenderDoc/renderdocui.exe RDOC 010204: [21:39:51] win32_process.cpp( 919) – Log – Launched process ‘C:\Program Files\RenderDoc/renderdocui.exe’ with ‘ –targetcontrol localhost:38920’
Refresh: detecting if any assets need to be imported or removed … Refresh: elapses 0.037046 seconds (Nothing changed)