From 6f07cc3ac48ab1273a45e6b9f750ab1b0bae3198 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 26 Mar 2019 18:54:48 +0000 Subject: [PATCH] Unwrap resource list passed to ID3D11VideoContext2::DecoderExtension --- renderdoc/driver/d3d11/d3d11_video.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/d3d11/d3d11_video.cpp b/renderdoc/driver/d3d11/d3d11_video.cpp index 4b9f8fa05..c2c602706 100644 --- a/renderdoc/driver/d3d11/d3d11_video.cpp +++ b/renderdoc/driver/d3d11/d3d11_video.cpp @@ -549,7 +549,21 @@ APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::DecoderExte /* [annotation] */ _In_ ID3D11VideoDecoder *pDecoder, /* [annotation] */ _In_ const D3D11_VIDEO_DECODER_EXTENSION *pExtensionData) { - return m_pReal->DecoderExtension(VIDEO_UNWRAP(WrappedID3D11VideoDecoder, pDecoder), pExtensionData); + if(pExtensionData == NULL) + return m_pReal->DecoderExtension(VIDEO_UNWRAP(WrappedID3D11VideoDecoder, pDecoder), + pExtensionData); + + D3D11_VIDEO_DECODER_EXTENSION unwrappedExt = *pExtensionData; + + std::vector unwrappedRes; + + unwrappedRes.resize(unwrappedExt.ResourceCount); + for(UINT i = 0; i < unwrappedExt.ResourceCount; i++) + unwrappedRes[i] = UnwrapD3D11Resource(unwrappedExt.ppResourceList[i]); + + unwrappedExt.ppResourceList = unwrappedRes.data(); + + return m_pReal->DecoderExtension(VIDEO_UNWRAP(WrappedID3D11VideoDecoder, pDecoder), &unwrappedExt); } void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputTargetRect(