From 7a65dba274d4f2d4661a94fc928abac24d684f91 Mon Sep 17 00:00:00 2001 From: Thomas Poulet <1039134+Bindless-Chicken@users.noreply.github.com> Date: Tue, 18 Aug 2020 11:33:54 +0200 Subject: [PATCH] Fix dry-run option in CreatePipelineLibrary This commit addresses an issue where the application is crashing when receiving nullptr in ppPipelineLibrary. As per the specifications, ppPipelineLibrary can optionally accept nullptr and perform a dry run. Since pipeline libraries are not supported, we return the driver unsupported case. https://docs.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device1-createpipelinelibrary --- renderdoc/driver/d3d12/d3d12_device_wrap1.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap1.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap1.cpp index 8b3dddd85..9c6c18e77 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap1.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap1.cpp @@ -29,6 +29,13 @@ HRESULT WrappedID3D12Device::CreatePipelineLibrary(_In_reads_(BlobLength) const SIZE_T BlobLength, REFIID riid, _COM_Outptr_ void **ppPipelineLibrary) { + // CreatePipelineLibrary supports doing a dry run if ppPipelineLibrary receives + // nullptr. That feature is optional and not supported in every driver, since + // we are not supporting pipeline libraries anyway, returns the unsupported + // driver case. + if(ppPipelineLibrary == NULL) + return DXGI_ERROR_UNSUPPORTED; + // we don't want to ever use pipeline libraries since then we can't get the // bytecode and pipeline config. So instead we always return that a blob is // non-matching and return a dummy interface that does nothing when stored.