When present, embed D3D12Core.dll into the capture

* This way we know we have the right matching version for use on replay.
This commit is contained in:
baldurk committed 2021-04-22 15:52:15 +01:00
1 parent 525906ab87
commit 2b74938ccd
3 files changed
+41 -7

No files matched your search

+1
View File
@@ -1029,6 +1029,7 @@ rdcstr DoStringise(const SectionType &el)
STRINGISE_ENUM_CLASS_NAMED(ExtendedThumbnail, "renderdoc/internal/exthumb");
STRINGISE_ENUM_CLASS_NAMED(EmbeddedLogfile, "renderdoc/internal/logfile");
STRINGISE_ENUM_CLASS_NAMED(EditedShaders, "renderdoc/ui/edits");
STRINGISE_ENUM_CLASS_NAMED(D3D12Core, "renderdoc/internal/d3d12core");
}
END_ENUM_STRINGISE();
}
+7
View File
@@ -98,6 +98,12 @@ version of RenderDoc that addes a new section type. They should be considered eq
This section contains any edited shaders.
The name for this section will be "renderdoc/ui/edits".
.. data:: D3D12Core
This section contains an internal copy of D3D12Core for replaying.
The name for this section will be "renderdoc/internal/d3d12core".
)");
enum class SectionType : uint32_t
{
@@ -112,6 +118,7 @@ enum class SectionType : uint32_t
ExtendedThumbnail,
EmbeddedLogfile,
EditedShaders,
D3D12Core,
Count,
};
+33 -7
View File
@@ -2481,6 +2481,12 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd)
StreamWriter *captureWriter = NULL;
HMODULE D3D12Core = GetModuleHandleA("D3D12Core.dll");
if(D3D12Core)
{
m_InitParams.SDKVersion = *(DWORD *)GetProcAddress(D3D12Core, "D3D12SDKVersion");
}
if(rdc)
{
SectionProperties props;
@@ -2508,13 +2514,6 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd)
m_InitParams.usedDXIL = m_UsedDXIL;
HMODULE D3D12Core = GetModuleHandleA("D3D12Core.dll");
if(D3D12Core)
{
m_InitParams.SDKVersion = *(DWORD *)GetProcAddress(D3D12Core, "D3D12SDKVersion");
FreeLibrary(D3D12Core);
}
if(m_UsedDXIL)
{
RDCLOG("Capture used DXIL");
@@ -2598,6 +2597,33 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd)
RDCLOG("Captured D3D12 frame with %f MB capture section in %f seconds",
double(captureSectionSize) / (1024.0 * 1024.0), m_CaptureTimer.GetMilliseconds() / 1000.0);
if(D3D12Core)
{
if(rdc)
{
wchar_t core_filename[MAX_PATH + 1] = {};
GetModuleFileNameW(D3D12Core, core_filename, MAX_PATH);
bytebuf core_file;
FileIO::ReadAll(StringFormat::Wide2UTF8(core_filename), core_file);
SectionProperties props;
props.flags = SectionFlags::ZstdCompressed;
props.version = 1;
props.type = SectionType::D3D12Core;
captureWriter = rdc->WriteSection(props);
captureWriter->Write(core_file.data(), core_file.size());
captureWriter->Finish();
SAFE_DELETE(captureWriter);
}
FreeLibrary(D3D12Core);
}
RenderDoc::Inst().FinishCaptureWriting(rdc, m_CapturedFrames.back().frameNumber);
m_HeaderChunk->Delete();