diff --git a/renderdoc/driver/d3d11/d3d11_context.cpp b/renderdoc/driver/d3d11/d3d11_context.cpp index 29b97f475..f9879ad42 100644 --- a/renderdoc/driver/d3d11/d3d11_context.cpp +++ b/renderdoc/driver/d3d11/d3d11_context.cpp @@ -122,6 +122,7 @@ WrappedID3D11DeviceContext::WrappedID3D11DeviceContext(WrappedID3D11Device *real m_pRealContext->QueryInterface(__uuidof(ID3D11VideoContext), (void **)&m_WrappedVideo.m_pReal); m_pRealContext->QueryInterface(__uuidof(ID3D11VideoContext1), (void **)&m_WrappedVideo.m_pReal1); m_pRealContext->QueryInterface(__uuidof(ID3D11VideoContext2), (void **)&m_WrappedVideo.m_pReal2); + m_pRealContext->QueryInterface(__uuidof(ID3D11VideoContext3), (void **)&m_WrappedVideo.m_pReal3); } m_UserAnnotation.SetContext(this); @@ -224,6 +225,7 @@ WrappedID3D11DeviceContext::~WrappedID3D11DeviceContext() SAFE_RELEASE(m_WrappedVideo.m_pReal); SAFE_RELEASE(m_WrappedVideo.m_pReal1); SAFE_RELEASE(m_WrappedVideo.m_pReal2); + SAFE_RELEASE(m_WrappedVideo.m_pReal3); SAFE_RELEASE(m_pRealContext1); SAFE_RELEASE(m_pRealContext2); @@ -1520,7 +1522,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11DeviceContext::QueryInterface(REFIID riid return m_pDevice->QueryInterface(riid, ppvObject); } else if(riid == __uuidof(ID3D11VideoContext) || riid == __uuidof(ID3D11VideoContext1) || - riid == __uuidof(ID3D11VideoContext2)) + riid == __uuidof(ID3D11VideoContext2) || riid == __uuidof(ID3D11VideoContext3)) { return m_WrappedVideo.QueryInterface(riid, ppvObject); } diff --git a/renderdoc/driver/d3d11/d3d11_context.h b/renderdoc/driver/d3d11/d3d11_context.h index 3c2e2fe78..69d3dc5b3 100644 --- a/renderdoc/driver/d3d11/d3d11_context.h +++ b/renderdoc/driver/d3d11/d3d11_context.h @@ -146,7 +146,7 @@ private: ID3D11DeviceContext3 *m_pRealContext3; ID3D11DeviceContext4 *m_pRealContext4; - WrappedID3D11VideoContext2 m_WrappedVideo; + WrappedID3D11VideoContext m_WrappedVideo; D3D11_DEVICE_CONTEXT_TYPE m_Type; bool m_NeedUpdateSubWorkaround; diff --git a/renderdoc/driver/d3d11/d3d11_video.cpp b/renderdoc/driver/d3d11/d3d11_video.cpp index d2996679e..807ac3a88 100644 --- a/renderdoc/driver/d3d11/d3d11_video.cpp +++ b/renderdoc/driver/d3d11/d3d11_video.cpp @@ -418,17 +418,17 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoDevice2::NegotiateCryptoSessionKeyEx VIDEO_UNWRAP(WrappedID3D11CryptoSession, pCryptoSession), flags, DataSize, pData); } -ULONG STDMETHODCALLTYPE WrappedID3D11VideoContext2::AddRef() +ULONG STDMETHODCALLTYPE WrappedID3D11VideoContext::AddRef() { return m_pContext->AddRef(); } -ULONG STDMETHODCALLTYPE WrappedID3D11VideoContext2::Release() +ULONG STDMETHODCALLTYPE WrappedID3D11VideoContext::Release() { return m_pContext->Release(); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::QueryInterface(REFIID riid, void **ppvObject) +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::QueryInterface(REFIID riid, void **ppvObject) { if(riid == __uuidof(IUnknown)) { @@ -470,16 +470,30 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::QueryInterface(REFIID riid return E_NOINTERFACE; } } + else if(riid == __uuidof(ID3D11VideoContext3)) + { + if(m_pReal3) + { + *ppvObject = (ID3D11VideoContext3 *)this; + AddRef(); + return S_OK; + } + else + { + *ppvObject = NULL; + return E_NOINTERFACE; + } + } return m_pContext->QueryInterface(riid, ppvObject); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::GetDevice(ID3D11Device **ppDevice) +void STDMETHODCALLTYPE WrappedID3D11VideoContext::GetDevice(ID3D11Device **ppDevice) { m_pContext->GetDevice(ppDevice); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::GetDecoderBuffer( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::GetDecoderBuffer( /* [annotation] */ _In_ ID3D11VideoDecoder *pDecoder, D3D11_VIDEO_DECODER_BUFFER_TYPE Type, /* [annotation] */ _Out_ UINT *pBufferSize, /* [annotation] */ _Outptr_result_bytebuffer_(*pBufferSize) void **ppBuffer) @@ -488,14 +502,14 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::GetDecoderBuffer( pBufferSize, ppBuffer); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::ReleaseDecoderBuffer( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::ReleaseDecoderBuffer( /* [annotation] */ _In_ ID3D11VideoDecoder *pDecoder, /* [annotation] */ _In_ D3D11_VIDEO_DECODER_BUFFER_TYPE Type) { return m_pReal->ReleaseDecoderBuffer(VIDEO_UNWRAP(WrappedID3D11VideoDecoder, pDecoder), Type); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::DecoderBeginFrame( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::DecoderBeginFrame( /* [annotation] */ _In_ ID3D11VideoDecoder *pDecoder, /* [annotation] */ _In_ ID3D11VideoDecoderOutputView *pView, UINT ContentKeySize, /* [annotation] */ _In_reads_bytes_opt_(ContentKeySize) const void *pContentKey) @@ -506,12 +520,12 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::DecoderBeginFrame( } HRESULT STDMETHODCALLTYPE -WrappedID3D11VideoContext2::DecoderEndFrame(/* [annotation] */ _In_ ID3D11VideoDecoder *pDecoder) +WrappedID3D11VideoContext::DecoderEndFrame(/* [annotation] */ _In_ ID3D11VideoDecoder *pDecoder) { return m_pReal->DecoderEndFrame(VIDEO_UNWRAP(WrappedID3D11VideoDecoder, pDecoder)); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::SubmitDecoderBuffers( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::SubmitDecoderBuffers( /* [annotation] */ _In_ ID3D11VideoDecoder *pDecoder, /* [annotation] */ _In_ UINT NumBuffers, /* [annotation] */ _In_reads_(NumBuffers) const D3D11_VIDEO_DECODER_BUFFER_DESC *pBufferDesc) { @@ -519,7 +533,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::SubmitDecoderBuffers( NumBuffers, pBufferDesc); } -APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::DecoderExtension( +APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::DecoderExtension( /* [annotation] */ _In_ ID3D11VideoDecoder *pDecoder, /* [annotation] */ _In_ const D3D11_VIDEO_DECODER_EXTENSION *pExtensionData) { @@ -540,7 +554,7 @@ APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::DecoderExte return m_pReal->DecoderExtension(VIDEO_UNWRAP(WrappedID3D11VideoDecoder, pDecoder), &unwrappedExt); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputTargetRect( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetOutputTargetRect( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ BOOL Enable, /* [annotation] */ _In_opt_ const RECT *pRect) { @@ -548,7 +562,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputTarget VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), Enable, pRect); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputBackgroundColor( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetOutputBackgroundColor( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ BOOL YCbCr, /* [annotation] */ _In_ const D3D11_VIDEO_COLOR *pColor) { @@ -556,7 +570,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputBackgr VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), YCbCr, pColor); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputColorSpace( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetOutputColorSpace( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ const D3D11_VIDEO_PROCESSOR_COLOR_SPACE *pColorSpace) { @@ -564,7 +578,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputColorS VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), pColorSpace); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputAlphaFillMode( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetOutputAlphaFillMode( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE AlphaFillMode, /* [annotation] */ _In_ UINT StreamIndex) @@ -573,7 +587,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputAlphaF VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), AlphaFillMode, StreamIndex); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputConstriction( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetOutputConstriction( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ BOOL Enable, /* [annotation] */ _In_ SIZE Size) { @@ -581,14 +595,14 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputConstr VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), Enable, Size); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputStereoMode( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetOutputStereoMode( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ BOOL Enable) { return m_pReal->VideoProcessorSetOutputStereoMode( VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), Enable); } -APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputExtension( +APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetOutputExtension( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ const GUID *pExtensionGuid, /* [annotation] */ _In_ UINT DataSize, /* [annotation] */ _In_ void *pData) @@ -597,7 +611,7 @@ APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProces VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), pExtensionGuid, DataSize, pData); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputTargetRect( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetOutputTargetRect( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _Out_ BOOL *Enabled, /* [annotation] */ _Out_ RECT *pRect) { @@ -605,7 +619,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputTarget VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), Enabled, pRect); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputBackgroundColor( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetOutputBackgroundColor( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _Out_ BOOL *pYCbCr, /* [annotation] */ _Out_ D3D11_VIDEO_COLOR *pColor) { @@ -613,7 +627,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputBackgr VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), pYCbCr, pColor); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputColorSpace( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetOutputColorSpace( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _Out_ D3D11_VIDEO_PROCESSOR_COLOR_SPACE *pColorSpace) { @@ -621,7 +635,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputColorS VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), pColorSpace); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputAlphaFillMode( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetOutputAlphaFillMode( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _Out_ D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE *pAlphaFillMode, /* [annotation] */ _Out_ UINT *pStreamIndex) @@ -630,7 +644,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputAlphaF VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), pAlphaFillMode, pStreamIndex); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputConstriction( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetOutputConstriction( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _Out_ BOOL *pEnabled, /* [annotation] */ _Out_ SIZE *pSize) { @@ -638,7 +652,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputConstr VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), pEnabled, pSize); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputStereoMode( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetOutputStereoMode( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _Out_ BOOL *pEnabled) { @@ -646,7 +660,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputStereo VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), pEnabled); } -APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputExtension( +APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetOutputExtension( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ const GUID *pExtensionGuid, /* [annotation] */ _In_ UINT DataSize, /* [annotation] */ _Out_writes_bytes_(DataSize) void *pData) @@ -655,7 +669,7 @@ APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProces VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), pExtensionGuid, DataSize, pData); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamFrameFormat( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamFrameFormat( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ D3D11_VIDEO_FRAME_FORMAT FrameFormat) @@ -664,7 +678,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamFrameF VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, FrameFormat); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamColorSpace( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamColorSpace( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ const D3D11_VIDEO_PROCESSOR_COLOR_SPACE *pColorSpace) @@ -673,7 +687,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamColorS VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, pColorSpace); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamOutputRate( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamOutputRate( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ D3D11_VIDEO_PROCESSOR_OUTPUT_RATE OutputRate, @@ -685,7 +699,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamOutput RepeatFrame, pCustomRate); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamSourceRect( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamSourceRect( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ BOOL Enable, /* [annotation] */ _In_opt_ const RECT *pRect) @@ -694,7 +708,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamSource VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, Enable, pRect); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamDestRect( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamDestRect( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ BOOL Enable, /* [annotation] */ _In_opt_ const RECT *pRect) @@ -703,7 +717,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamDestRe VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, Enable, pRect); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamAlpha( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamAlpha( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ BOOL Enable, /* [annotation] */ _In_ FLOAT Alpha) @@ -712,7 +726,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamAlpha( VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, Enable, Alpha); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamPalette( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamPalette( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ UINT Count, /* [annotation] */ _In_reads_opt_(Count) const UINT *pEntries) @@ -721,7 +735,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamPalett VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, Count, pEntries); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamPixelAspectRatio( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamPixelAspectRatio( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ BOOL Enable, /* [annotation] */ _In_opt_ const DXGI_RATIONAL *pSourceAspectRatio, @@ -732,7 +746,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamPixelA pSourceAspectRatio, pDestinationAspectRatio); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamLumaKey( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamLumaKey( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ BOOL Enable, /* [annotation] */ _In_ FLOAT Lower, /* [annotation] */ _In_ FLOAT Upper) @@ -741,7 +755,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamLumaKe VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, Enable, Lower, Upper); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamStereoFormat( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamStereoFormat( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ BOOL Enable, /* [annotation] */ _In_ D3D11_VIDEO_PROCESSOR_STEREO_FORMAT Format, @@ -754,7 +768,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamStereo LeftViewFrame0, BaseViewFrame0, FlipMode, MonoOffset); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamAutoProcessingMode( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamAutoProcessingMode( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ BOOL Enable) { @@ -762,7 +776,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamAutoPr VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, Enable); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamFilter( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamFilter( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ D3D11_VIDEO_PROCESSOR_FILTER Filter, @@ -772,7 +786,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamFilter VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, Filter, Enable, Level); } -APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamExtension( +APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamExtension( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ const GUID *pExtensionGuid, /* [annotation] */ _In_ UINT DataSize, /* [annotation] */ _In_ void *pData) @@ -782,7 +796,7 @@ APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProces DataSize, pData); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamFrameFormat( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamFrameFormat( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ D3D11_VIDEO_FRAME_FORMAT *pFrameFormat) @@ -791,7 +805,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamFrameF VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, pFrameFormat); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamColorSpace( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamColorSpace( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ D3D11_VIDEO_PROCESSOR_COLOR_SPACE *pColorSpace) @@ -800,7 +814,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamColorS VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, pColorSpace); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamOutputRate( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamOutputRate( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ D3D11_VIDEO_PROCESSOR_OUTPUT_RATE *pOutputRate, @@ -811,7 +825,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamOutput pRepeatFrame, pCustomRate); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamSourceRect( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamSourceRect( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ BOOL *pEnabled, /* [annotation] */ _Out_ RECT *pRect) @@ -820,7 +834,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamSource VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, pEnabled, pRect); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamDestRect( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamDestRect( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ BOOL *pEnabled, /* [annotation] */ _Out_ RECT *pRect) @@ -829,7 +843,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamDestRe VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, pEnabled, pRect); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamAlpha( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamAlpha( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ BOOL *pEnabled, /* [annotation] */ _Out_ FLOAT *pAlpha) @@ -838,7 +852,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamAlpha( VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, pEnabled, pAlpha); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamPalette( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamPalette( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ UINT Count, /* [annotation] */ _Out_writes_(Count) UINT *pEntries) @@ -847,7 +861,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamPalett VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, Count, pEntries); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamPixelAspectRatio( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamPixelAspectRatio( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ BOOL *pEnabled, /* [annotation] */ _Out_ DXGI_RATIONAL *pSourceAspectRatio, @@ -858,7 +872,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamPixelA pSourceAspectRatio, pDestinationAspectRatio); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamLumaKey( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamLumaKey( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ BOOL *pEnabled, /* [annotation] */ _Out_ FLOAT *pLower, /* [annotation] */ _Out_ FLOAT *pUpper) @@ -868,7 +882,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamLumaKe pUpper); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamStereoFormat( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamStereoFormat( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ BOOL *pEnable, /* [annotation] */ _Out_ D3D11_VIDEO_PROCESSOR_STEREO_FORMAT *pFormat, @@ -881,7 +895,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamStereo pLeftViewFrame0, pBaseViewFrame0, pFlipMode, MonoOffset); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamAutoProcessingMode( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamAutoProcessingMode( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ BOOL *pEnabled) { @@ -889,7 +903,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamAutoPr VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, pEnabled); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamFilter( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamFilter( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ D3D11_VIDEO_PROCESSOR_FILTER Filter, @@ -900,7 +914,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamFilter pLevel); } -APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamExtension( +APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamExtension( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ const GUID *pExtensionGuid, /* [annotation] */ _In_ UINT DataSize, @@ -911,7 +925,7 @@ APP_DEPRECATED_HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProces DataSize, pData); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorBlt( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorBlt( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ ID3D11VideoProcessorOutputView *pView, /* [annotation] */ _In_ UINT OutputFrame, /* [annotation] */ _In_ UINT StreamCount, @@ -992,7 +1006,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorBlt( OutputFrame, StreamCount, unwrappedStreams.data()); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::NegotiateCryptoSessionKeyExchange( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::NegotiateCryptoSessionKeyExchange( /* [annotation] */ _In_ ID3D11CryptoSession *pCryptoSession, /* [annotation] */ _In_ UINT DataSize, /* [annotation] */ _Inout_updates_bytes_(DataSize) void *pData) @@ -1001,7 +1015,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::NegotiateCryptoSessionKeyE VIDEO_UNWRAP(WrappedID3D11CryptoSession, pCryptoSession), DataSize, pData); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::EncryptionBlt( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::EncryptionBlt( /* [annotation] */ _In_ ID3D11CryptoSession *pCryptoSession, /* [annotation] */ _In_ ID3D11Texture2D *pSrcSurface, /* [annotation] */ _In_ ID3D11Texture2D *pDstSurface, /* [annotation] */ _In_ UINT IVSize, @@ -1012,7 +1026,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::EncryptionBlt( UNWRAP(WrappedID3D11Texture2D1, pDstSurface), IVSize, pIV); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::DecryptionBlt( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::DecryptionBlt( /* [annotation] */ _In_ ID3D11CryptoSession *pCryptoSession, /* [annotation] */ _In_ ID3D11Texture2D *pSrcSurface, /* [annotation] */ _In_ ID3D11Texture2D *pDstSurface, @@ -1027,7 +1041,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::DecryptionBlt( ContentKeySize, pContentKey, IVSize, pIV); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::StartSessionKeyRefresh( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::StartSessionKeyRefresh( /* [annotation] */ _In_ ID3D11CryptoSession *pCryptoSession, /* [annotation] */ _In_ UINT RandomNumberSize, /* [annotation] */ _Out_writes_bytes_(RandomNumberSize) void *pRandomNumber) @@ -1036,13 +1050,13 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::StartSessionKeyRefresh( RandomNumberSize, pRandomNumber); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::FinishSessionKeyRefresh( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::FinishSessionKeyRefresh( /* [annotation] */ _In_ ID3D11CryptoSession *pCryptoSession) { return m_pReal->FinishSessionKeyRefresh(VIDEO_UNWRAP(WrappedID3D11CryptoSession, pCryptoSession)); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::GetEncryptionBltKey( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::GetEncryptionBltKey( /* [annotation] */ _In_ ID3D11CryptoSession *pCryptoSession, /* [annotation] */ _In_ UINT KeySize, /* [annotation] */ _Out_writes_bytes_(KeySize) void *pReadbackKey) { @@ -1050,7 +1064,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::GetEncryptionBltKey( KeySize, pReadbackKey); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::NegotiateAuthenticatedChannelKeyExchange( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::NegotiateAuthenticatedChannelKeyExchange( /* [annotation] */ _In_ ID3D11AuthenticatedChannel *pChannel, /* [annotation] */ _In_ UINT DataSize, /* [annotation] */ _Inout_updates_bytes_(DataSize) void *pData) @@ -1059,7 +1073,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::NegotiateAuthenticatedChan VIDEO_UNWRAP(WrappedID3D11AuthenticatedChannel, pChannel), DataSize, pData); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::QueryAuthenticatedChannel( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::QueryAuthenticatedChannel( /* [annotation] */ _In_ ID3D11AuthenticatedChannel *pChannel, /* [annotation] */ _In_ UINT InputSize, /* [annotation] */ _In_reads_bytes_(InputSize) const void *pInput, @@ -1070,7 +1084,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::QueryAuthenticatedChannel( InputSize, pInput, OutputSize, pOutput); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::ConfigureAuthenticatedChannel( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::ConfigureAuthenticatedChannel( /* [annotation] */ _In_ ID3D11AuthenticatedChannel *pChannel, /* [annotation] */ _In_ UINT InputSize, /* [annotation] */ _In_reads_bytes_(InputSize) const void *pInput, @@ -1080,7 +1094,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::ConfigureAuthenticatedChan VIDEO_UNWRAP(WrappedID3D11AuthenticatedChannel, pChannel), InputSize, pInput, pOutput); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamRotation( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamRotation( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ BOOL Enable, /* [annotation] */ _In_ D3D11_VIDEO_PROCESSOR_ROTATION Rotation) @@ -1089,7 +1103,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamRotati VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, Enable, Rotation); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamRotation( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamRotation( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ BOOL *pEnable, /* [annotation] */ _Out_ D3D11_VIDEO_PROCESSOR_ROTATION *pRotation) @@ -1098,7 +1112,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamRotati VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, pEnable, pRotation); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::SubmitDecoderBuffers1( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::SubmitDecoderBuffers1( /* [annotation] */ _In_ ID3D11VideoDecoder *pDecoder, /* [annotation] */ _In_ UINT NumBuffers, /* [annotation] */ _In_reads_(NumBuffers) const D3D11_VIDEO_DECODER_BUFFER_DESC1 *pBufferDesc) { @@ -1108,7 +1122,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::SubmitDecoderBuffers1( NumBuffers, pBufferDesc); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::GetDataForNewHardwareKey( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::GetDataForNewHardwareKey( /* [annotation] */ _In_ ID3D11CryptoSession *pCryptoSession, /* [annotation] */ _In_ UINT PrivateInputSize, /* [annotation] */ _In_reads_(PrivateInputSize) const void *pPrivatInputData, @@ -1120,7 +1134,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::GetDataForNewHardwareKey( PrivateInputSize, pPrivatInputData, pPrivateOutputData); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::CheckCryptoSessionStatus( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::CheckCryptoSessionStatus( /* [annotation] */ _In_ ID3D11CryptoSession *pCryptoSession, /* [annotation] */ _Out_ D3D11_CRYPTO_SESSION_STATUS *pStatus) { @@ -1130,7 +1144,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::CheckCryptoSessionStatus( VIDEO_UNWRAP(WrappedID3D11CryptoSession, pCryptoSession), pStatus); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::DecoderEnableDownsampling( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::DecoderEnableDownsampling( /* [annotation] */ _In_ ID3D11VideoDecoder *pDecoder, /* [annotation] */ _In_ DXGI_COLOR_SPACE_TYPE InputColorSpace, /* [annotation] */ _In_ const D3D11_VIDEO_SAMPLE_DESC *pOutputDesc, @@ -1142,7 +1156,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::DecoderEnableDownsampling( InputColorSpace, pOutputDesc, ReferenceFrameCount); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::DecoderUpdateDownsampling( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::DecoderUpdateDownsampling( /* [annotation] */ _In_ ID3D11VideoDecoder *pDecoder, /* [annotation] */ _In_ const D3D11_VIDEO_SAMPLE_DESC *pOutputDesc) { @@ -1152,7 +1166,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::DecoderUpdateDownsampling( pOutputDesc); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputColorSpace1( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetOutputColorSpace1( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ DXGI_COLOR_SPACE_TYPE ColorSpace) { @@ -1162,7 +1176,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputColorS VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), ColorSpace); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputShaderUsage( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetOutputShaderUsage( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ BOOL ShaderUsage) { @@ -1172,7 +1186,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputShader VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), ShaderUsage); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputColorSpace1( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetOutputColorSpace1( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _Out_ DXGI_COLOR_SPACE_TYPE *pColorSpace) { @@ -1182,7 +1196,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputColorS VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), pColorSpace); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputShaderUsage( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetOutputShaderUsage( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _Out_ BOOL *pShaderUsage) { @@ -1192,7 +1206,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputShader VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), pShaderUsage); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamColorSpace1( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamColorSpace1( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ DXGI_COLOR_SPACE_TYPE ColorSpace) @@ -1203,7 +1217,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamColorS VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, ColorSpace); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamMirror( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamMirror( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ BOOL Enable, /* [annotation] */ _In_ BOOL FlipHorizontal, /* [annotation] */ _In_ BOOL FlipVertical) @@ -1215,7 +1229,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamMirror FlipHorizontal, FlipVertical); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamColorSpace1( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamColorSpace1( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ DXGI_COLOR_SPACE_TYPE *pColorSpace) @@ -1226,7 +1240,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamColorS VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), StreamIndex, pColorSpace); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamMirror( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamMirror( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ BOOL *pEnable, /* [annotation] */ _Out_ BOOL *pFlipHorizontal, /* [annotation] */ _Out_ BOOL *pFlipVertical) @@ -1238,7 +1252,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamMirror pFlipHorizontal, pFlipVertical); } -HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetBehaviorHints( +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetBehaviorHints( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT OutputWidth, /* [annotation] */ _In_ UINT OutputHeight, /* [annotation] */ _In_ DXGI_FORMAT OutputFormat, /* [annotation] */ _In_ UINT StreamCount, @@ -1253,7 +1267,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetBehaviorH OutputFormat, StreamCount, pStreams, pBehaviorHints); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputHDRMetaData( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetOutputHDRMetaData( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ DXGI_HDR_METADATA_TYPE Type, /* [annotation] */ _In_ UINT Size, /* [annotation] */ _In_reads_bytes_opt_(Size) const void *pHDRMetaData) @@ -1264,7 +1278,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetOutputHDRMet VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), Type, Size, pHDRMetaData); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputHDRMetaData( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetOutputHDRMetaData( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _Out_ DXGI_HDR_METADATA_TYPE *pType, /* [annotation] */ _In_ UINT Size, /* [annotation] */ _Out_writes_bytes_opt_(Size) void *pMetaData) @@ -1275,7 +1289,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetOutputHDRMet VIDEO_UNWRAP(WrappedID3D11VideoProcessor, pVideoProcessor), pType, Size, pMetaData); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamHDRMetaData( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorSetStreamHDRMetaData( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _In_ DXGI_HDR_METADATA_TYPE Type, /* [annotation] */ _In_ UINT Size, @@ -1288,7 +1302,7 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorSetStreamHDRMet pHDRMetaData); } -void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamHDRMetaData( +void STDMETHODCALLTYPE WrappedID3D11VideoContext::VideoProcessorGetStreamHDRMetaData( /* [annotation] */ _In_ ID3D11VideoProcessor *pVideoProcessor, /* [annotation] */ _In_ UINT StreamIndex, /* [annotation] */ _Out_ DXGI_HDR_METADATA_TYPE *pType, /* [annotation] */ _In_ UINT Size, @@ -1301,6 +1315,33 @@ void STDMETHODCALLTYPE WrappedID3D11VideoContext2::VideoProcessorGetStreamHDRMet pMetaData); } +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::DecoderBeginFrame1( + /* [annotation] */ _In_ ID3D11VideoDecoder *pDecoder, + /* [annotation] */ _In_ ID3D11VideoDecoderOutputView *pView, UINT ContentKeySize, + /* [annotation] */ _In_reads_bytes_opt_(ContentKeySize) const void *pContentKey, + /* [annotation] */ _In_range_(0, D3D11_4_VIDEO_DECODER_MAX_HISTOGRAM_COMPONENTS) + UINT NumComponentHistograms, + /* [annotation] */ _In_reads_opt_(NumComponentHistograms) const UINT *pHistogramOffsets, + /* [annotation] */ _In_reads_opt_(NumComponentHistograms) ID3D11Buffer *const *ppHistogramBuffers) +{ + if(!m_pReal3) + return E_NOINTERFACE; + return m_pReal3->DecoderBeginFrame1(VIDEO_UNWRAP(WrappedID3D11VideoDecoder, pDecoder), + VIDEO_UNWRAP(WrappedID3D11VideoDecoderOutputView, pView), + ContentKeySize, pContentKey, NumComponentHistograms, + pHistogramOffsets, ppHistogramBuffers); +} + +HRESULT STDMETHODCALLTYPE WrappedID3D11VideoContext::SubmitDecoderBuffers2( + /* [annotation] */ _In_ ID3D11VideoDecoder *pDecoder, /* [annotation] */ _In_ UINT NumBuffers, + /* [annotation] */ _In_reads_(NumBuffers) const D3D11_VIDEO_DECODER_BUFFER_DESC2 *pBufferDesc) +{ + if(!m_pReal3) + return E_NOINTERFACE; + return m_pReal3->SubmitDecoderBuffers2(VIDEO_UNWRAP(WrappedID3D11VideoDecoder, pDecoder), + NumBuffers, pBufferDesc); +} + void STDMETHODCALLTYPE WrappedID3D11VideoDecoderOutputView::GetResource( /* [annotation] */ _Outptr_ ID3D11Resource **ppResource) { diff --git a/renderdoc/driver/d3d11/d3d11_video.h b/renderdoc/driver/d3d11/d3d11_video.h index c72635b00..30340b81e 100644 --- a/renderdoc/driver/d3d11/d3d11_video.h +++ b/renderdoc/driver/d3d11/d3d11_video.h @@ -257,12 +257,13 @@ struct WrappedID3D11VideoDevice2 : public ID3D11VideoDevice2 _Inout_updates_bytes_(DataSize) void *pData); }; -struct WrappedID3D11VideoContext2 : public ID3D11VideoContext2 +struct WrappedID3D11VideoContext : public ID3D11VideoContext3 { WrappedID3D11DeviceContext *m_pContext = NULL; ID3D11VideoContext *m_pReal = NULL; ID3D11VideoContext1 *m_pReal1 = NULL; ID3D11VideoContext2 *m_pReal2 = NULL; + ID3D11VideoContext3 *m_pReal3 = NULL; ////////////////////////////// // implement IUnknown @@ -1028,6 +1029,30 @@ struct WrappedID3D11VideoContext2 : public ID3D11VideoContext2 _In_ UINT Size, /* [annotation] */ _Out_writes_bytes_opt_(Size) void *pMetaData); + + ////////////////////////////// + // implement ID3D11VideoContext3 + virtual HRESULT STDMETHODCALLTYPE DecoderBeginFrame1( + /* [annotation] */ + _In_ ID3D11VideoDecoder *pDecoder, + /* [annotation] */ + _In_ ID3D11VideoDecoderOutputView *pView, UINT ContentKeySize, + /* [annotation] */ + _In_reads_bytes_opt_(ContentKeySize) const void *pContentKey, + /* [annotation] */ + _In_range_(0, D3D11_4_VIDEO_DECODER_MAX_HISTOGRAM_COMPONENTS) UINT NumComponentHistograms, + /* [annotation] */ + _In_reads_opt_(NumComponentHistograms) const UINT *pHistogramOffsets, + /* [annotation] */ + _In_reads_opt_(NumComponentHistograms) ID3D11Buffer *const *ppHistogramBuffers); + + virtual HRESULT STDMETHODCALLTYPE SubmitDecoderBuffers2( + /* [annotation] */ + _In_ ID3D11VideoDecoder *pDecoder, + /* [annotation] */ + _In_ UINT NumBuffers, + /* [annotation] */ + _In_reads_(NumBuffers) const D3D11_VIDEO_DECODER_BUFFER_DESC2 *pBufferDesc); }; // we don't want to depend on d3d11_resources.h in this header, so replicate diff --git a/renderdoc/driver/d3d12/d3d12_command_list.h b/renderdoc/driver/d3d12/d3d12_command_list.h index 67a79290d..cfdfe7084 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list.h +++ b/renderdoc/driver/d3d12/d3d12_command_list.h @@ -132,6 +132,7 @@ private: ID3D12GraphicsCommandList3 *m_pList3 = NULL; ID3D12GraphicsCommandList4 *m_pList4 = NULL; ID3D12GraphicsCommandList5 *m_pList5 = NULL; + ID3D12GraphicsCommandList6 *m_pList6 = NULL; RefCounter12 m_RefCounter; @@ -179,6 +180,7 @@ public: ID3D12GraphicsCommandList3 *GetReal3() { return m_pList3; } ID3D12GraphicsCommandList4 *GetReal4() { return m_pList4; } ID3D12GraphicsCommandList5 *GetReal5() { return m_pList5; } + ID3D12GraphicsCommandList6 *GetReal6() { return m_pList6; } WrappedID3D12Device *GetWrappedDevice() { return m_pDevice; } D3D12ResourceRecord *GetResourceRecord() { return m_ListRecord; } D3D12ResourceRecord *GetCreationRecord() { return m_CreationRecord; } @@ -188,6 +190,7 @@ public: ID3D12GraphicsCommandList3 *GetCrackedList3(); ID3D12GraphicsCommandList4 *GetCrackedList4(); ID3D12GraphicsCommandList5 *GetCrackedList5(); + ID3D12GraphicsCommandList6 *GetCrackedList6(); ID3D12GraphicsCommandListX *GetWrappedCrackedList(); void SetAMDMarkerInterface(IAmdExtD3DCommandListMarker *marker) { m_AMDMarkers = marker; } @@ -552,6 +555,12 @@ public: IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, RSSetShadingRateImage, ID3D12Resource *shadingRateImage); + + ////////////////////////////// + // implement ID3D12GraphicsCommandList6 + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DispatchMesh, + _In_ UINT ThreadGroupCountX, _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); }; template <> @@ -579,21 +588,26 @@ template <> ResourceId GetResID(ID3D12GraphicsCommandList4 *obj); template <> ResourceId GetResID(ID3D12GraphicsCommandList5 *obj); +template <> +ResourceId GetResID(ID3D12GraphicsCommandList6 *obj); ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList1 *obj); ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList2 *obj); ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList3 *obj); ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList4 *obj); ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList5 *obj); +ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList6 *obj); ID3D12GraphicsCommandList1 *Unwrap1(ID3D12GraphicsCommandList1 *obj); ID3D12GraphicsCommandList2 *Unwrap2(ID3D12GraphicsCommandList2 *obj); ID3D12GraphicsCommandList3 *Unwrap3(ID3D12GraphicsCommandList3 *obj); ID3D12GraphicsCommandList4 *Unwrap4(ID3D12GraphicsCommandList4 *obj); ID3D12GraphicsCommandList5 *Unwrap5(ID3D12GraphicsCommandList5 *obj); +ID3D12GraphicsCommandList6 *Unwrap6(ID3D12GraphicsCommandList6 *obj); WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList1 *obj); WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList2 *obj); WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList3 *obj); WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList4 *obj); WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList5 *obj); +WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList6 *obj); diff --git a/renderdoc/driver/d3d12/d3d12_command_list2_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list2_wrap.cpp index a63d4006b..130b67df3 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list2_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list2_wrap.cpp @@ -80,7 +80,7 @@ void WrappedID3D12GraphicsCommandList::WriteBufferImmediate( m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc)); for(UINT i = 0; i < Count; i++) m_ListRecord->MarkResourceFrameReferenced( - WrappedID3D12Resource1::GetResIDFromAddr(pParams[i].Dest), eFrameRef_PartialWrite); + WrappedID3D12Resource::GetResIDFromAddr(pParams[i].Dest), eFrameRef_PartialWrite); } } diff --git a/renderdoc/driver/d3d12/d3d12_command_list6_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list6_wrap.cpp new file mode 100644 index 000000000..7fd7c472d --- /dev/null +++ b/renderdoc/driver/d3d12/d3d12_command_list6_wrap.cpp @@ -0,0 +1,32 @@ +/****************************************************************************** + * The MIT License (MIT) + * + * Copyright (c) 2020 Baldur Karlsson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + ******************************************************************************/ + +#include "d3d12_command_list.h" + +void STDMETHODCALLTYPE WrappedID3D12GraphicsCommandList::DispatchMesh(UINT ThreadGroupCountX, + UINT ThreadGroupCountY, + UINT ThreadGroupCountZ) +{ + RDCERR("DispatchMesh called but mesh shading is not supported!"); +} diff --git a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp index 658c87dae..4437872c3 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp @@ -59,6 +59,11 @@ ID3D12GraphicsCommandList5 *WrappedID3D12GraphicsCommandList::GetCrackedList5() return Unwrap5(m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].crackedLists.back()); } +ID3D12GraphicsCommandList6 *WrappedID3D12GraphicsCommandList::GetCrackedList6() +{ + return Unwrap6(m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].crackedLists.back()); +} + ID3D12GraphicsCommandListX *WrappedID3D12GraphicsCommandList::GetWrappedCrackedList() { return m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].crackedLists.back(); @@ -1117,8 +1122,8 @@ bool WrappedID3D12GraphicsCommandList::Serialise_IASetIndexBuffer(SerialiserType if(pView) { - WrappedID3D12Resource1::GetResIDFromAddr(pView->BufferLocation, state.ibuffer.buf, - state.ibuffer.offs); + WrappedID3D12Resource::GetResIDFromAddr(pView->BufferLocation, state.ibuffer.buf, + state.ibuffer.offs); state.ibuffer.bytewidth = (pView->Format == DXGI_FORMAT_R32_UINT ? 4 : 2); state.ibuffer.size = pView->SizeInBytes; } @@ -1147,7 +1152,7 @@ void WrappedID3D12GraphicsCommandList::IASetIndexBuffer(const D3D12_INDEX_BUFFER m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc)); if(pView) m_ListRecord->MarkResourceFrameReferenced( - WrappedID3D12Resource1::GetResIDFromAddr(pView->BufferLocation), eFrameRef_Read); + WrappedID3D12Resource::GetResIDFromAddr(pView->BufferLocation), eFrameRef_Read); } } @@ -1200,9 +1205,9 @@ bool WrappedID3D12GraphicsCommandList::Serialise_IASetVertexBuffers( for(UINT i = 0; i < NumViews; i++) { - WrappedID3D12Resource1::GetResIDFromAddr(pViews ? pViews[i].BufferLocation : 0, - state.vbuffers[StartSlot + i].buf, - state.vbuffers[StartSlot + i].offs); + WrappedID3D12Resource::GetResIDFromAddr(pViews ? pViews[i].BufferLocation : 0, + state.vbuffers[StartSlot + i].buf, + state.vbuffers[StartSlot + i].offs); state.vbuffers[StartSlot + i].stride = pViews ? pViews[i].StrideInBytes : 0; state.vbuffers[StartSlot + i].size = pViews ? pViews[i].SizeInBytes : 0; @@ -1227,7 +1232,7 @@ void WrappedID3D12GraphicsCommandList::IASetVertexBuffers(UINT StartSlot, UINT N m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc)); for(UINT i = 0; pViews && i < NumViews; i++) m_ListRecord->MarkResourceFrameReferenced( - WrappedID3D12Resource1::GetResIDFromAddr(pViews[i].BufferLocation), eFrameRef_Read); + WrappedID3D12Resource::GetResIDFromAddr(pViews[i].BufferLocation), eFrameRef_Read); } } @@ -1281,11 +1286,11 @@ bool WrappedID3D12GraphicsCommandList::Serialise_SOSetTargets( { D3D12RenderState::StreamOut &so = state.streamouts[StartSlot + i]; - WrappedID3D12Resource1::GetResIDFromAddr(pViews ? pViews[i].BufferLocation : 0, so.buf, - so.offs); + WrappedID3D12Resource::GetResIDFromAddr(pViews ? pViews[i].BufferLocation : 0, so.buf, + so.offs); - WrappedID3D12Resource1::GetResIDFromAddr(pViews ? pViews[i].BufferFilledSizeLocation : 0, - so.countbuf, so.countoffs); + WrappedID3D12Resource::GetResIDFromAddr(pViews ? pViews[i].BufferFilledSizeLocation : 0, + so.countbuf, so.countoffs); so.size = pViews ? pViews[i].SizeInBytes : 0; } @@ -1309,7 +1314,7 @@ void WrappedID3D12GraphicsCommandList::SOSetTargets(UINT StartSlot, UINT NumView m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc)); for(UINT i = 0; pViews && i < NumViews; i++) m_ListRecord->MarkResourceFrameReferenced( - WrappedID3D12Resource1::GetResIDFromAddr(pViews[i].BufferLocation), eFrameRef_Read); + WrappedID3D12Resource::GetResIDFromAddr(pViews[i].BufferLocation), eFrameRef_Read); } } @@ -1940,7 +1945,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_SetComputeRootConstantBufferVie ResourceId id; uint64_t offs; - WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(BufferLocation, id, offs); bool stateUpdate = false; @@ -1992,7 +1997,7 @@ void WrappedID3D12GraphicsCommandList::SetComputeRootConstantBufferView( ResourceId id; UINT64 offs = 0; - WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(BufferLocation, id, offs); m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc)); m_ListRecord->MarkResourceFrameReferenced(id, eFrameRef_Read); @@ -2020,7 +2025,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_SetComputeRootShaderResourceVie ResourceId id; uint64_t offs; - WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(BufferLocation, id, offs); bool stateUpdate = false; @@ -2072,7 +2077,7 @@ void WrappedID3D12GraphicsCommandList::SetComputeRootShaderResourceView( ResourceId id; UINT64 offs = 0; - WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(BufferLocation, id, offs); m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc)); m_ListRecord->MarkResourceFrameReferenced(id, eFrameRef_Read); @@ -2100,7 +2105,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_SetComputeRootUnorderedAccessVi ResourceId id; uint64_t offs; - WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(BufferLocation, id, offs); bool stateUpdate = false; @@ -2152,7 +2157,7 @@ void WrappedID3D12GraphicsCommandList::SetComputeRootUnorderedAccessView( ResourceId id; UINT64 offs = 0; - WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(BufferLocation, id, offs); m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc)); m_ListRecord->MarkResourceFrameReferenced(id, eFrameRef_Read); @@ -2516,7 +2521,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_SetGraphicsRootConstantBufferVi ResourceId id; uint64_t offs; - WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(BufferLocation, id, offs); bool stateUpdate = false; @@ -2568,7 +2573,7 @@ void WrappedID3D12GraphicsCommandList::SetGraphicsRootConstantBufferView( ResourceId id; UINT64 offs = 0; - WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(BufferLocation, id, offs); m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc)); m_ListRecord->MarkResourceFrameReferenced(id, eFrameRef_Read); @@ -2596,7 +2601,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_SetGraphicsRootShaderResourceVi ResourceId id; uint64_t offs; - WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(BufferLocation, id, offs); bool stateUpdate = false; @@ -2648,7 +2653,7 @@ void WrappedID3D12GraphicsCommandList::SetGraphicsRootShaderResourceView( ResourceId id; UINT64 offs = 0; - WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(BufferLocation, id, offs); m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc)); m_ListRecord->MarkResourceFrameReferenced(id, eFrameRef_Read); @@ -2676,7 +2681,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_SetGraphicsRootUnorderedAccessV ResourceId id; uint64_t offs; - WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(BufferLocation, id, offs); bool stateUpdate = false; @@ -2728,7 +2733,7 @@ void WrappedID3D12GraphicsCommandList::SetGraphicsRootUnorderedAccessView( ResourceId id; UINT64 offs = 0; - WrappedID3D12Resource1::GetResIDFromAddr(BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(BufferLocation, id, offs); m_ListRecord->AddChunk(scope.Get(m_ListRecord->cmdInfo->alloc)); m_ListRecord->MarkResourceFrameReferenced(id, eFrameRef_Read); @@ -4141,7 +4146,7 @@ void WrappedID3D12GraphicsCommandList::ReplayExecuteIndirect(ID3D12GraphicsComma ResourceId id; uint64_t offs = 0; - WrappedID3D12Resource1::GetResIDFromAddr(srcVB->BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(srcVB->BufferLocation, id, offs); RDCASSERT(id != ResourceId()); if(executing) @@ -4167,7 +4172,7 @@ void WrappedID3D12GraphicsCommandList::ReplayExecuteIndirect(ID3D12GraphicsComma ResourceId id; uint64_t offs = 0; - WrappedID3D12Resource1::GetResIDFromAddr(srcIB->BufferLocation, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(srcIB->BufferLocation, id, offs); RDCASSERT(id != ResourceId()); if(executing) @@ -4192,7 +4197,7 @@ void WrappedID3D12GraphicsCommandList::ReplayExecuteIndirect(ID3D12GraphicsComma ResourceId id; uint64_t offs = 0; - WrappedID3D12Resource1::GetResIDFromAddr(*srcAddr, id, offs); + WrappedID3D12Resource::GetResIDFromAddr(*srcAddr, id, offs); RDCASSERT(*srcAddr == 0 || id != ResourceId()); const uint32_t rootIdx = arg.Constant.RootParameterIndex; diff --git a/renderdoc/driver/d3d12/d3d12_command_queue.h b/renderdoc/driver/d3d12/d3d12_command_queue.h index 780955048..8b27ff83d 100644 --- a/renderdoc/driver/d3d12/d3d12_command_queue.h +++ b/renderdoc/driver/d3d12/d3d12_command_queue.h @@ -32,6 +32,44 @@ class WrappedID3D12CommandQueue; +// this aren't documented, they're defined in D3D12TranslationLayer in the d3d11on12 codebase +MIDL_INTERFACE("7974c836-9520-4cda-8d43-d996622e8926") +ID3D12CompatibilityQueue : public IUnknown +{ +public: + virtual HRESULT STDMETHODCALLTYPE AcquireKeyedMutex( + _In_ ID3D12Object * pHeapOrResourceWithKeyedMutex, UINT64 Key, DWORD dwTimeout, + _Reserved_ void *pReserved, _In_range_(0, 0) UINT Reserved) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReleaseKeyedMutex( + _In_ ID3D12Object * pHeapOrResourceWithKeyedMutex, UINT64 Key, _Reserved_ void *pReserved, + _In_range_(0, 0) UINT Reserved) = 0; +}; + +struct WrappedID3D12CompatibilityQueue : public ID3D12CompatibilityQueue +{ + WrappedID3D12CommandQueue &m_pQueue; + ID3D12CompatibilityQueue *m_pReal = NULL; + + WrappedID3D12CompatibilityQueue(WrappedID3D12CommandQueue &dev) : m_pQueue(dev) {} + ////////////////////////////// + // implement IUnknown + HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject); + ULONG STDMETHODCALLTYPE AddRef(); + ULONG STDMETHODCALLTYPE Release(); + + ////////////////////////////// + // implement ID3D12CompatibilityQueue + virtual HRESULT STDMETHODCALLTYPE AcquireKeyedMutex(_In_ ID3D12Object *pHeapOrResourceWithKeyedMutex, + UINT64 Key, DWORD dwTimeout, + _Reserved_ void *pReserved, + _In_range_(0, 0) UINT Reserved); + + virtual HRESULT STDMETHODCALLTYPE ReleaseKeyedMutex(_In_ ID3D12Object *pHeapOrResourceWithKeyedMutex, + UINT64 Key, _Reserved_ void *pReserved, + _In_range_(0, 0) UINT Reserved); +}; + struct WrappedID3D12DebugCommandQueue : public ID3D12DebugCommandQueue { WrappedID3D12CommandQueue *m_pQueue; @@ -114,6 +152,7 @@ class WrappedID3D12CommandQueue : public ID3D12CommandQueue, ReplayStatus m_FailedReplayStatus = ReplayStatus::APIReplayFailed; WrappedID3D12DebugCommandQueue m_WrappedDebug; + WrappedID3D12CompatibilityQueue m_WrappedCompat; rdcarray m_CmdListRecords; diff --git a/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp index a93af0bad..b34958ddf 100644 --- a/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp @@ -484,7 +484,7 @@ void WrappedID3D12CommandQueue::ExecuteCommandListsInternal(UINT NumCommandLists for(auto it = maps.begin(); it != maps.end(); ++it) { - WrappedID3D12Resource1 *res = GetWrapped(it->res); + WrappedID3D12Resource *res = GetWrapped(it->res); UINT subres = it->subres; size_t size = (size_t)it->totalSize; diff --git a/renderdoc/driver/d3d12/d3d12_commands.cpp b/renderdoc/driver/d3d12/d3d12_commands.cpp index 90506cffb..207896ad9 100644 --- a/renderdoc/driver/d3d12/d3d12_commands.cpp +++ b/renderdoc/driver/d3d12/d3d12_commands.cpp @@ -80,6 +80,14 @@ ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList5 *obj) return ((WrappedID3D12GraphicsCommandList *)obj)->GetReal(); } +ID3D12GraphicsCommandList *Unwrap(ID3D12GraphicsCommandList6 *obj) +{ + if(obj == NULL) + return NULL; + + return ((WrappedID3D12GraphicsCommandList *)obj)->GetReal(); +} + ID3D12GraphicsCommandList1 *Unwrap1(ID3D12GraphicsCommandList1 *obj) { if(obj == NULL) @@ -120,6 +128,14 @@ ID3D12GraphicsCommandList5 *Unwrap5(ID3D12GraphicsCommandList5 *obj) return ((WrappedID3D12GraphicsCommandList *)obj)->GetReal5(); } +ID3D12GraphicsCommandList6 *Unwrap6(ID3D12GraphicsCommandList6 *obj) +{ + if(obj == NULL) + return NULL; + + return ((WrappedID3D12GraphicsCommandList *)obj)->GetReal6(); +} + template <> ID3D12CommandList *Unwrap(ID3D12CommandList *obj) { @@ -183,6 +199,15 @@ ResourceId GetResID(ID3D12GraphicsCommandList5 *obj) return ((WrappedID3D12GraphicsCommandList *)obj)->GetResourceID(); } +template <> +ResourceId GetResID(ID3D12GraphicsCommandList6 *obj) +{ + if(obj == NULL) + return ResourceId(); + + return ((WrappedID3D12GraphicsCommandList *)obj)->GetResourceID(); +} + template <> ResourceId GetResID(ID3D12CommandList *obj) { @@ -262,6 +287,11 @@ WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList5 *obj) return ((WrappedID3D12GraphicsCommandList *)obj); } +WrappedID3D12GraphicsCommandList *GetWrapped(ID3D12GraphicsCommandList6 *obj) +{ + return ((WrappedID3D12GraphicsCommandList *)obj); +} + ULONG STDMETHODCALLTYPE WrappedID3D12DebugCommandQueue::AddRef() { if(m_pQueue) @@ -290,6 +320,37 @@ ULONG STDMETHODCALLTYPE WrappedID3D12DebugCommandList::Release() return 1; } +HRESULT STDMETHODCALLTYPE WrappedID3D12CompatibilityQueue::QueryInterface(REFIID riid, + void **ppvObject) +{ + return m_pQueue.QueryInterface(riid, ppvObject); +} + +ULONG STDMETHODCALLTYPE WrappedID3D12CompatibilityQueue::AddRef() +{ + return m_pQueue.AddRef(); +} + +ULONG STDMETHODCALLTYPE WrappedID3D12CompatibilityQueue::Release() +{ + return m_pQueue.Release(); +} + +HRESULT STDMETHODCALLTYPE WrappedID3D12CompatibilityQueue::AcquireKeyedMutex( + _In_ ID3D12Object *pHeapOrResourceWithKeyedMutex, UINT64 Key, DWORD dwTimeout, + _Reserved_ void *pReserved, _In_range_(0, 0) UINT Reserved) +{ + return m_pReal->AcquireKeyedMutex(Unwrap(pHeapOrResourceWithKeyedMutex), Key, dwTimeout, + pReserved, Reserved); +} + +HRESULT STDMETHODCALLTYPE WrappedID3D12CompatibilityQueue::ReleaseKeyedMutex( + _In_ ID3D12Object *pHeapOrResourceWithKeyedMutex, UINT64 Key, _Reserved_ void *pReserved, + _In_range_(0, 0) UINT Reserved) +{ + return m_pReal->ReleaseKeyedMutex(Unwrap(pHeapOrResourceWithKeyedMutex), Key, pReserved, Reserved); +} + HRESULT STDMETHODCALLTYPE WrappedDownlevelQueue::QueryInterface(REFIID riid, void **ppvObject) { return m_pQueue.QueryInterface(riid, ppvObject); @@ -314,7 +375,11 @@ HRESULT STDMETHODCALLTYPE WrappedDownlevelQueue::Present(ID3D12GraphicsCommandLi WrappedID3D12CommandQueue::WrappedID3D12CommandQueue(ID3D12CommandQueue *real, WrappedID3D12Device *device, CaptureState &state) - : RefCounter12(real), m_pDevice(device), m_State(state), m_WrappedDownlevel(*this) + : RefCounter12(real), + m_pDevice(device), + m_State(state), + m_WrappedDownlevel(*this), + m_WrappedCompat(*this) { if(RenderDoc::Inst().GetCrashHandler()) RenderDoc::Inst().GetCrashHandler()->RegisterMemoryRegion(this, @@ -326,6 +391,7 @@ WrappedID3D12CommandQueue::WrappedID3D12CommandQueue(ID3D12CommandQueue *real, { m_pReal->QueryInterface(__uuidof(ID3D12DebugCommandQueue), (void **)&m_WrappedDebug.m_pReal); m_pReal->QueryInterface(__uuidof(ID3D12CommandQueueDownlevel), (void **)&m_pDownlevel); + m_pReal->QueryInterface(__uuidof(ID3D12CompatibilityQueue), (void **)&m_WrappedCompat.m_pReal); } if(RenderDoc::Inst().IsReplayApp()) @@ -383,6 +449,7 @@ WrappedID3D12CommandQueue::~WrappedID3D12CommandQueue() for(size_t i = 0; i < m_Cmd.m_IndirectBuffers.size(); i++) SAFE_RELEASE(m_Cmd.m_IndirectBuffers[i]); + SAFE_RELEASE(m_WrappedCompat.m_pReal); SAFE_RELEASE(m_WrappedDebug.m_pReal); SAFE_RELEASE(m_pReal); } @@ -414,6 +481,19 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12CommandQueue::QueryInterface(REFIID riid, return E_NOINTERFACE; } } + else if(riid == __uuidof(ID3D12CompatibilityQueue)) + { + if(m_WrappedCompat.m_pReal) + { + AddRef(); + *ppvObject = (ID3D12CompatibilityQueue *)&m_WrappedCompat; + return S_OK; + } + else + { + return E_NOINTERFACE; + } + } else if(riid == __uuidof(ID3D12Pageable)) { *ppvObject = (ID3D12Pageable *)this; @@ -760,6 +840,8 @@ bool WrappedID3D12CommandQueue::ProcessChunk(ReadSerialiser &ser, D3D12Chunk chu case D3D12Chunk::CompatDevice_CreateSharedResource: case D3D12Chunk::CompatDevice_CreateSharedHeap: case D3D12Chunk::SetShaderExtUAV: + case D3D12Chunk::Device_CreateCommittedResource2: + case D3D12Chunk::Device_CreatePlacedResource1: RDCERR("Unexpected chunk while processing frame: %s", ToStr(chunk).c_str()); return false; @@ -1255,7 +1337,16 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12GraphicsCommandList::QueryInterface(REFII } else if(riid == __uuidof(ID3D12GraphicsCommandList6)) { - return E_NOINTERFACE; + if(m_pList6) + { + *ppvObject = (ID3D12GraphicsCommandList6 *)this; + AddRef(); + return S_OK; + } + else + { + return E_NOINTERFACE; + } } else if(riid == __uuidof(ID3D12CommandList)) { @@ -1725,7 +1816,7 @@ void D3D12CommandData::AddUsage(const D3D12RenderState &state, D3D12DrawcallTree for(UINT i = 0; i < num; i++) { ResourceId id = - WrappedID3D12Resource1::GetResIDFromAddr(desc->GetCBV().BufferLocation); + WrappedID3D12Resource::GetResIDFromAddr(desc->GetCBV().BufferLocation); AddUsage(drawNode, id, e, cb); diff --git a/renderdoc/driver/d3d12/d3d12_common.h b/renderdoc/driver/d3d12/d3d12_common.h index 5fd91960b..dd1044fd3 100644 --- a/renderdoc/driver/d3d12/d3d12_common.h +++ b/renderdoc/driver/d3d12/d3d12_common.h @@ -35,7 +35,7 @@ // we need to use the most-derived native interface all over the place. To make things easier when // new versions come out we typedef it here when we don't need the specific interface -using ID3D12GraphicsCommandListX = ID3D12GraphicsCommandList5; +using ID3D12GraphicsCommandListX = ID3D12GraphicsCommandList6; // replay only class for handling marker regions struct D3D12MarkerRegion @@ -405,6 +405,7 @@ struct D3D12CommandSignature SERIALISE_INTERFACE(ID3D12GraphicsCommandList3); \ SERIALISE_INTERFACE(ID3D12GraphicsCommandList4); \ SERIALISE_INTERFACE(ID3D12GraphicsCommandList5); \ + SERIALISE_INTERFACE(ID3D12GraphicsCommandList6); \ SERIALISE_INTERFACE(ID3D12RootSignature); \ SERIALISE_INTERFACE(ID3D12Resource); \ SERIALISE_INTERFACE(ID3D12QueryHeap); \ @@ -757,6 +758,8 @@ DECLARE_REFLECTION_STRUCT(D3D12_DESCRIPTOR_RANGE1); DECLARE_REFLECTION_STRUCT(D3D12_ROOT_DESCRIPTOR_TABLE1); DECLARE_REFLECTION_STRUCT(D3D12_ROOT_CONSTANTS); DECLARE_REFLECTION_STRUCT(D3D12_ROOT_DESCRIPTOR1); +DECLARE_REFLECTION_STRUCT(D3D12_RESOURCE_DESC1); +DECLARE_REFLECTION_STRUCT(D3D12_MIP_REGION); DECLARE_DESERIALISE_TYPE(D3D12_DISCARD_REGION); DECLARE_DESERIALISE_TYPE(D3D12_GRAPHICS_PIPELINE_STATE_DESC); @@ -878,5 +881,7 @@ enum class D3D12Chunk : uint32_t CompatDevice_CreateSharedResource, CompatDevice_CreateSharedHeap, SetShaderExtUAV, + Device_CreateCommittedResource2, + Device_CreatePlacedResource1, Max, }; diff --git a/renderdoc/driver/d3d12/d3d12_device.cpp b/renderdoc/driver/d3d12/d3d12_device.cpp index 939343446..4059a6f35 100644 --- a/renderdoc/driver/d3d12/d3d12_device.cpp +++ b/renderdoc/driver/d3d12/d3d12_device.cpp @@ -165,6 +165,104 @@ HRESULT STDMETHODCALLTYPE WrappedDownlevelDevice::QueryVideoMemoryInfo( return m_pDevice.QueryVideoMemoryInfo(NodeIndex, MemorySegmentGroup, pVideoMemoryInfo); } +HRESULT STDMETHODCALLTYPE WrappedID3D12SharingContract::QueryInterface(REFIID riid, void **ppvObject) +{ + return m_pDevice.QueryInterface(riid, ppvObject); +} + +ULONG STDMETHODCALLTYPE WrappedID3D12SharingContract::AddRef() +{ + return m_pDevice.AddRef(); +} + +ULONG STDMETHODCALLTYPE WrappedID3D12SharingContract::Release() +{ + return m_pDevice.Release(); +} + +ID3DDevice *WrappedID3D12SharingContract::GetD3DDevice() +{ + return &m_pDevice; +} + +UINT WrappedID3D12SharingContract::GetWidth() +{ + D3D12_RESOURCE_DESC desc = m_pPresentSource->GetDesc(); + return (UINT)desc.Width; +} + +UINT WrappedID3D12SharingContract::GetHeight() +{ + D3D12_RESOURCE_DESC desc = m_pPresentSource->GetDesc(); + return desc.Height; +} + +DXGI_FORMAT WrappedID3D12SharingContract::GetFormat() +{ + D3D12_RESOURCE_DESC desc = m_pPresentSource->GetDesc(); + return desc.Format; +} + +HWND WrappedID3D12SharingContract::GetHWND() +{ + return m_pPresentHWND; +} + +void STDMETHODCALLTYPE WrappedID3D12SharingContract::Present(_In_ ID3D12Resource *pResource, + UINT Subresource, _In_ HWND window) +{ + // this is similar to the downlevel queue present + + if(m_pPresentHWND != NULL) + { + // don't let the device actually release any refs on the resource, just make it release internal + // resources + m_pPresentSource->AddRef(); + m_pDevice.ReleaseSwapchainResources(this, 0, NULL, NULL); + } + + if(m_pPresentHWND != window) + { + if(m_pPresentHWND != NULL) + { + Keyboard::RemoveInputWindow(WindowingSystem::Win32, m_pPresentHWND); + RenderDoc::Inst().RemoveFrameCapturer(m_pDevice.GetFrameCapturerDevice(), m_pPresentHWND); + } + + Keyboard::AddInputWindow(WindowingSystem::Win32, window); + + RenderDoc::Inst().AddFrameCapturer(m_pDevice.GetFrameCapturerDevice(), window, + m_pDevice.GetFrameCapturer()); + } + + m_pPresentSource = pResource; + m_pPresentHWND = window; + + m_pDevice.WrapSwapchainBuffer(this, GetFormat(), 0, m_pPresentSource); + + m_pDevice.Present(NULL, this, 0, 0); + + m_pReal->Present(Unwrap(pResource), Subresource, window); +} + +void STDMETHODCALLTYPE WrappedID3D12SharingContract::SharedFenceSignal(_In_ ID3D12Fence *pFence, + UINT64 FenceValue) +{ + m_pReal->SharedFenceSignal(Unwrap(pFence), FenceValue); +} + +void STDMETHODCALLTYPE WrappedID3D12SharingContract::BeginCapturableWork(_In_ REFGUID guid) +{ + // undocumented what this does + m_pReal->BeginCapturableWork(guid); +} + +void STDMETHODCALLTYPE WrappedID3D12SharingContract::EndCapturableWork(_In_ REFGUID guid) +{ + // undocumented what this does + m_pReal->EndCapturableWork(guid); +} + HRESULT STDMETHODCALLTYPE WrappedDRED::QueryInterface(REFIID riid, void **ppvObject) { return m_pDevice.QueryInterface(riid, ppvObject); @@ -320,6 +418,7 @@ WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitPara m_WrappedDownlevel(*this), m_DRED(*this), m_DREDSettings(*this), + m_SharingContract(*this), m_CompatDevice(*this), m_WrappedNVAPI(*this) { @@ -343,6 +442,8 @@ WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitPara m_pDevice4 = NULL; m_pDevice5 = NULL; m_pDevice6 = NULL; + m_pDevice7 = NULL; + m_pDevice8 = NULL; m_pDownlevel = NULL; if(m_pDevice) { @@ -352,11 +453,17 @@ WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitPara m_pDevice->QueryInterface(__uuidof(ID3D12Device4), (void **)&m_pDevice4); m_pDevice->QueryInterface(__uuidof(ID3D12Device5), (void **)&m_pDevice5); m_pDevice->QueryInterface(__uuidof(ID3D12Device6), (void **)&m_pDevice6); + m_pDevice->QueryInterface(__uuidof(ID3D12Device7), (void **)&m_pDevice7); + m_pDevice->QueryInterface(__uuidof(ID3D12Device8), (void **)&m_pDevice8); m_pDevice->QueryInterface(__uuidof(ID3D12DeviceRemovedExtendedData), (void **)&m_DRED.m_pReal); + m_pDevice->QueryInterface(__uuidof(ID3D12DeviceRemovedExtendedData1), (void **)&m_DRED.m_pReal1); m_pDevice->QueryInterface(__uuidof(ID3D12DeviceRemovedExtendedDataSettings), (void **)&m_DREDSettings.m_pReal); + m_pDevice->QueryInterface(__uuidof(ID3D12DeviceRemovedExtendedDataSettings1), + (void **)&m_DREDSettings.m_pReal1); m_pDevice->QueryInterface(__uuidof(ID3D12DeviceDownlevel), (void **)&m_pDownlevel); m_pDevice->QueryInterface(__uuidof(ID3D12CompatibilityDevice), (void **)&m_CompatDevice.m_pReal); + m_pDevice->QueryInterface(__uuidof(ID3D12SharingContract), (void **)&m_SharingContract.m_pReal); for(size_t i = 0; i < ARRAY_COUNT(m_DescriptorIncrements); i++) m_DescriptorIncrements[i] = @@ -410,7 +517,7 @@ WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitPara if(realDevice) { - m_ResourceList = new std::map(); + m_ResourceList = new std::map(); m_PipelineList = new rdcarray(); } @@ -631,9 +738,14 @@ WrappedID3D12Device::~WrappedID3D12Device() SAFE_DELETE(m_ResourceManager); SAFE_RELEASE(m_DRED.m_pReal); + SAFE_RELEASE(m_DRED.m_pReal1); SAFE_RELEASE(m_DREDSettings.m_pReal); + SAFE_RELEASE(m_DREDSettings.m_pReal1); SAFE_RELEASE(m_CompatDevice.m_pReal); + SAFE_RELEASE(m_SharingContract.m_pReal); SAFE_RELEASE(m_pDownlevel); + SAFE_RELEASE(m_pDevice8); + SAFE_RELEASE(m_pDevice7); SAFE_RELEASE(m_pDevice6); SAFE_RELEASE(m_pDevice5); SAFE_RELEASE(m_pDevice4); @@ -851,11 +963,29 @@ HRESULT WrappedID3D12Device::QueryInterface(REFIID riid, void **ppvObject) } else if(riid == __uuidof(ID3D12Device7)) { - return E_NOINTERFACE; + if(m_pDevice7) + { + AddRef(); + *ppvObject = (ID3D12Device7 *)this; + return S_OK; + } + else + { + return E_NOINTERFACE; + } } else if(riid == __uuidof(ID3D12Device8)) { - return E_NOINTERFACE; + if(m_pDevice8) + { + AddRef(); + *ppvObject = (ID3D12Device8 *)this; + return S_OK; + } + else + { + return E_NOINTERFACE; + } } else if(riid == __uuidof(ID3D12DeviceDownlevel)) { @@ -959,6 +1089,19 @@ HRESULT WrappedID3D12Device::QueryInterface(REFIID riid, void **ppvObject) return E_NOINTERFACE; } } + else if(riid == __uuidof(ID3D12DeviceRemovedExtendedData1)) + { + if(m_DRED.m_pReal1) + { + AddRef(); + *ppvObject = (ID3D12DeviceRemovedExtendedData1 *)&m_DRED; + return S_OK; + } + else + { + return E_NOINTERFACE; + } + } else if(riid == __uuidof(ID3D12DeviceRemovedExtendedDataSettings)) { if(m_DREDSettings.m_pReal) @@ -972,6 +1115,19 @@ HRESULT WrappedID3D12Device::QueryInterface(REFIID riid, void **ppvObject) return E_NOINTERFACE; } } + else if(riid == __uuidof(ID3D12DeviceRemovedExtendedDataSettings1)) + { + if(m_DREDSettings.m_pReal1) + { + AddRef(); + *ppvObject = (ID3D12DeviceRemovedExtendedDataSettings1 *)&m_DREDSettings; + return S_OK; + } + else + { + return E_NOINTERFACE; + } + } else if(riid == IRenderDoc_uuid) { AddRef(); @@ -991,6 +1147,19 @@ HRESULT WrappedID3D12Device::QueryInterface(REFIID riid, void **ppvObject) return E_NOINTERFACE; } } + else if(riid == __uuidof(ID3D12SharingContract)) + { + if(m_SharingContract.m_pReal) + { + AddRef(); + *ppvObject = (ID3D12SharingContract *)&m_SharingContract; + return S_OK; + } + else + { + return E_NOINTERFACE; + } + } else { WarnUnknownGUID("ID3D12Device", riid); @@ -1124,7 +1293,7 @@ void WrappedID3D12Device::ReleaseSwapchainResources(IDXGISwapper *swapper, UINT if(!res) continue; - WrappedID3D12Resource1 *wrapped = (WrappedID3D12Resource1 *)res; + WrappedID3D12Resource *wrapped = (WrappedID3D12Resource *)res; wrapped->ReleaseInternalRef(); SAFE_RELEASE(wrapped); } @@ -1145,7 +1314,7 @@ void WrappedID3D12Device::NewSwapchainBuffer(IUnknown *backbuffer) if(pRes) { - WrappedID3D12Resource1 *wrapped = (WrappedID3D12Resource1 *)pRes; + WrappedID3D12Resource *wrapped = (WrappedID3D12Resource *)pRes; wrapped->AddInternalRef(); } } @@ -1155,7 +1324,7 @@ bool WrappedID3D12Device::Serialise_WrapSwapchainBuffer(SerialiserType &ser, IDX DXGI_FORMAT bufferFormat, UINT Buffer, IUnknown *realSurface) { - WrappedID3D12Resource1 *pRes = (WrappedID3D12Resource1 *)realSurface; + WrappedID3D12Resource *pRes = (WrappedID3D12Resource *)realSurface; SERIALISE_ELEMENT(Buffer); SERIALISE_ELEMENT_LOCAL(SwapbufferID, GetResID(pRes)).TypedAs("ID3D12Resource *"_lit); @@ -1196,7 +1365,7 @@ bool WrappedID3D12Device::Serialise_WrapSwapchainBuffer(SerialiserType &ser, IDX } else { - WrappedID3D12Resource1 *wrapped = new WrappedID3D12Resource1(fakeBB, this); + WrappedID3D12Resource *wrapped = new WrappedID3D12Resource(fakeBB, this); fakeBB = wrapped; fakeBB->SetName(L"Swap Chain Buffer"); @@ -1231,14 +1400,14 @@ IUnknown *WrappedID3D12Device::WrapSwapchainBuffer(IDXGISwapper *swapper, DXGI_F realSurface->Release(); } - else if(WrappedID3D12Resource1::IsAlloc(query)) + else if(WrappedID3D12Resource::IsAlloc(query)) { // this could be possible if we're doing downlevel presenting pRes = query; } else { - pRes = new WrappedID3D12Resource1((ID3D12Resource *)realSurface, this); + pRes = new WrappedID3D12Resource((ID3D12Resource *)realSurface, this); ResourceId id = GetResID(pRes); @@ -1253,7 +1422,7 @@ IUnknown *WrappedID3D12Device::WrapSwapchainBuffer(IDXGISwapper *swapper, DXGI_F record->DataInSerialiser = false; record->Length = 0; - WrappedID3D12Resource1 *wrapped = (WrappedID3D12Resource1 *)pRes; + WrappedID3D12Resource *wrapped = (WrappedID3D12Resource *)pRes; wrapped->SetResourceRecord(record); @@ -1971,7 +2140,7 @@ void WrappedID3D12Device::StartFrameCapture(void *dev, void *wnd) } m_RefQueues = m_Queues; - m_RefBuffers = WrappedID3D12Resource1::AddRefBuffersBeforeCapture(GetResourceManager()); + m_RefBuffers = WrappedID3D12Resource::AddRefBuffersBeforeCapture(GetResourceManager()); } GetResourceManager()->MarkResourceFrameReferenced(m_ResourceID, eFrameRef_Read); @@ -2032,7 +2201,7 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd) ContainsExecuteIndirect |= (*it)->GetResourceRecord()->ContainsExecuteIndirect; if(ContainsExecuteIndirect) - WrappedID3D12Resource1::RefBuffers(GetResourceManager()); + WrappedID3D12Resource::RefBuffers(GetResourceManager()); m_State = CaptureState::BackgroundCapturing; @@ -2828,14 +2997,6 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12Device::QueryVideoMemoryInfo( return m_pDownlevel->QueryVideoMemoryInfo(NodeIndex, MemorySegmentGroup, pVideoMemoryInfo); } -HRESULT STDMETHODCALLTYPE WrappedID3D12Device::SetBackgroundProcessingMode( - D3D12_BACKGROUND_PROCESSING_MODE Mode, D3D12_MEASUREMENTS_ACTION MeasurementsAction, - _In_opt_ HANDLE hEventToSignalUponCompletion, _Out_opt_ BOOL *pbFurtherMeasurementsDesired) -{ - return m_pDevice6->SetBackgroundProcessingMode( - Mode, MeasurementsAction, hEventToSignalUponCompletion, pbFurtherMeasurementsDesired); -} - byte *WrappedID3D12Device::GetTempMemory(size_t s) { TempMem *mem = (TempMem *)Threading::GetTLSValue(tempMemoryTLSSlot); @@ -3267,6 +3428,12 @@ bool WrappedID3D12Device::ProcessChunk(ReadSerialiser &ser, D3D12Chunk context) return Serialise_OpenSharedHandle(ser, NULL, IID(), NULL); case D3D12Chunk::SetShaderExtUAV: return Serialise_SetShaderExtUAV(ser, GPUVendor::Unknown, 0, 0, true); + case D3D12Chunk::Device_CreateCommittedResource2: + return Serialise_CreateCommittedResource2(ser, NULL, D3D12_HEAP_FLAG_NONE, NULL, + D3D12_RESOURCE_STATE_COMMON, NULL, NULL, IID(), NULL); + case D3D12Chunk::Device_CreatePlacedResource1: + return Serialise_CreatePlacedResource1(ser, NULL, 0, NULL, D3D12_RESOURCE_STATE_COMMON, NULL, + IID(), NULL); // in order to get a warning if we miss a case, we explicitly handle the list/queue chunks here. // If we actually encounter one it's an error (we should hit CaptureBegin first and switch to diff --git a/renderdoc/driver/d3d12/d3d12_device.h b/renderdoc/driver/d3d12/d3d12_device.h index fcf4c54d4..460240d7e 100644 --- a/renderdoc/driver/d3d12/d3d12_device.h +++ b/renderdoc/driver/d3d12/d3d12_device.h @@ -59,7 +59,7 @@ struct D3D12InitParams DECLARE_REFLECTION_STRUCT(D3D12InitParams); class WrappedID3D12Device; -class WrappedID3D12Resource1; +class WrappedID3D12Resource; class WrappedID3D12PipelineState; class D3D12Replay; @@ -292,10 +292,11 @@ struct WrappedDownlevelDevice : public ID3D12DeviceDownlevel _Out_ DXGI_QUERY_VIDEO_MEMORY_INFO *pVideoMemoryInfo); }; -struct WrappedDRED : public ID3D12DeviceRemovedExtendedData +struct WrappedDRED : public ID3D12DeviceRemovedExtendedData1 { WrappedID3D12Device &m_pDevice; ID3D12DeviceRemovedExtendedData *m_pReal = NULL; + ID3D12DeviceRemovedExtendedData1 *m_pReal1 = NULL; WrappedDRED(WrappedID3D12Device &dev) : m_pDevice(dev) {} ////////////////////////////// @@ -315,12 +316,25 @@ struct WrappedDRED : public ID3D12DeviceRemovedExtendedData { return m_pReal->GetPageFaultAllocationOutput(pOutput); } + + ////////////////////////////// + // implement ID3D12DeviceRemovedExtendedData1 + virtual HRESULT STDMETHODCALLTYPE GetAutoBreadcrumbsOutput1(D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT1 *pOutput) + { + return m_pReal1->GetAutoBreadcrumbsOutput1(pOutput); + } + + virtual HRESULT STDMETHODCALLTYPE GetPageFaultAllocationOutput1(D3D12_DRED_PAGE_FAULT_OUTPUT1 *pOutput) + { + return m_pReal1->GetPageFaultAllocationOutput1(pOutput); + } }; -struct WrappedDREDSettings : public ID3D12DeviceRemovedExtendedDataSettings +struct WrappedDREDSettings : public ID3D12DeviceRemovedExtendedDataSettings1 { WrappedID3D12Device &m_pDevice; ID3D12DeviceRemovedExtendedDataSettings *m_pReal = NULL; + ID3D12DeviceRemovedExtendedDataSettings1 *m_pReal1 = NULL; WrappedDREDSettings(WrappedID3D12Device &dev) : m_pDevice(dev) {} ////////////////////////////// @@ -343,6 +357,50 @@ struct WrappedDREDSettings : public ID3D12DeviceRemovedExtendedDataSettings { m_pReal->SetWatsonDumpEnablement(setting); } + + ////////////////////////////// + // implement ID3D12DeviceRemovedExtendedDataSettings1 + virtual void STDMETHODCALLTYPE SetBreadcrumbContextEnablement(D3D12_DRED_ENABLEMENT Enablement) + { + m_pReal1->SetBreadcrumbContextEnablement(Enablement); + } +}; + +struct WrappedID3D12SharingContract : public ID3D12SharingContract, public IDXGISwapper +{ +private: + ID3D12Resource *m_pPresentSource = NULL; + HWND m_pPresentHWND = NULL; + +public: + WrappedID3D12Device &m_pDevice; + ID3D12SharingContract *m_pReal = NULL; + + WrappedID3D12SharingContract(WrappedID3D12Device &dev) : m_pDevice(dev) {} + ////////////////////////////// + // implement IDXGISwapper + virtual ID3DDevice *GetD3DDevice(); + virtual int GetNumBackbuffers() { return 1; } + virtual IUnknown **GetBackbuffers() { return (IUnknown **)&m_pPresentSource; } + virtual int GetLastPresentedBuffer() { return 0; } + virtual UINT GetWidth(); + virtual UINT GetHeight(); + virtual DXGI_FORMAT GetFormat(); + virtual HWND GetHWND(); + + ////////////////////////////// + // implement IUnknown + HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject); + ULONG STDMETHODCALLTYPE AddRef(); + ULONG STDMETHODCALLTYPE Release(); + + ////////////////////////////// + // implement ID3D12SharingContract + virtual void STDMETHODCALLTYPE Present(_In_ ID3D12Resource *pResource, UINT Subresource, + _In_ HWND window); + virtual void STDMETHODCALLTYPE SharedFenceSignal(_In_ ID3D12Fence *pFence, UINT64 FenceValue); + virtual void STDMETHODCALLTYPE BeginCapturableWork(_In_ REFGUID guid); + virtual void STDMETHODCALLTYPE EndCapturableWork(_In_ REFGUID guid); }; // these aren't documented, they're defined in D3D12TranslationLayer in the d3d11on12 codebase @@ -450,7 +508,7 @@ class WrappedID3D12CommandQueue; template \ bool CONCAT(Serialise_, func(SerialiserType &ser, __VA_ARGS__)); -class WrappedID3D12Device : public IFrameCapturer, public ID3DDevice, public ID3D12Device6 +class WrappedID3D12Device : public IFrameCapturer, public ID3DDevice, public ID3D12Device8 { private: ID3D12Device *m_pDevice; @@ -460,6 +518,8 @@ private: ID3D12Device4 *m_pDevice4; ID3D12Device5 *m_pDevice5; ID3D12Device6 *m_pDevice6; + ID3D12Device7 *m_pDevice7; + ID3D12Device8 *m_pDevice8; ID3D12DeviceDownlevel *m_pDownlevel; // list of all queues being captured @@ -513,6 +573,7 @@ private: DummyID3D12InfoQueue m_DummyInfoQueue; DummyID3D12DebugDevice m_DummyDebug; WrappedID3D12DebugDevice m_WrappedDebug; + WrappedID3D12SharingContract m_SharingContract; D3D12Replay *m_Replay; D3D12ShaderCache *m_ShaderCache = NULL; @@ -598,7 +659,7 @@ private: std::set m_Cubemaps; // only valid on replay - std::map *m_ResourceList = NULL; + std::map *m_ResourceList = NULL; rdcarray *m_PipelineList = NULL; struct SwapPresentInfo @@ -650,7 +711,7 @@ public: void RemoveQueue(WrappedID3D12CommandQueue *queue); // only valid on replay - std::map &GetResourceList() { return *m_ResourceList; } + std::map &GetResourceList() { return *m_ResourceList; } rdcarray &GetPipelineList() { return *m_PipelineList; } //////////////////////////////////////////////////////////////// // non wrapping interface @@ -808,7 +869,8 @@ public: if(iid == __uuidof(ID3D12Device) || iid == __uuidof(ID3D12Device1) || iid == __uuidof(ID3D12Device2) || iid == __uuidof(ID3D12Device3) || iid == __uuidof(ID3D12Device4) || iid == __uuidof(ID3D12Device5) || - iid == __uuidof(ID3D12Device6)) + iid == __uuidof(ID3D12Device6) || iid == __uuidof(ID3D12Device7) || + iid == __uuidof(ID3D12Device8)) return true; return false; @@ -829,6 +891,10 @@ public: return (ID3D12Device5 *)this; else if(iid == __uuidof(ID3D12Device6)) return (ID3D12Device6 *)this; + else if(iid == __uuidof(ID3D12Device7)) + return (ID3D12Device7 *)this; + else if(iid == __uuidof(ID3D12Device8)) + return (ID3D12Device8 *)this; RDCERR("Requested unknown device interface %s", ToStr(iid).c_str()); @@ -902,6 +968,18 @@ public: this->AddRef(); return S_OK; } + else if(riid == __uuidof(ID3D12Device7)) + { + *ppvDevice = (ID3D12Device7 *)this; + this->AddRef(); + return S_OK; + } + else if(riid == __uuidof(ID3D12Device8)) + { + *ppvDevice = (ID3D12Device8 *)this; + this->AddRef(); + return S_OK; + } return E_NOINTERFACE; } @@ -1271,4 +1349,51 @@ public: virtual HRESULT STDMETHODCALLTYPE SetBackgroundProcessingMode( D3D12_BACKGROUND_PROCESSING_MODE Mode, D3D12_MEASUREMENTS_ACTION MeasurementsAction, _In_opt_ HANDLE hEventToSignalUponCompletion, _Out_opt_ BOOL *pbFurtherMeasurementsDesired); + + ////////////////////////////// + // implement ID3D12Device7 + virtual HRESULT STDMETHODCALLTYPE AddToStateObject(const D3D12_STATE_OBJECT_DESC *pAddition, + ID3D12StateObject *pStateObjectToGrowFrom, + REFIID riid, + _COM_Outptr_ void **ppNewStateObject); + + virtual HRESULT STDMETHODCALLTYPE + CreateProtectedResourceSession1(_In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *pDesc, + _In_ REFIID riid, _COM_Outptr_ void **ppSession); + + ////////////////////////////// + // implement ID3D12Device8 + virtual D3D12_RESOURCE_ALLOCATION_INFO STDMETHODCALLTYPE GetResourceAllocationInfo2( + UINT visibleMask, UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + + IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateCommittedResource2, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, _COM_Outptr_opt_ void **ppvResource); + + IMPLEMENT_FUNCTION_THREAD_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreatePlacedResource1, + _In_ ID3D12Heap *pHeap, UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, _COM_Outptr_opt_ void **ppvResource); + + virtual void STDMETHODCALLTYPE CreateSamplerFeedbackUnorderedAccessView( + _In_opt_ ID3D12Resource *pTargetedResource, _In_opt_ ID3D12Resource *pFeedbackResource, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + virtual void STDMETHODCALLTYPE GetCopyableFootprints1( + _In_ const D3D12_RESOURCE_DESC1 *pResourceDesc, + _In_range_(0, D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0, D3D12_REQ_SUBRESOURCES - FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, _Out_opt_ UINT64 *pTotalBytes); }; diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp index f2557849d..94f2ab8cf 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp @@ -305,7 +305,7 @@ HRESULT WrappedID3D12Device::CreateCommandList(UINT nodeMask, D3D12_COMMAND_LIST if(riid != __uuidof(ID3D12GraphicsCommandList) && riid != __uuidof(ID3D12CommandList) && riid != __uuidof(ID3D12GraphicsCommandList1) && riid != __uuidof(ID3D12GraphicsCommandList2) && riid != __uuidof(ID3D12GraphicsCommandList3) && riid != __uuidof(ID3D12GraphicsCommandList4) && - riid != __uuidof(ID3D12GraphicsCommandList5)) + riid != __uuidof(ID3D12GraphicsCommandList5) && riid != __uuidof(ID3D12GraphicsCommandList6)) return E_NOINTERFACE; void *realptr = NULL; @@ -330,6 +330,8 @@ HRESULT WrappedID3D12Device::CreateCommandList(UINT nodeMask, D3D12_COMMAND_LIST real = (ID3D12GraphicsCommandList4 *)realptr; else if(riid == __uuidof(ID3D12GraphicsCommandList5)) real = (ID3D12GraphicsCommandList5 *)realptr; + else if(riid == __uuidof(ID3D12GraphicsCommandList6)) + real = (ID3D12GraphicsCommandList6 *)realptr; if(SUCCEEDED(ret)) { @@ -382,6 +384,8 @@ HRESULT WrappedID3D12Device::CreateCommandList(UINT nodeMask, D3D12_COMMAND_LIST *ppCommandList = (ID3D12GraphicsCommandList4 *)wrapped; else if(riid == __uuidof(ID3D12GraphicsCommandList5)) *ppCommandList = (ID3D12GraphicsCommandList5 *)wrapped; + else if(riid == __uuidof(ID3D12GraphicsCommandList6)) + *ppCommandList = (ID3D12GraphicsCommandList6 *)wrapped; else if(riid == __uuidof(ID3D12CommandList)) *ppCommandList = (ID3D12CommandList *)wrapped; else @@ -1080,7 +1084,7 @@ void WrappedID3D12Device::CreateConstantBufferView(const D3D12_CONSTANT_BUFFER_V } GetResourceManager()->MarkResourceFrameReferenced( - WrappedID3D12Resource1::GetResIDFromAddr(pDesc->BufferLocation), eFrameRef_Read); + WrappedID3D12Resource::GetResIDFromAddr(pDesc->BufferLocation), eFrameRef_Read); } GetWrapped(DestDescriptor)->Init(pDesc); @@ -1300,11 +1304,11 @@ bool WrappedID3D12Device::Serialise_CreateCommittedResource( SERIALISE_ELEMENT(InitialResourceState); SERIALISE_ELEMENT_OPT(pOptimizedClearValue); SERIALISE_ELEMENT_LOCAL(guid, riidResource).Named("riidResource"_lit); - SERIALISE_ELEMENT_LOCAL(pResource, ((WrappedID3D12Resource1 *)*ppvResource)->GetResourceID()) + SERIALISE_ELEMENT_LOCAL(pResource, ((WrappedID3D12Resource *)*ppvResource)->GetResourceID()) .TypedAs("ID3D12Resource *"_lit); SERIALISE_ELEMENT_LOCAL(gpuAddress, - ((WrappedID3D12Resource1 *)*ppvResource)->GetGPUVirtualAddressIfBuffer()) + ((WrappedID3D12Resource *)*ppvResource)->GetGPUVirtualAddressIfBuffer()) .Hidden(); SERIALISE_CHECK_READ_ERRORS(); @@ -1357,7 +1361,7 @@ bool WrappedID3D12Device::Serialise_CreateCommittedResource( SetObjName(ret, StringFormat::Fmt("Committed Resource %s %s", ToStr(desc.Dimension).c_str(), ToStr(pResource).c_str())); - ret = new WrappedID3D12Resource1(ret, this); + ret = new WrappedID3D12Resource(ret, this); GetResourceManager()->AddLiveResource(pResource, ret); @@ -1418,7 +1422,8 @@ HRESULT WrappedID3D12Device::CreateCommittedResource(const D3D12_HEAP_PROPERTIES return m_pDevice->CreateCommittedResource(pHeapProperties, HeapFlags, pDesc, InitialResourceState, pOptimizedClearValue, riidResource, NULL); - if(riidResource != __uuidof(ID3D12Resource) && riidResource != __uuidof(ID3D12Resource1)) + if(riidResource != __uuidof(ID3D12Resource) && riidResource != __uuidof(ID3D12Resource1) && + riidResource != __uuidof(ID3D12Resource2)) return E_NOINTERFACE; const D3D12_RESOURCE_DESC *pCreateDesc = pDesc; @@ -1443,10 +1448,12 @@ HRESULT WrappedID3D12Device::CreateCommittedResource(const D3D12_HEAP_PROPERTIES real = (ID3D12Resource *)realptr; else if(riidResource == __uuidof(ID3D12Resource1)) real = (ID3D12Resource1 *)realptr; + else if(riidResource == __uuidof(ID3D12Resource2)) + real = (ID3D12Resource2 *)realptr; if(SUCCEEDED(ret)) { - WrappedID3D12Resource1 *wrapped = new WrappedID3D12Resource1(real, this); + WrappedID3D12Resource *wrapped = new WrappedID3D12Resource(real, this); if(IsCaptureMode(m_State)) { @@ -1483,7 +1490,12 @@ HRESULT WrappedID3D12Device::CreateCommittedResource(const D3D12_HEAP_PROPERTIES states.fill(GetNumSubresources(m_pDevice, pDesc), InitialResourceState); } - *ppvResource = (ID3D12Resource *)wrapped; + if(riidResource == __uuidof(ID3D12Resource)) + *ppvResource = (ID3D12Resource *)wrapped; + else if(riidResource == __uuidof(ID3D12Resource1)) + *ppvResource = (ID3D12Resource1 *)wrapped; + else if(riidResource == __uuidof(ID3D12Resource2)) + *ppvResource = (ID3D12Resource2 *)wrapped; // while actively capturing we keep all buffers around to prevent the address lookup from // losing addresses we might need (or the manageable but annoying problem of an address being @@ -1507,7 +1519,7 @@ bool WrappedID3D12Device::Serialise_CreateHeap(SerialiserType &ser, const D3D12_ { SERIALISE_ELEMENT_LOCAL(Descriptor, *pDesc).Named("pDesc"_lit); SERIALISE_ELEMENT_LOCAL(guid, riid).Named("riid"_lit); - SERIALISE_ELEMENT_LOCAL(pHeap, ((WrappedID3D12Heap1 *)*ppvHeap)->GetResourceID()) + SERIALISE_ELEMENT_LOCAL(pHeap, ((WrappedID3D12Heap *)*ppvHeap)->GetResourceID()) .TypedAs("ID3D12Heap *"_lit); SERIALISE_CHECK_READ_ERRORS(); @@ -1534,7 +1546,7 @@ bool WrappedID3D12Device::Serialise_CreateHeap(SerialiserType &ser, const D3D12_ } else { - ret = new WrappedID3D12Heap1(ret, this); + ret = new WrappedID3D12Heap(ret, this); GetResourceManager()->AddLiveResource(pHeap, ret); } @@ -1566,7 +1578,7 @@ HRESULT WrappedID3D12Device::CreateHeap(const D3D12_HEAP_DESC *pDesc, REFIID rii if(SUCCEEDED(ret)) { - WrappedID3D12Heap1 *wrapped = new WrappedID3D12Heap1(real, this); + WrappedID3D12Heap *wrapped = new WrappedID3D12Heap(real, this); if(IsCaptureMode(m_State)) { @@ -1608,11 +1620,11 @@ bool WrappedID3D12Device::Serialise_CreatePlacedResource( SERIALISE_ELEMENT(InitialState); SERIALISE_ELEMENT_OPT(pOptimizedClearValue); SERIALISE_ELEMENT_LOCAL(guid, riid).Named("riid"_lit); - SERIALISE_ELEMENT_LOCAL(pResource, ((WrappedID3D12Resource1 *)*ppvResource)->GetResourceID()) + SERIALISE_ELEMENT_LOCAL(pResource, ((WrappedID3D12Resource *)*ppvResource)->GetResourceID()) .TypedAs("ID3D12Resource *"_lit); SERIALISE_ELEMENT_LOCAL(gpuAddress, - ((WrappedID3D12Resource1 *)*ppvResource)->GetGPUVirtualAddressIfBuffer()) + ((WrappedID3D12Resource *)*ppvResource)->GetGPUVirtualAddressIfBuffer()) .Hidden(); SERIALISE_CHECK_READ_ERRORS(); @@ -1657,7 +1669,7 @@ bool WrappedID3D12Device::Serialise_CreatePlacedResource( SetObjName(ret, StringFormat::Fmt("Placed Resource %s %s", ToStr(Descriptor.Dimension).c_str(), ToStr(pResource).c_str())); - ret = new WrappedID3D12Resource1(ret, this); + ret = new WrappedID3D12Resource(ret, this); GetResourceManager()->AddLiveResource(pResource, ret); @@ -1718,7 +1730,8 @@ HRESULT WrappedID3D12Device::CreatePlacedResource(ID3D12Heap *pHeap, UINT64 Heap return m_pDevice->CreatePlacedResource(Unwrap(pHeap), HeapOffset, pDesc, InitialState, pOptimizedClearValue, riid, NULL); - if(riid != __uuidof(ID3D12Resource)) + if(riid != __uuidof(ID3D12Resource) && riid != __uuidof(ID3D12Resource1) && + riid != __uuidof(ID3D12Resource2)) return E_NOINTERFACE; const D3D12_RESOURCE_DESC *pCreateDesc = pDesc; @@ -1734,13 +1747,13 @@ HRESULT WrappedID3D12Device::CreatePlacedResource(ID3D12Heap *pHeap, UINT64 Heap ID3D12Resource *real = NULL; HRESULT ret; - SERIALISE_TIME_CALL(ret = m_pDevice->CreatePlacedResource(Unwrap(pHeap), HeapOffset, pCreateDesc, - InitialState, pOptimizedClearValue, - riid, (void **)&real)); + SERIALISE_TIME_CALL(ret = m_pDevice->CreatePlacedResource( + Unwrap(pHeap), HeapOffset, pCreateDesc, InitialState, + pOptimizedClearValue, __uuidof(ID3D12Resource), (void **)&real)); if(SUCCEEDED(ret)) { - WrappedID3D12Resource1 *wrapped = new WrappedID3D12Resource1(real, this); + WrappedID3D12Resource *wrapped = new WrappedID3D12Resource(real, this); if(IsCaptureMode(m_State)) { @@ -1777,7 +1790,12 @@ HRESULT WrappedID3D12Device::CreatePlacedResource(ID3D12Heap *pHeap, UINT64 Heap states.fill(GetNumSubresources(m_pDevice, pDesc), InitialState); } - *ppvResource = (ID3D12Resource *)wrapped; + if(riid == __uuidof(ID3D12Resource)) + *ppvResource = (ID3D12Resource *)wrapped; + else if(riid == __uuidof(ID3D12Resource1)) + *ppvResource = (ID3D12Resource1 *)wrapped; + else if(riid == __uuidof(ID3D12Resource2)) + *ppvResource = (ID3D12Resource2 *)wrapped; // while actively capturing we keep all buffers around to prevent the address lookup from // losing addresses we might need (or the manageable but annoying problem of an address being @@ -1821,7 +1839,7 @@ bool WrappedID3D12Device::Serialise_CreateFence(SerialiserType &ser, UINT64 Init SERIALISE_ELEMENT(InitialValue); SERIALISE_ELEMENT(Flags); SERIALISE_ELEMENT_LOCAL(guid, riid).Named("riid"_lit); - SERIALISE_ELEMENT_LOCAL(pFence, ((WrappedID3D12Fence1 *)*ppFence)->GetResourceID()) + SERIALISE_ELEMENT_LOCAL(pFence, ((WrappedID3D12Fence *)*ppFence)->GetResourceID()) .TypedAs("ID3D12Fence *"_lit); SERIALISE_CHECK_READ_ERRORS(); @@ -1844,7 +1862,7 @@ bool WrappedID3D12Device::Serialise_CreateFence(SerialiserType &ser, UINT64 Init } else { - ret = new WrappedID3D12Fence1(ret, this); + ret = new WrappedID3D12Fence(ret, this); GetResourceManager()->AddLiveResource(pFence, ret); } @@ -1877,7 +1895,7 @@ HRESULT WrappedID3D12Device::CreateFence(UINT64 InitialValue, D3D12_FENCE_FLAGS if(SUCCEEDED(ret)) { - WrappedID3D12Fence1 *wrapped = new WrappedID3D12Fence1(real, this); + WrappedID3D12Fence *wrapped = new WrappedID3D12Fence(real, this); if(IsCaptureMode(m_State)) { @@ -2337,7 +2355,9 @@ bool WrappedID3D12Device::Serialise_OpenSharedHandle(SerialiserType &ser, HANDLE SERIALISE_CHECK_READ_ERRORS(); - bool isRes = ResourceRIID == __uuidof(ID3D12Resource) || ResourceRIID == __uuidof(ID3D12Resource1); + bool isRes = ResourceRIID == __uuidof(ID3D12Resource) || + ResourceRIID == __uuidof(ID3D12Resource1) || + ResourceRIID == __uuidof(ID3D12Resource2); bool isFence = ResourceRIID == __uuidof(ID3D12Fence) || ResourceRIID == __uuidof(ID3D12Fence1); bool isHeap = ResourceRIID == __uuidof(ID3D12Heap) || ResourceRIID == __uuidof(ID3D12Heap1); if(isFence) @@ -2371,7 +2391,7 @@ bool WrappedID3D12Device::Serialise_OpenSharedHandle(SerialiserType &ser, HANDLE } else { - ret = new WrappedID3D12Fence1(ret, this); + ret = new WrappedID3D12Fence(ret, this); GetResourceManager()->AddLiveResource(resourceId, ret); } @@ -2391,6 +2411,8 @@ bool WrappedID3D12Device::Serialise_OpenSharedHandle(SerialiserType &ser, HANDLE res = (ID3D12Resource *)(ID3D12DeviceChild *)*ppvObj; if(ResourceRIID == __uuidof(ID3D12Resource1)) res = (ID3D12Resource1 *)(ID3D12DeviceChild *)*ppvObj; + else if(ResourceRIID == __uuidof(ID3D12Resource2)) + res = (ID3D12Resource2 *)(ID3D12DeviceChild *)*ppvObj; desc = res->GetDesc(); res->GetHeapProperties(&heapProperties, &heapFlags); } @@ -2430,7 +2452,7 @@ bool WrappedID3D12Device::Serialise_OpenSharedHandle(SerialiserType &ser, HANDLE SetObjName(ret, StringFormat::Fmt("Shared Resource %s %s", ToStr(desc.Dimension).c_str(), ToStr(resourceId).c_str())); - ret = new WrappedID3D12Resource1(ret, this); + ret = new WrappedID3D12Resource(ret, this); GetResourceManager()->AddLiveResource(resourceId, ret); @@ -2505,7 +2527,7 @@ bool WrappedID3D12Device::Serialise_OpenSharedHandle(SerialiserType &ser, HANDLE } else { - ret = new WrappedID3D12Heap1(ret, this); + ret = new WrappedID3D12Heap(ret, this); GetResourceManager()->AddLiveResource(resourceId, ret); } @@ -2552,7 +2574,8 @@ HRESULT WrappedID3D12Device::OpenSharedHandleInternal(D3D12Chunk chunkType, } bool isDXGIRes = riid == __uuidof(IDXGIResource) || riid == __uuidof(IDXGIResource1); - bool isRes = riid == __uuidof(ID3D12Resource) || riid == __uuidof(ID3D12Resource1); + bool isRes = riid == __uuidof(ID3D12Resource) || riid == __uuidof(ID3D12Resource1) || + riid == __uuidof(ID3D12Resource2); bool isFence = riid == __uuidof(ID3D12Fence) || riid == __uuidof(ID3D12Fence1); bool isHeap = riid == __uuidof(ID3D12Heap) || riid == __uuidof(ID3D12Heap1); bool isDeviceChild = riid == __uuidof(ID3D12DeviceChild); @@ -2663,7 +2686,7 @@ HRESULT WrappedID3D12Device::OpenSharedHandleInternal(D3D12Chunk chunkType, if(riid_internal == __uuidof(ID3D12Fence1)) real = (ID3D12Fence1 *)ret; - WrappedID3D12Fence1 *wrapped = new WrappedID3D12Fence1(real, this); + WrappedID3D12Fence *wrapped = new WrappedID3D12Fence(real, this); wrappedDeviceChild = wrapped; @@ -2677,8 +2700,10 @@ HRESULT WrappedID3D12Device::OpenSharedHandleInternal(D3D12Chunk chunkType, ID3D12Resource *real = (ID3D12Resource *)ret; if(riid_internal == __uuidof(ID3D12Resource1)) real = (ID3D12Resource1 *)ret; + else if(riid_internal == __uuidof(ID3D12Resource2)) + real = (ID3D12Resource2 *)ret; - WrappedID3D12Resource1 *wrapped = new WrappedID3D12Resource1(real, this); + WrappedID3D12Resource *wrapped = new WrappedID3D12Resource(real, this); if(HeapFlags & D3D12_HEAP_FLAG_CREATE_NOT_RESIDENT) wrapped->SetResident(false); @@ -2723,7 +2748,7 @@ HRESULT WrappedID3D12Device::OpenSharedHandleInternal(D3D12Chunk chunkType, if(riid_internal == __uuidof(ID3D12Heap1)) real = (ID3D12Heap1 *)ret; - WrappedID3D12Heap1 *wrapped = new WrappedID3D12Heap1(real, this); + WrappedID3D12Heap *wrapped = new WrappedID3D12Heap(real, this); if(HeapFlags & D3D12_HEAP_FLAG_CREATE_NOT_RESIDENT) wrapped->SetResident(false); @@ -2775,9 +2800,9 @@ HRESULT WrappedID3D12Device::MakeResident(UINT NumObjects, ID3D12Pageable *const heap->SetResident(true); unwrapped[i] = heap->GetReal(); } - else if(WrappedID3D12Resource1::IsAlloc(ppObjects[i])) + else if(WrappedID3D12Resource::IsAlloc(ppObjects[i])) { - WrappedID3D12Resource1 *res = (WrappedID3D12Resource1 *)ppObjects[i]; + WrappedID3D12Resource *res = (WrappedID3D12Resource *)ppObjects[i]; res->SetResident(true); unwrapped[i] = res->GetReal(); } @@ -2802,9 +2827,9 @@ HRESULT WrappedID3D12Device::Evict(UINT NumObjects, ID3D12Pageable *const *ppObj heap->SetResident(false); unwrapped[i] = heap->GetReal(); } - else if(WrappedID3D12Resource1::IsAlloc(ppObjects[i])) + else if(WrappedID3D12Resource::IsAlloc(ppObjects[i])) { - WrappedID3D12Resource1 *res = (WrappedID3D12Resource1 *)ppObjects[i]; + WrappedID3D12Resource *res = (WrappedID3D12Resource *)ppObjects[i]; res->SetResident(false); unwrapped[i] = res->GetReal(); } diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap1.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap1.cpp index 9c6c18e77..cb4a7e307 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap1.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap1.cpp @@ -48,7 +48,7 @@ HRESULT WrappedID3D12Device::CreatePipelineLibrary(_In_reads_(BlobLength) const if(BlobLength > 0) return D3D12_ERROR_DRIVER_VERSION_MISMATCH; - WrappedID3D12PipelineLibrary1 *pipeLibrary = new WrappedID3D12PipelineLibrary1(this); + WrappedID3D12PipelineLibrary *pipeLibrary = new WrappedID3D12PipelineLibrary(this); if(riid == __uuidof(ID3D12PipelineLibrary)) { diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap3.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap3.cpp index d434bbe0e..7ee87661c 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap3.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap3.cpp @@ -40,7 +40,7 @@ HRESULT WrappedID3D12Device::OpenExistingHeapFromAddress(const void *pAddress, R if(SUCCEEDED(ret)) { - WrappedID3D12Heap1 *wrapped = new WrappedID3D12Heap1(real, this); + WrappedID3D12Heap *wrapped = new WrappedID3D12Heap(real, this); if(IsCaptureMode(m_State)) { @@ -108,7 +108,7 @@ HRESULT WrappedID3D12Device::OpenExistingHeapFromFileMapping(HANDLE hFileMapping if(SUCCEEDED(ret)) { - WrappedID3D12Heap1 *wrapped = new WrappedID3D12Heap1(real, this); + WrappedID3D12Heap *wrapped = new WrappedID3D12Heap(real, this); if(IsCaptureMode(m_State)) { @@ -173,9 +173,9 @@ HRESULT WrappedID3D12Device::EnqueueMakeResident(D3D12_RESIDENCY_FLAGS Flags, UI heap->SetResident(true); unwrapped[i] = heap->GetReal(); } - else if(WrappedID3D12Resource1::IsAlloc(ppObjects[i])) + else if(WrappedID3D12Resource::IsAlloc(ppObjects[i])) { - WrappedID3D12Resource1 *res = (WrappedID3D12Resource1 *)ppObjects[i]; + WrappedID3D12Resource *res = (WrappedID3D12Resource *)ppObjects[i]; res->SetResident(true); unwrapped[i] = res->GetReal(); } diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp index 96ea93d24..42715c7c9 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp @@ -85,7 +85,7 @@ HRESULT WrappedID3D12Device::CreateCommandList1(UINT nodeMask, D3D12_COMMAND_LIS if(riid != __uuidof(ID3D12GraphicsCommandList) && riid != __uuidof(ID3D12CommandList) && riid != __uuidof(ID3D12GraphicsCommandList1) && riid != __uuidof(ID3D12GraphicsCommandList2) && riid != __uuidof(ID3D12GraphicsCommandList3) && riid != __uuidof(ID3D12GraphicsCommandList4) && - riid != __uuidof(ID3D12GraphicsCommandList5)) + riid != __uuidof(ID3D12GraphicsCommandList5) && riid != __uuidof(ID3D12GraphicsCommandList6)) return E_NOINTERFACE; void *realptr = NULL; @@ -109,6 +109,8 @@ HRESULT WrappedID3D12Device::CreateCommandList1(UINT nodeMask, D3D12_COMMAND_LIS real = (ID3D12GraphicsCommandList4 *)realptr; else if(riid == __uuidof(ID3D12GraphicsCommandList5)) real = (ID3D12GraphicsCommandList5 *)realptr; + else if(riid == __uuidof(ID3D12GraphicsCommandList6)) + real = (ID3D12GraphicsCommandList6 *)realptr; if(SUCCEEDED(ret)) { @@ -156,6 +158,8 @@ HRESULT WrappedID3D12Device::CreateCommandList1(UINT nodeMask, D3D12_COMMAND_LIS *ppCommandList = (ID3D12GraphicsCommandList4 *)wrapped; else if(riid == __uuidof(ID3D12GraphicsCommandList5)) *ppCommandList = (ID3D12GraphicsCommandList5 *)wrapped; + else if(riid == __uuidof(ID3D12GraphicsCommandList6)) + *ppCommandList = (ID3D12GraphicsCommandList6 *)wrapped; else if(riid == __uuidof(ID3D12CommandList)) *ppCommandList = (ID3D12CommandList *)wrapped; else @@ -172,20 +176,26 @@ HRESULT WrappedID3D12Device::CreateProtectedResourceSession( if(ppSession == NULL) return m_pDevice4->CreateProtectedResourceSession(pDesc, riid, NULL); - // this is the only UUID in the headers that we can support - if(riid != __uuidof(ID3D12ProtectedResourceSession)) + if(riid != __uuidof(ID3D12ProtectedResourceSession) && + riid != __uuidof(ID3D12ProtectedResourceSession1) && riid != __uuidof(ID3D12ProtectedSession)) return E_NOINTERFACE; ID3D12ProtectedResourceSession *real = NULL; HRESULT ret; - SERIALISE_TIME_CALL(ret = m_pDevice4->CreateProtectedResourceSession(pDesc, riid, (void **)&real)); + SERIALISE_TIME_CALL(ret = m_pDevice4->CreateProtectedResourceSession( + pDesc, __uuidof(ID3D12ProtectedResourceSession), (void **)&real)); if(SUCCEEDED(ret)) { WrappedID3D12ProtectedResourceSession *wrapped = new WrappedID3D12ProtectedResourceSession(real, this); - *ppSession = (ID3D12ProtectedResourceSession *)wrapped; + if(riid == __uuidof(ID3D12ProtectedResourceSession)) + *ppSession = (ID3D12ProtectedResourceSession *)wrapped; + else if(riid == __uuidof(ID3D12ProtectedResourceSession1)) + *ppSession = (ID3D12ProtectedResourceSession1 *)wrapped; + else if(riid == __uuidof(ID3D12ProtectedSession)) + *ppSession = (ID3D12ProtectedSession *)wrapped; } return ret; @@ -206,11 +216,11 @@ bool WrappedID3D12Device::Serialise_CreateCommittedResource1( // placeholder for future use if we properly capture & replay protected sessions SERIALISE_ELEMENT_LOCAL(ProtectedSession, ResourceId()).Named("pProtectedSession"_lit); SERIALISE_ELEMENT_LOCAL(guid, riidResource).Named("riidResource"_lit); - SERIALISE_ELEMENT_LOCAL(pResource, ((WrappedID3D12Resource1 *)*ppvResource)->GetResourceID()) + SERIALISE_ELEMENT_LOCAL(pResource, ((WrappedID3D12Resource *)*ppvResource)->GetResourceID()) .TypedAs("ID3D12Resource *"_lit); SERIALISE_ELEMENT_LOCAL(gpuAddress, - ((WrappedID3D12Resource1 *)*ppvResource)->GetGPUVirtualAddressIfBuffer()) + ((WrappedID3D12Resource *)*ppvResource)->GetGPUVirtualAddressIfBuffer()) .Hidden(); SERIALISE_CHECK_READ_ERRORS(); @@ -264,7 +274,7 @@ bool WrappedID3D12Device::Serialise_CreateCommittedResource1( SetObjName(ret, StringFormat::Fmt("Committed Resource %s ID %s", ToStr(desc.Dimension).c_str(), ToStr(pResource).c_str())); - ret = new WrappedID3D12Resource1(ret, this); + ret = new WrappedID3D12Resource(ret, this); GetResourceManager()->AddLiveResource(pResource, ret); @@ -325,7 +335,8 @@ HRESULT WrappedID3D12Device::CreateCommittedResource1( InitialResourceState, pOptimizedClearValue, Unwrap(pProtectedSession), riidResource, NULL); - if(riidResource != __uuidof(ID3D12Resource) && riidResource != __uuidof(ID3D12Resource1)) + if(riidResource != __uuidof(ID3D12Resource) && riidResource != __uuidof(ID3D12Resource1) && + riidResource != __uuidof(ID3D12Resource2)) return E_NOINTERFACE; void *realptr = NULL; @@ -339,10 +350,12 @@ HRESULT WrappedID3D12Device::CreateCommittedResource1( real = (ID3D12Resource *)realptr; else if(riidResource == __uuidof(ID3D12Resource1)) real = (ID3D12Resource1 *)realptr; + else if(riidResource == __uuidof(ID3D12Resource2)) + real = (ID3D12Resource2 *)realptr; if(SUCCEEDED(ret)) { - WrappedID3D12Resource1 *wrapped = new WrappedID3D12Resource1(real, this); + WrappedID3D12Resource *wrapped = new WrappedID3D12Resource(real, this); if(IsCaptureMode(m_State)) { @@ -377,7 +390,12 @@ HRESULT WrappedID3D12Device::CreateCommittedResource1( states.fill(GetNumSubresources(m_pDevice, pDesc), InitialResourceState); } - *ppvResource = (ID3D12Resource *)wrapped; + if(riidResource == __uuidof(ID3D12Resource)) + *ppvResource = (ID3D12Resource *)wrapped; + else if(riidResource == __uuidof(ID3D12Resource1)) + *ppvResource = (ID3D12Resource1 *)wrapped; + else if(riidResource == __uuidof(ID3D12Resource2)) + *ppvResource = (ID3D12Resource2 *)wrapped; // while actively capturing we keep all buffers around to prevent the address lookup from // losing addresses we might need (or the manageable but annoying problem of an address being @@ -404,7 +422,7 @@ bool WrappedID3D12Device::Serialise_CreateHeap1(SerialiserType &ser, const D3D12 // placeholder for future use if we properly capture & replay protected sessions SERIALISE_ELEMENT_LOCAL(ProtectedSession, ResourceId()).Named("pProtectedSession"_lit); SERIALISE_ELEMENT_LOCAL(guid, riid).Named("riid"_lit); - SERIALISE_ELEMENT_LOCAL(pHeap, ((WrappedID3D12Heap1 *)*ppvHeap)->GetResourceID()) + SERIALISE_ELEMENT_LOCAL(pHeap, ((WrappedID3D12Heap *)*ppvHeap)->GetResourceID()) .TypedAs("ID3D12Heap *"_lit); SERIALISE_CHECK_READ_ERRORS(); @@ -436,7 +454,7 @@ bool WrappedID3D12Device::Serialise_CreateHeap1(SerialiserType &ser, const D3D12 } else { - ret = new WrappedID3D12Heap1(ret, this); + ret = new WrappedID3D12Heap(ret, this); GetResourceManager()->AddLiveResource(pHeap, ret); } @@ -471,7 +489,7 @@ HRESULT WrappedID3D12Device::CreateHeap1(const D3D12_HEAP_DESC *pDesc, if(SUCCEEDED(ret)) { - WrappedID3D12Heap1 *wrapped = new WrappedID3D12Heap1(real, this); + WrappedID3D12Heap *wrapped = new WrappedID3D12Heap(real, this); if(IsCaptureMode(m_State)) { @@ -522,7 +540,7 @@ D3D12_RESOURCE_ALLOCATION_INFO WrappedID3D12Device::GetResourceAllocationInfo1( ID3D12Fence *WrappedID3D12Device::CreateProtectedSessionFence(ID3D12Fence *real) { - WrappedID3D12Fence1 *wrapped = NULL; + WrappedID3D12Fence *wrapped = NULL; { SCOPED_LOCK(m_WrapDeduplicateLock); @@ -535,7 +553,7 @@ ID3D12Fence *WrappedID3D12Device::CreateProtectedSessionFence(ID3D12Fence *real) // we basically treat this kind of like CreateFence and serialise it as such, and guess at the // parameters to CreateFence. - wrapped = new WrappedID3D12Fence1(real, this); + wrapped = new WrappedID3D12Fence(real, this); } if(IsCaptureMode(m_State)) diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap6.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap6.cpp new file mode 100644 index 000000000..0570d2e23 --- /dev/null +++ b/renderdoc/driver/d3d12/d3d12_device_wrap6.cpp @@ -0,0 +1,33 @@ +/****************************************************************************** + * The MIT License (MIT) + * + * Copyright (c) 2020 Baldur Karlsson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + ******************************************************************************/ + +#include "d3d12_device.h" + +HRESULT STDMETHODCALLTYPE WrappedID3D12Device::SetBackgroundProcessingMode( + D3D12_BACKGROUND_PROCESSING_MODE Mode, D3D12_MEASUREMENTS_ACTION MeasurementsAction, + _In_opt_ HANDLE hEventToSignalUponCompletion, _Out_opt_ BOOL *pbFurtherMeasurementsDesired) +{ + return m_pDevice6->SetBackgroundProcessingMode( + Mode, MeasurementsAction, hEventToSignalUponCompletion, pbFurtherMeasurementsDesired); +} diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap7.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap7.cpp new file mode 100644 index 000000000..b0a136d72 --- /dev/null +++ b/renderdoc/driver/d3d12/d3d12_device_wrap7.cpp @@ -0,0 +1,66 @@ +/****************************************************************************** + * The MIT License (MIT) + * + * Copyright (c) 2020 Baldur Karlsson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + ******************************************************************************/ + +#include "d3d12_device.h" +#include "d3d12_resources.h" + +HRESULT STDMETHODCALLTYPE WrappedID3D12Device::AddToStateObject( + const D3D12_STATE_OBJECT_DESC *pAddition, ID3D12StateObject *pStateObjectToGrowFrom, + REFIID riid, _COM_Outptr_ void **ppNewStateObject) +{ + RDCERR("AddToStateObject called but raytracing is not supported!"); + return E_INVALIDARG; +} + +HRESULT WrappedID3D12Device::CreateProtectedResourceSession1( + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *pDesc, _In_ REFIID riid, + _COM_Outptr_ void **ppSession) +{ + if(ppSession == NULL) + return m_pDevice7->CreateProtectedResourceSession1(pDesc, riid, NULL); + + if(riid != __uuidof(ID3D12ProtectedResourceSession) && + riid != __uuidof(ID3D12ProtectedResourceSession1) && riid != __uuidof(ID3D12ProtectedSession)) + return E_NOINTERFACE; + + ID3D12ProtectedResourceSession *real = NULL; + HRESULT ret; + SERIALISE_TIME_CALL(ret = m_pDevice7->CreateProtectedResourceSession1( + pDesc, __uuidof(ID3D12ProtectedResourceSession), (void **)&real)); + + if(SUCCEEDED(ret)) + { + WrappedID3D12ProtectedResourceSession *wrapped = + new WrappedID3D12ProtectedResourceSession(real, this); + + if(riid == __uuidof(ID3D12ProtectedResourceSession)) + *ppSession = (ID3D12ProtectedResourceSession *)wrapped; + else if(riid == __uuidof(ID3D12ProtectedResourceSession1)) + *ppSession = (ID3D12ProtectedResourceSession1 *)wrapped; + else if(riid == __uuidof(ID3D12ProtectedSession)) + *ppSession = (ID3D12ProtectedSession *)wrapped; + } + + return ret; +} diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap8.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap8.cpp new file mode 100644 index 000000000..7ed831734 --- /dev/null +++ b/renderdoc/driver/d3d12/d3d12_device_wrap8.cpp @@ -0,0 +1,507 @@ +/****************************************************************************** + * The MIT License (MIT) + * + * Copyright (c) 2020 Baldur Karlsson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + ******************************************************************************/ + +#include "d3d12_device.h" +#include "driver/dxgi/dxgi_common.h" +#include "d3d12_resources.h" + +D3D12_RESOURCE_ALLOCATION_INFO STDMETHODCALLTYPE WrappedID3D12Device::GetResourceAllocationInfo2( + UINT visibleMask, UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC1 *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1) +{ + return m_pDevice8->GetResourceAllocationInfo2(visibleMask, numResourceDescs, pResourceDescs, + pResourceAllocationInfo1); +} + +template +bool WrappedID3D12Device::Serialise_CreateCommittedResource2( + SerialiserType &ser, const D3D12_HEAP_PROPERTIES *pHeapProperties, D3D12_HEAP_FLAGS HeapFlags, + const D3D12_RESOURCE_DESC1 *pDesc, D3D12_RESOURCE_STATES InitialResourceState, + const D3D12_CLEAR_VALUE *pOptimizedClearValue, + ID3D12ProtectedResourceSession *pProtectedSession, REFIID riidResource, void **ppvResource) +{ + SERIALISE_ELEMENT_LOCAL(props, *pHeapProperties).Named("pHeapProperties"_lit); + SERIALISE_ELEMENT(HeapFlags); + SERIALISE_ELEMENT_LOCAL(desc, *pDesc).Named("pDesc"_lit); + SERIALISE_ELEMENT(InitialResourceState); + SERIALISE_ELEMENT_OPT(pOptimizedClearValue); + // placeholder for future use if we properly capture & replay protected sessions + SERIALISE_ELEMENT_LOCAL(ProtectedSession, ResourceId()).Named("pProtectedSession"_lit); + SERIALISE_ELEMENT_LOCAL(guid, riidResource).Named("riidResource"_lit); + SERIALISE_ELEMENT_LOCAL(pResource, ((WrappedID3D12Resource *)*ppvResource)->GetResourceID()) + .TypedAs("ID3D12Resource *"_lit); + + SERIALISE_ELEMENT_LOCAL(gpuAddress, + ((WrappedID3D12Resource *)*ppvResource)->GetGPUVirtualAddressIfBuffer()) + .Hidden(); + + SERIALISE_CHECK_READ_ERRORS(); + + if(IsReplayingAndReading()) + { + if(props.Type == D3D12_HEAP_TYPE_UPLOAD && desc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) + { + // place large resources in local memory so that initial contents and maps can + // be cached and copied on the GPU instead of memcpy'd from the CPU every time. + // smaller resources it's better to just leave them as upload and map into them + if(desc.Width >= 1024 * 1024) + { + RDCLOG("Remapping committed resource %s from upload to default for efficient replay", + ToStr(pResource).c_str()); + props.Type = D3D12_HEAP_TYPE_DEFAULT; + m_UploadResourceIds.insert(pResource); + } + } + + APIProps.YUVTextures |= IsYUVFormat(desc.Format); + + // always allow SRVs on replay so we can inspect resources + desc.Flags &= ~D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE; + + if(desc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) + { + GPUAddressRange range; + range.start = gpuAddress; + range.end = gpuAddress + desc.Width; + range.id = pResource; + + m_GPUAddresses.AddTo(range); + } + + ID3D12Resource *ret = NULL; + HRESULT hr = E_NOINTERFACE; + if(m_pDevice8) + hr = m_pDevice8->CreateCommittedResource2(&props, HeapFlags, &desc, InitialResourceState, + pOptimizedClearValue, NULL, guid, (void **)&ret); + else + RDCERR("Replaying a without D3D12.8 available"); + + if(FAILED(hr)) + { + RDCERR("Failed on resource serialise-creation, HRESULT: %s", ToStr(hr).c_str()); + return false; + } + else + { + SetObjName(ret, StringFormat::Fmt("Committed Resource %s ID %s", + ToStr(desc.Dimension).c_str(), ToStr(pResource).c_str())); + + ret = new WrappedID3D12Resource(ret, this); + + GetResourceManager()->AddLiveResource(pResource, ret); + + SubresourceStateVector &states = m_ResourceStates[GetResID(ret)]; + // D3D12_RESOURCE_DESC is the same as the start of D3D12_RESOURCE_DESC1 + D3D12_RESOURCE_DESC desc0; + memcpy(&desc0, &desc, sizeof(desc0)); + states.fill(GetNumSubresources(m_pDevice, &desc0), InitialResourceState); + + ResourceType type = ResourceType::Texture; + const char *prefix = "Texture"; + + if(desc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) + { + type = ResourceType::Buffer; + prefix = "Buffer"; + } + else if(desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE1D) + { + prefix = desc.DepthOrArraySize > 1 ? "1D TextureArray" : "1D Texture"; + + if(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) + prefix = "1D Render Target"; + else if(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) + prefix = "1D Depth Target"; + } + else if(desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D) + { + prefix = desc.DepthOrArraySize > 1 ? "2D TextureArray" : "2D Texture"; + + if(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) + prefix = "2D Render Target"; + else if(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) + prefix = "2D Depth Target"; + } + else if(desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D) + { + prefix = "3D Texture"; + + if(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) + prefix = "3D Render Target"; + else if(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) + prefix = "3D Depth Target"; + } + + AddResource(pResource, type, prefix); + } + } + + return true; +} + +HRESULT WrappedID3D12Device::CreateCommittedResource2( + const D3D12_HEAP_PROPERTIES *pHeapProperties, D3D12_HEAP_FLAGS HeapFlags, + const D3D12_RESOURCE_DESC1 *pDesc, D3D12_RESOURCE_STATES InitialResourceState, + const D3D12_CLEAR_VALUE *pOptimizedClearValue, + ID3D12ProtectedResourceSession *pProtectedSession, REFIID riidResource, void **ppvResource) +{ + if(ppvResource == NULL) + return m_pDevice8->CreateCommittedResource2(pHeapProperties, HeapFlags, pDesc, + InitialResourceState, pOptimizedClearValue, + Unwrap(pProtectedSession), riidResource, NULL); + + if(riidResource != __uuidof(ID3D12Resource) && riidResource != __uuidof(ID3D12Resource1) && + riidResource != __uuidof(ID3D12Resource2)) + return E_NOINTERFACE; + + void *realptr = NULL; + HRESULT ret; + SERIALISE_TIME_CALL(ret = m_pDevice8->CreateCommittedResource2( + pHeapProperties, HeapFlags, pDesc, InitialResourceState, + pOptimizedClearValue, Unwrap(pProtectedSession), riidResource, &realptr)); + + ID3D12Resource *real = NULL; + if(riidResource == __uuidof(ID3D12Resource)) + real = (ID3D12Resource *)realptr; + else if(riidResource == __uuidof(ID3D12Resource1)) + real = (ID3D12Resource1 *)realptr; + else if(riidResource == __uuidof(ID3D12Resource2)) + real = (ID3D12Resource2 *)realptr; + + if(SUCCEEDED(ret)) + { + WrappedID3D12Resource *wrapped = new WrappedID3D12Resource(real, this); + + if(IsCaptureMode(m_State)) + { + CACHE_THREAD_SERIALISER(); + + SCOPED_SERIALISE_CHUNK(D3D12Chunk::Device_CreateCommittedResource2); + Serialise_CreateCommittedResource2(ser, pHeapProperties, HeapFlags, pDesc, + InitialResourceState, pOptimizedClearValue, + pProtectedSession, riidResource, (void **)&wrapped); + + D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID()); + record->type = Resource_Resource; + record->Length = 0; + wrapped->SetResourceRecord(record); + + // D3D12_RESOURCE_DESC is the same as the start of D3D12_RESOURCE_DESC1 + D3D12_RESOURCE_DESC desc0; + memcpy(&desc0, pDesc, sizeof(desc0)); + record->m_MapsCount = GetNumSubresources(this, &desc0); + record->m_Maps = new D3D12ResourceRecord::MapData[record->m_MapsCount]; + + record->AddChunk(scope.Get()); + + GetResourceManager()->MarkDirtyResource(wrapped->GetResourceID()); + } + else + { + GetResourceManager()->AddLiveResource(wrapped->GetResourceID(), wrapped); + } + + { + SCOPED_LOCK(m_ResourceStatesLock); + SubresourceStateVector &states = m_ResourceStates[wrapped->GetResourceID()]; + + // D3D12_RESOURCE_DESC is the same as the start of D3D12_RESOURCE_DESC1 + D3D12_RESOURCE_DESC desc0; + memcpy(&desc0, pDesc, sizeof(desc0)); + states.fill(GetNumSubresources(m_pDevice, &desc0), InitialResourceState); + } + + if(riidResource == __uuidof(ID3D12Resource)) + *ppvResource = (ID3D12Resource *)wrapped; + else if(riidResource == __uuidof(ID3D12Resource1)) + *ppvResource = (ID3D12Resource1 *)wrapped; + else if(riidResource == __uuidof(ID3D12Resource2)) + *ppvResource = (ID3D12Resource2 *)wrapped; + + // while actively capturing we keep all buffers around to prevent the address lookup from + // losing addresses we might need (or the manageable but annoying problem of an address being + // re-used) + { + SCOPED_READLOCK(m_CapTransitionLock); + if(IsActiveCapturing(m_State)) + { + wrapped->AddRef(); + m_RefBuffers.push_back(wrapped); + } + } + } + + return ret; +} + +template +bool WrappedID3D12Device::Serialise_CreatePlacedResource1( + SerialiserType &ser, ID3D12Heap *pHeap, UINT64 HeapOffset, const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialState, const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riid, + void **ppvResource) +{ + SERIALISE_ELEMENT(pHeap); + SERIALISE_ELEMENT(HeapOffset); + SERIALISE_ELEMENT_LOCAL(Descriptor, *pDesc).Named("pDesc"_lit); + SERIALISE_ELEMENT(InitialState); + SERIALISE_ELEMENT_OPT(pOptimizedClearValue); + SERIALISE_ELEMENT_LOCAL(guid, riid).Named("riid"_lit); + SERIALISE_ELEMENT_LOCAL(pResource, ((WrappedID3D12Resource *)*ppvResource)->GetResourceID()) + .TypedAs("ID3D12Resource *"_lit); + + SERIALISE_ELEMENT_LOCAL(gpuAddress, + ((WrappedID3D12Resource *)*ppvResource)->GetGPUVirtualAddressIfBuffer()) + .Hidden(); + + SERIALISE_CHECK_READ_ERRORS(); + + if(IsReplayingAndReading()) + { + if(Descriptor.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) + { + GPUAddressRange range; + range.start = gpuAddress; + range.end = gpuAddress + Descriptor.Width; + range.id = pResource; + + m_GPUAddresses.AddTo(range); + } + + APIProps.YUVTextures |= IsYUVFormat(Descriptor.Format); + + // always allow SRVs on replay so we can inspect resources + Descriptor.Flags &= ~D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE; + + D3D12_HEAP_DESC heapDesc = pHeap->GetDesc(); + + // if the heap was from OpenExistingHeap* then we will have removed the shared flags from it as + // it's CPU-visible and impossible to share. + // That means any resources placed to it would have had this flag that we then need to remove as + // well. + if((heapDesc.Flags & D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER) == 0) + Descriptor.Flags &= ~D3D12_RESOURCE_FLAG_ALLOW_CROSS_ADAPTER; + + ID3D12Resource *ret = NULL; + HRESULT hr = E_NOINTERFACE; + if(m_pDevice8) + hr = m_pDevice8->CreatePlacedResource1(Unwrap(pHeap), HeapOffset, &Descriptor, InitialState, + pOptimizedClearValue, guid, (void **)&ret); + else + RDCERR("Replaying a without D3D12.8 available"); + + if(FAILED(hr)) + { + RDCERR("Failed on resource serialise-creation, HRESULT: %s", ToStr(hr).c_str()); + return false; + } + else + { + SetObjName(ret, StringFormat::Fmt("Placed Resource %s %s", ToStr(Descriptor.Dimension).c_str(), + ToStr(pResource).c_str())); + + ret = new WrappedID3D12Resource(ret, this); + + GetResourceManager()->AddLiveResource(pResource, ret); + + // D3D12_RESOURCE_DESC is the same as the start of D3D12_RESOURCE_DESC1 + D3D12_RESOURCE_DESC desc0; + memcpy(&desc0, &Descriptor, sizeof(desc0)); + SubresourceStateVector &states = m_ResourceStates[GetResID(ret)]; + states.fill(GetNumSubresources(m_pDevice, &desc0), InitialState); + } + + ResourceType type = ResourceType::Texture; + const char *prefix = "Texture"; + + if(Descriptor.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) + { + type = ResourceType::Buffer; + prefix = "Buffer"; + } + else if(Descriptor.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE1D) + { + prefix = Descriptor.DepthOrArraySize > 1 ? "1D TextureArray" : "1D Texture"; + + if(Descriptor.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) + prefix = "1D Render Target"; + else if(Descriptor.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) + prefix = "1D Depth Target"; + } + else if(Descriptor.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D) + { + prefix = Descriptor.DepthOrArraySize > 1 ? "2D TextureArray" : "2D Texture"; + + if(Descriptor.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) + prefix = "2D Render Target"; + else if(Descriptor.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) + prefix = "2D Depth Target"; + } + else if(Descriptor.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D) + { + prefix = "3D Texture"; + + if(Descriptor.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) + prefix = "3D Render Target"; + else if(Descriptor.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) + prefix = "3D Depth Target"; + } + + AddResource(pResource, type, prefix); + DerivedResource(pHeap, pResource); + } + + return true; +} + +HRESULT WrappedID3D12Device::CreatePlacedResource1(ID3D12Heap *pHeap, UINT64 HeapOffset, + const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialState, + const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, void **ppvResource) +{ + if(ppvResource == NULL) + return m_pDevice8->CreatePlacedResource1(Unwrap(pHeap), HeapOffset, pDesc, InitialState, + pOptimizedClearValue, riid, NULL); + + if(riid != __uuidof(ID3D12Resource)) + return E_NOINTERFACE; + + const D3D12_RESOURCE_DESC1 *pCreateDesc = pDesc; + D3D12_RESOURCE_DESC1 localDesc; + + if(pDesc && pDesc->Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D && pDesc->SampleDesc.Count > 1) + { + localDesc = *pDesc; + // need to be able to create SRVs of MSAA textures to copy out their contents + localDesc.Flags &= ~D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE; + pCreateDesc = &localDesc; + } + + ID3D12Resource *real = NULL; + HRESULT ret; + SERIALISE_TIME_CALL(ret = m_pDevice8->CreatePlacedResource1(Unwrap(pHeap), HeapOffset, pCreateDesc, + InitialState, pOptimizedClearValue, + riid, (void **)&real)); + + if(SUCCEEDED(ret)) + { + WrappedID3D12Resource *wrapped = new WrappedID3D12Resource(real, this); + + if(IsCaptureMode(m_State)) + { + CACHE_THREAD_SERIALISER(); + + SCOPED_SERIALISE_CHUNK(D3D12Chunk::Device_CreatePlacedResource1); + Serialise_CreatePlacedResource1(ser, pHeap, HeapOffset, pDesc, InitialState, + pOptimizedClearValue, riid, (void **)&wrapped); + + D3D12ResourceRecord *record = GetResourceManager()->AddResourceRecord(wrapped->GetResourceID()); + record->type = Resource_Resource; + record->Length = 0; + wrapped->SetResourceRecord(record); + + // D3D12_RESOURCE_DESC is the same as the start of D3D12_RESOURCE_DESC1 + D3D12_RESOURCE_DESC desc0; + memcpy(&desc0, pDesc, sizeof(desc0)); + record->m_MapsCount = GetNumSubresources(this, &desc0); + record->m_Maps = new D3D12ResourceRecord::MapData[record->m_MapsCount]; + + RDCASSERT(pHeap); + + record->AddParent(GetRecord(pHeap)); + record->AddChunk(scope.Get()); + + GetResourceManager()->MarkDirtyResource(wrapped->GetResourceID()); + } + else + { + GetResourceManager()->AddLiveResource(wrapped->GetResourceID(), wrapped); + } + + { + SCOPED_LOCK(m_ResourceStatesLock); + SubresourceStateVector &states = m_ResourceStates[wrapped->GetResourceID()]; + + // D3D12_RESOURCE_DESC is the same as the start of D3D12_RESOURCE_DESC1 + D3D12_RESOURCE_DESC desc0; + memcpy(&desc0, pDesc, sizeof(desc0)); + states.fill(GetNumSubresources(m_pDevice, &desc0), InitialState); + } + + if(riid == __uuidof(ID3D12Resource)) + *ppvResource = (ID3D12Resource *)wrapped; + else if(riid == __uuidof(ID3D12Resource1)) + *ppvResource = (ID3D12Resource1 *)wrapped; + else if(riid == __uuidof(ID3D12Resource2)) + *ppvResource = (ID3D12Resource2 *)wrapped; + + // while actively capturing we keep all buffers around to prevent the address lookup from + // losing addresses we might need (or the manageable but annoying problem of an address being + // re-used) + { + SCOPED_READLOCK(m_CapTransitionLock); + if(IsActiveCapturing(m_State)) + { + wrapped->AddRef(); + m_RefBuffers.push_back(wrapped); + } + } + } + + return ret; +} + +void STDMETHODCALLTYPE WrappedID3D12Device::CreateSamplerFeedbackUnorderedAccessView( + _In_opt_ ID3D12Resource *pTargetedResource, _In_opt_ ID3D12Resource *pFeedbackResource, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor) +{ + RDCERR("CreateSamplerFeedbackUnorderedAccessView called but sampler feedback is not supported!"); +} + +void STDMETHODCALLTYPE WrappedID3D12Device::GetCopyableFootprints1( + _In_ const D3D12_RESOURCE_DESC1 *pResourceDesc, + _In_range_(0, D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0, D3D12_REQ_SUBRESOURCES - FirstSubresource) UINT NumSubresources, UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, _Out_opt_ UINT64 *pTotalBytes) +{ + return m_pDevice8->GetCopyableFootprints1(pResourceDesc, FirstSubresource, NumSubresources, + BaseOffset, pLayouts, pNumRows, pRowSizeInBytes, + pTotalBytes); +} + +INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12Device, CreateCommittedResource2, + const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + const D3D12_CLEAR_VALUE *pOptimizedClearValue, + ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, void **ppvResource); +INSTANTIATE_FUNCTION_SERIALISED(void, WrappedID3D12Device, CreatePlacedResource1, ID3D12Heap *pHeap, + UINT64 HeapOffset, const D3D12_RESOURCE_DESC1 *pDesc, + D3D12_RESOURCE_STATES InitialState, + const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riid, + void **ppvResource); diff --git a/renderdoc/driver/d3d12/d3d12_hooks.cpp b/renderdoc/driver/d3d12/d3d12_hooks.cpp index 4f5b45ff8..548d3d848 100644 --- a/renderdoc/driver/d3d12/d3d12_hooks.cpp +++ b/renderdoc/driver/d3d12/d3d12_hooks.cpp @@ -262,7 +262,8 @@ private: if(riid != __uuidof(ID3D12Device) && riid != __uuidof(ID3D12Device1) && riid != __uuidof(ID3D12Device2) && riid != __uuidof(ID3D12Device3) && riid != __uuidof(ID3D12Device4) && riid != __uuidof(ID3D12Device5) && - riid != __uuidof(ID3D12Device6)) + riid != __uuidof(ID3D12Device6) && riid != __uuidof(ID3D12Device7) && + riid != __uuidof(ID3D12Device8)) { RDCERR("Unsupported UUID %s for D3D12CreateDevice", ToStr(riid).c_str()); return E_NOINTERFACE; @@ -342,6 +343,16 @@ private: ID3D12Device6 *dev6 = (ID3D12Device6 *)*ppDevice; dev = (ID3D12Device *)dev6; } + else if(riid == __uuidof(ID3D12Device7)) + { + ID3D12Device7 *dev7 = (ID3D12Device7 *)*ppDevice; + dev = (ID3D12Device *)dev7; + } + else if(riid == __uuidof(ID3D12Device8)) + { + ID3D12Device8 *dev8 = (ID3D12Device8 *)*ppDevice; + dev = (ID3D12Device *)dev8; + } WrappedID3D12Device *wrap = WrappedID3D12Device::Create(dev, params, EnableDebugLayer); @@ -361,6 +372,10 @@ private: *ppDevice = (ID3D12Device5 *)wrap; else if(riid == __uuidof(ID3D12Device6)) *ppDevice = (ID3D12Device6 *)wrap; + else if(riid == __uuidof(ID3D12Device7)) + *ppDevice = (ID3D12Device7 *)wrap; + else if(riid == __uuidof(ID3D12Device8)) + *ppDevice = (ID3D12Device8 *)wrap; } } else if(SUCCEEDED(ret)) diff --git a/renderdoc/driver/d3d12/d3d12_initstate.cpp b/renderdoc/driver/d3d12/d3d12_initstate.cpp index 780951f5c..878883b2c 100644 --- a/renderdoc/driver/d3d12/d3d12_initstate.cpp +++ b/renderdoc/driver/d3d12/d3d12_initstate.cpp @@ -50,7 +50,7 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res) } else if(type == Resource_Resource) { - WrappedID3D12Resource1 *r = (WrappedID3D12Resource1 *)res; + WrappedID3D12Resource *r = (WrappedID3D12Resource *)res; ID3D12Pageable *pageable = r; bool nonresident = false; diff --git a/renderdoc/driver/d3d12/d3d12_manager.cpp b/renderdoc/driver/d3d12/d3d12_manager.cpp index c34eb46a0..c40851601 100644 --- a/renderdoc/driver/d3d12/d3d12_manager.cpp +++ b/renderdoc/driver/d3d12/d3d12_manager.cpp @@ -496,7 +496,7 @@ void D3D12Descriptor::GetRefIDs(ResourceId &id, ResourceId &id2, FrameRefType &r // nothing to do - no resource here break; case D3D12DescriptorType::CBV: - id = WrappedID3D12Resource1::GetResIDFromAddr(data.nonsamp.cbv.BufferLocation); + id = WrappedID3D12Resource::GetResIDFromAddr(data.nonsamp.cbv.BufferLocation); break; case D3D12DescriptorType::SRV: id = data.nonsamp.resource; break; case D3D12DescriptorType::UAV: id2 = data.nonsamp.counterResource; DELIBERATE_FALLTHROUGH(); diff --git a/renderdoc/driver/d3d12/d3d12_manager.h b/renderdoc/driver/d3d12/d3d12_manager.h index 91b039a00..d0b888632 100644 --- a/renderdoc/driver/d3d12/d3d12_manager.h +++ b/renderdoc/driver/d3d12/d3d12_manager.h @@ -441,7 +441,7 @@ struct CmdListRecordingInfo rdcarray bundles; }; -class WrappedID3D12Resource1; +class WrappedID3D12Resource; struct GPUAddressRange { diff --git a/renderdoc/driver/d3d12/d3d12_overlay.cpp b/renderdoc/driver/d3d12/d3d12_overlay.cpp index d95c4ed80..151b690c9 100644 --- a/renderdoc/driver/d3d12/d3d12_overlay.cpp +++ b/renderdoc/driver/d3d12/d3d12_overlay.cpp @@ -374,7 +374,7 @@ ResourceId D3D12Replay::RenderOverlay(ResourceId texid, FloatVector clearCol, De if(m_Overlay.Texture) currentOverlayDesc = m_Overlay.Texture->GetDesc(); - WrappedID3D12Resource1 *wrappedCustomRenderTex = (WrappedID3D12Resource1 *)m_Overlay.Texture; + WrappedID3D12Resource *wrappedCustomRenderTex = (WrappedID3D12Resource *)m_Overlay.Texture; // need to recreate backing custom render tex if(overlayTexDesc.Width != currentOverlayDesc.Width || @@ -397,7 +397,7 @@ ResourceId D3D12Replay::RenderOverlay(ResourceId texid, FloatVector clearCol, De RDCERR("Failed to create custom render tex HRESULT: %s", ToStr(hr).c_str()); return ResourceId(); } - wrappedCustomRenderTex = (WrappedID3D12Resource1 *)customRenderTex; + wrappedCustomRenderTex = (WrappedID3D12Resource *)customRenderTex; customRenderTex->SetName(L"customRenderTex"); @@ -1154,7 +1154,7 @@ ResourceId D3D12Replay::RenderOverlay(ResourceId texid, FloatVector clearCol, De vertexData.SpriteSize = Vec2f(); D3D12RenderState::SignatureElement vertexElem(eRootCBV, ResourceId(), 0); - WrappedID3D12Resource1::GetResIDFromAddr( + WrappedID3D12Resource::GetResIDFromAddr( GetDebugManager()->UploadConstants(&vertexData, sizeof(vertexData)), vertexElem.id, vertexElem.offset); @@ -1168,7 +1168,7 @@ ResourceId D3D12Replay::RenderOverlay(ResourceId texid, FloatVector clearCol, De viewport = Vec4f(rs.views[0].Width, rs.views[0].Height); D3D12RenderState::SignatureElement viewportElem(eRootCBV, ResourceId(), 0); - WrappedID3D12Resource1::GetResIDFromAddr( + WrappedID3D12Resource::GetResIDFromAddr( GetDebugManager()->UploadConstants(&viewport, sizeof(viewport)), viewportElem.id, viewportElem.offset); diff --git a/renderdoc/driver/d3d12/d3d12_replay.cpp b/renderdoc/driver/d3d12/d3d12_replay.cpp index 911d32f0e..7293052d3 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.cpp +++ b/renderdoc/driver/d3d12/d3d12_replay.cpp @@ -1196,8 +1196,8 @@ void D3D12Replay::FillRootElements(const D3D12RenderState::RootSignature &rootSi if(desc) { const D3D12_CONSTANT_BUFFER_VIEW_DESC &cbv = desc->GetCBV(); - WrappedID3D12Resource1::GetResIDFromAddr(cbv.BufferLocation, cb.resourceId, - cb.byteOffset); + WrappedID3D12Resource::GetResIDFromAddr(cbv.BufferLocation, cb.resourceId, + cb.byteOffset); cb.resourceId = rm->GetOriginalID(cb.resourceId); cb.byteSize = cbv.SizeInBytes; @@ -2703,7 +2703,7 @@ void D3D12Replay::GetBufferData(ResourceId buff, uint64_t offset, uint64_t lengt return; } - WrappedID3D12Resource1 *buffer = it->second; + WrappedID3D12Resource *buffer = it->second; if(buffer->GetDesc().Dimension != D3D12_RESOURCE_DIMENSION_BUFFER) { diff --git a/renderdoc/driver/d3d12/d3d12_resources.cpp b/renderdoc/driver/d3d12/d3d12_resources.cpp index c81d358bf..dbed8e959 100644 --- a/renderdoc/driver/d3d12/d3d12_resources.cpp +++ b/renderdoc/driver/d3d12/d3d12_resources.cpp @@ -27,7 +27,7 @@ #include "d3d12_command_list.h" #include "d3d12_command_queue.h" -GPUAddressRangeTracker WrappedID3D12Resource1::m_Addresses; +GPUAddressRangeTracker WrappedID3D12Resource::m_Addresses; std::map WrappedID3D12Shader::m_Shaders; bool WrappedID3D12Shader::m_InternalResources = false; @@ -133,7 +133,7 @@ ID3D12DeviceChild *Unwrap(ID3D12DeviceChild *ptr) return (ID3D12DeviceChild *)Unwrap((ID3D12Object *)ptr); } -WrappedID3D12Resource1::~WrappedID3D12Resource1() +WrappedID3D12Resource::~WrappedID3D12Resource() { // perform an implicit unmap on release if(GetResourceRecord()) @@ -174,7 +174,7 @@ WrappedID3D12Resource1::~WrappedID3D12Resource1() m_ID = ResourceId(); } -byte *WrappedID3D12Resource1::GetMap(UINT Subresource) +byte *WrappedID3D12Resource::GetMap(UINT Subresource) { SCOPED_LOCK(GetResourceRecord()->m_MapLock); @@ -187,7 +187,7 @@ byte *WrappedID3D12Resource1::GetMap(UINT Subresource) return NULL; } -byte *WrappedID3D12Resource1::GetShadow(UINT Subresource) +byte *WrappedID3D12Resource::GetShadow(UINT Subresource) { SCOPED_LOCK(GetResourceRecord()->m_MapLock); @@ -196,7 +196,7 @@ byte *WrappedID3D12Resource1::GetShadow(UINT Subresource) return map[Subresource].shadowPtr; } -void WrappedID3D12Resource1::AllocShadow(UINT Subresource, size_t size) +void WrappedID3D12Resource::AllocShadow(UINT Subresource, size_t size) { SCOPED_LOCK(GetResourceRecord()->m_MapLock); @@ -206,7 +206,7 @@ void WrappedID3D12Resource1::AllocShadow(UINT Subresource, size_t size) map[Subresource].shadowPtr = AllocAlignedBuffer(size); } -void WrappedID3D12Resource1::FreeShadow() +void WrappedID3D12Resource::FreeShadow() { SCOPED_LOCK(GetResourceRecord()->m_MapLock); @@ -220,23 +220,23 @@ void WrappedID3D12Resource1::FreeShadow() } } -void WrappedID3D12Resource1::LockMaps() +void WrappedID3D12Resource::LockMaps() { GetResourceRecord()->m_MapLock.Lock(); } -void WrappedID3D12Resource1::UnlockMaps() +void WrappedID3D12Resource::UnlockMaps() { GetResourceRecord()->m_MapLock.Unlock(); } -WriteSerialiser &WrappedID3D12Resource1::GetThreadSerialiser() +WriteSerialiser &WrappedID3D12Resource::GetThreadSerialiser() { return m_pDevice->GetThreadSerialiser(); } -HRESULT STDMETHODCALLTYPE WrappedID3D12Resource1::Map(UINT Subresource, - const D3D12_RANGE *pReadRange, void **ppData) +HRESULT STDMETHODCALLTYPE WrappedID3D12Resource::Map(UINT Subresource, + const D3D12_RANGE *pReadRange, void **ppData) { // don't care about maps without returned pointers - we'll just intercept the WriteToSubresource // calls @@ -267,8 +267,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12Resource1::Map(UINT Subresource, return hr; } -void STDMETHODCALLTYPE WrappedID3D12Resource1::Unmap(UINT Subresource, - const D3D12_RANGE *pWrittenRange) +void STDMETHODCALLTYPE WrappedID3D12Resource::Unmap(UINT Subresource, const D3D12_RANGE *pWrittenRange) { if(GetResourceRecord()) { @@ -297,11 +296,11 @@ void STDMETHODCALLTYPE WrappedID3D12Resource1::Unmap(UINT Subresource, return m_pReal->Unmap(Subresource, pWrittenRange); } -HRESULT STDMETHODCALLTYPE WrappedID3D12Resource1::WriteToSubresource(UINT DstSubresource, - const D3D12_BOX *pDstBox, - const void *pSrcData, - UINT SrcRowPitch, - UINT SrcDepthPitch) +HRESULT STDMETHODCALLTYPE WrappedID3D12Resource::WriteToSubresource(UINT DstSubresource, + const D3D12_BOX *pDstBox, + const void *pSrcData, + UINT SrcRowPitch, + UINT SrcDepthPitch) { HRESULT ret; @@ -317,7 +316,7 @@ HRESULT STDMETHODCALLTYPE WrappedID3D12Resource1::WriteToSubresource(UINT DstSub return ret; } -void WrappedID3D12Resource1::RefBuffers(D3D12ResourceManager *rm) +void WrappedID3D12Resource::RefBuffers(D3D12ResourceManager *rm) { // only buffers go into m_Addresses SCOPED_READLOCK(m_Addresses.addressLock); @@ -325,7 +324,7 @@ void WrappedID3D12Resource1::RefBuffers(D3D12ResourceManager *rm) rm->MarkResourceFrameReferenced(m_Addresses.addresses[i].id, eFrameRef_Read); } -rdcarray WrappedID3D12Resource1::AddRefBuffersBeforeCapture(D3D12ResourceManager *rm) +rdcarray WrappedID3D12Resource::AddRefBuffersBeforeCapture(D3D12ResourceManager *rm) { rdcarray ret; diff --git a/renderdoc/driver/d3d12/d3d12_resources.h b/renderdoc/driver/d3d12/d3d12_resources.h index 8f8376d86..2b922997f 100644 --- a/renderdoc/driver/d3d12/d3d12_resources.h +++ b/renderdoc/driver/d3d12/d3d12_resources.h @@ -438,21 +438,21 @@ public: } }; -class WrappedID3D12Fence1 : public WrappedDeviceChild12 +class WrappedID3D12Fence : public WrappedDeviceChild12 { public: - ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12Fence1); + ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12Fence); enum { TypeEnum = Resource_Fence, }; - WrappedID3D12Fence1(ID3D12Fence *real, WrappedID3D12Device *device) + WrappedID3D12Fence(ID3D12Fence *real, WrappedID3D12Device *device) : WrappedDeviceChild12(real, device) { } - virtual ~WrappedID3D12Fence1() { Shutdown(); } + virtual ~WrappedID3D12Fence() { Shutdown(); } ////////////////////////////// // implement ID3D12Fence @@ -481,7 +481,7 @@ public: }; class WrappedID3D12ProtectedResourceSession - : public WrappedDeviceChild12 + : public WrappedDeviceChild12 { public: ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12ProtectedResourceSession); @@ -535,23 +535,39 @@ public: { return m_pReal->GetDesc(); } + + ////////////////////////////// + // implement ID3D12ProtectedResourceSession1 + virtual D3D12_PROTECTED_RESOURCE_SESSION_DESC1 STDMETHODCALLTYPE GetDesc1() + { + ID3D12ProtectedResourceSession1 *real1 = NULL; + m_pReal->QueryInterface(__uuidof(ID3D12ProtectedResourceSession1), (void **)&real1); + + if(!real1) + return {}; + + D3D12_PROTECTED_RESOURCE_SESSION_DESC1 ret = real1->GetDesc1(); + + SAFE_RELEASE(real1); + return ret; + } }; -class WrappedID3D12Heap1 : public WrappedDeviceChild12 +class WrappedID3D12Heap : public WrappedDeviceChild12 { public: - ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12Heap1); + ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12Heap); enum { TypeEnum = Resource_Heap, }; - WrappedID3D12Heap1(ID3D12Heap *real, WrappedID3D12Device *device) + WrappedID3D12Heap(ID3D12Heap *real, WrappedID3D12Device *device) : WrappedDeviceChild12(real, device) { } - virtual ~WrappedID3D12Heap1() { Shutdown(); } + virtual ~WrappedID3D12Heap() { Shutdown(); } ////////////////////////////// // implement ID3D12Heap virtual D3D12_HEAP_DESC STDMETHODCALLTYPE GetDesc() { return m_pReal->GetDesc(); } @@ -879,14 +895,15 @@ public: virtual ~WrappedID3D12QueryHeap() { Shutdown(); } }; -class WrappedID3D12Resource1 : public WrappedDeviceChild12 +class WrappedID3D12Resource + : public WrappedDeviceChild12 { static GPUAddressRangeTracker m_Addresses; WriteSerialiser &GetThreadSerialiser(); public: - ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12Resource1, false); + ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12Resource, false); static void RefBuffers(D3D12ResourceManager *rm); @@ -913,7 +930,7 @@ public: TypeEnum = Resource_Resource, }; - WrappedID3D12Resource1(ID3D12Resource *real, WrappedID3D12Device *device) + WrappedID3D12Resource(ID3D12Resource *real, WrappedID3D12Device *device) : WrappedDeviceChild12(real, device) { if(IsReplayMode(device->GetState())) @@ -932,7 +949,7 @@ public: m_Addresses.AddTo(range); } } - virtual ~WrappedID3D12Resource1(); + virtual ~WrappedID3D12Resource(); byte *GetMap(UINT Subresource); byte *GetShadow(UINT Subresource); @@ -1019,6 +1036,22 @@ public: return S_OK; } + + ////////////////////////////// + // implement ID3D12Resource2 + virtual D3D12_RESOURCE_DESC1 STDMETHODCALLTYPE GetDesc1(void) + { + ID3D12Resource2 *real2 = NULL; + m_pReal->QueryInterface(__uuidof(ID3D12Resource2), (void **)&real2); + + if(!real2) + return {}; + + D3D12_RESOURCE_DESC1 ret = real2->GetDesc1(); + + SAFE_RELEASE(real2); + return ret; + } }; class WrappedID3D12RootSignature : public WrappedDeviceChild12 @@ -1040,18 +1073,18 @@ public: virtual ~WrappedID3D12RootSignature() { Shutdown(); } }; -class WrappedID3D12PipelineLibrary1 : public WrappedDeviceChild12 +class WrappedID3D12PipelineLibrary : public WrappedDeviceChild12 { public: - ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12PipelineLibrary1); + ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12PipelineLibrary); enum { TypeEnum = Resource_PipelineLibrary, }; - WrappedID3D12PipelineLibrary1(WrappedID3D12Device *device) : WrappedDeviceChild12(NULL, device) {} - virtual ~WrappedID3D12PipelineLibrary1() { Shutdown(); } + WrappedID3D12PipelineLibrary(WrappedID3D12Device *device) : WrappedDeviceChild12(NULL, device) {} + virtual ~WrappedID3D12PipelineLibrary() { Shutdown(); } virtual HRESULT STDMETHODCALLTYPE StorePipeline(_In_opt_ LPCWSTR pName, _In_ ID3D12PipelineState *pPipeline) { @@ -1112,13 +1145,13 @@ public: D3D12_TYPE_MACRO(ID3D12CommandAllocator); \ D3D12_TYPE_MACRO(ID3D12CommandSignature); \ D3D12_TYPE_MACRO(ID3D12DescriptorHeap); \ - D3D12_TYPE_MACRO(ID3D12Fence1); \ - D3D12_TYPE_MACRO(ID3D12Heap1); \ + D3D12_TYPE_MACRO(ID3D12Fence); \ + D3D12_TYPE_MACRO(ID3D12Heap); \ D3D12_TYPE_MACRO(ID3D12PipelineState); \ D3D12_TYPE_MACRO(ID3D12QueryHeap); \ - D3D12_TYPE_MACRO(ID3D12Resource1); \ + D3D12_TYPE_MACRO(ID3D12Resource); \ D3D12_TYPE_MACRO(ID3D12RootSignature); \ - D3D12_TYPE_MACRO(ID3D12PipelineLibrary1); \ + D3D12_TYPE_MACRO(ID3D12PipelineLibrary); \ D3D12_TYPE_MACRO(ID3D12ProtectedResourceSession); // template magic voodoo to unwrap types @@ -1151,18 +1184,20 @@ ALL_D3D12_TYPES; // extra helpers here for '1' or '2' extended interfaces #define D3D12_UNWRAP_EXTENDED(iface, ifaceX) \ template <> \ - struct UnwrapHelper \ + struct UnwrapHelper \ { \ - typedef CONCAT(Wrapped, ifaceX) Outer; \ + typedef CONCAT(Wrapped, iface) Outer; \ static bool IsAlloc(void *ptr) { return Outer::IsAlloc(ptr); } \ static D3D12ResourceType GetTypeEnum() { return (D3D12ResourceType)Outer::TypeEnum; } \ - static Outer *FromHandle(iface *wrapped) { return (Outer *)wrapped; } \ + static Outer *FromHandle(ifaceX *wrapped) { return (Outer *)wrapped; } \ }; D3D12_UNWRAP_EXTENDED(ID3D12Fence, ID3D12Fence1); D3D12_UNWRAP_EXTENDED(ID3D12PipelineLibrary, ID3D12PipelineLibrary1); D3D12_UNWRAP_EXTENDED(ID3D12Heap, ID3D12Heap1); D3D12_UNWRAP_EXTENDED(ID3D12Resource, ID3D12Resource1); +D3D12_UNWRAP_EXTENDED(ID3D12Resource, ID3D12Resource2); +D3D12_UNWRAP_EXTENDED(ID3D12ProtectedResourceSession, ID3D12ProtectedResourceSession1); D3D12ResourceType IdentifyTypeByPtr(ID3D12Object *ptr); diff --git a/renderdoc/driver/d3d12/d3d12_serialise.cpp b/renderdoc/driver/d3d12/d3d12_serialise.cpp index cd154696e..fe871b92e 100644 --- a/renderdoc/driver/d3d12/d3d12_serialise.cpp +++ b/renderdoc/driver/d3d12/d3d12_serialise.cpp @@ -299,7 +299,7 @@ void DoSerialise(SerialiserType &ser, D3D12BufferLocation &el) UINT64 offs = 0; if(ser.IsWriting() || ser.IsStructurising()) - WrappedID3D12Resource1::GetResIDFromAddr(el.Location, buffer, offs); + WrappedID3D12Resource::GetResIDFromAddr(el.Location, buffer, offs); if(ser.IsStructurising() && rm) buffer = rm->GetOriginalID(buffer); @@ -506,6 +506,30 @@ void DoSerialise(SerialiserType &ser, D3D12_RESOURCE_DESC &el) SERIALISE_MEMBER(Flags); } +template +void DoSerialise(SerialiserType &ser, D3D12_MIP_REGION &el) +{ + SERIALISE_MEMBER(Width); + SERIALISE_MEMBER(Height); + SERIALISE_MEMBER(Depth); +} + +template +void DoSerialise(SerialiserType &ser, D3D12_RESOURCE_DESC1 &el) +{ + SERIALISE_MEMBER(Dimension); + SERIALISE_MEMBER(Alignment); + SERIALISE_MEMBER(Width); + SERIALISE_MEMBER(Height); + SERIALISE_MEMBER(DepthOrArraySize); + SERIALISE_MEMBER(MipLevels); + SERIALISE_MEMBER(Format); + SERIALISE_MEMBER(SampleDesc); + SERIALISE_MEMBER(Layout); + SERIALISE_MEMBER(Flags); + SERIALISE_MEMBER(SamplerFeedbackMipRegion); +} + template void DoSerialise(SerialiserType &ser, D3D12_COMMAND_QUEUE_DESC &el) { @@ -1523,6 +1547,7 @@ INSTANTIATE_SERIALISE_TYPE(D3D12Descriptor); INSTANTIATE_SERIALISE_TYPE(D3D12_EXPANDED_PIPELINE_STATE_STREAM_DESC); INSTANTIATE_SERIALISE_TYPE(D3D12_RESOURCE_DESC); +INSTANTIATE_SERIALISE_TYPE(D3D12_RESOURCE_DESC1); INSTANTIATE_SERIALISE_TYPE(D3D12_COMMAND_QUEUE_DESC); INSTANTIATE_SERIALISE_TYPE(D3D12_SHADER_BYTECODE); INSTANTIATE_SERIALISE_TYPE(D3D12_GRAPHICS_PIPELINE_STATE_DESC); diff --git a/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp b/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp index 66f534ace..6e5411181 100644 --- a/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp +++ b/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp @@ -1730,7 +1730,7 @@ void GatherConstantBuffers(WrappedID3D12Device *pDevice, const DXBCBytecode::Pro const D3D12_CONSTANT_BUFFER_VIEW_DESC &cbv = desc->GetCBV(); ResourceId resId; uint64_t byteOffset = 0; - WrappedID3D12Resource1::GetResIDFromAddr(cbv.BufferLocation, resId, byteOffset); + WrappedID3D12Resource::GetResIDFromAddr(cbv.BufferLocation, resId, byteOffset); ID3D12Resource *pCbvResource = pDevice->GetResourceManager()->GetCurrentAs(resId); cbufData.clear(); diff --git a/renderdoc/driver/d3d12/d3d12_stringise.cpp b/renderdoc/driver/d3d12/d3d12_stringise.cpp index 9c8381690..195cf37a0 100644 --- a/renderdoc/driver/d3d12/d3d12_stringise.cpp +++ b/renderdoc/driver/d3d12/d3d12_stringise.cpp @@ -28,7 +28,7 @@ template <> rdcstr DoStringise(const D3D12Chunk &el) { - RDCCOMPILE_ASSERT((uint32_t)D3D12Chunk::Max == 1110, "Chunks changed without updating names"); + RDCCOMPILE_ASSERT((uint32_t)D3D12Chunk::Max == 1112, "Chunks changed without updating names"); BEGIN_ENUM_STRINGISE(D3D12Chunk) { @@ -198,6 +198,11 @@ rdcstr DoStringise(const D3D12Chunk &el) STRINGISE_ENUM_CLASS_NAMED(CompatDevice_CreateSharedHeap, "ID3D12CompatibilityDevice::CreateSharedHeap"); STRINGISE_ENUM_CLASS_NAMED(SetShaderExtUAV, "Vendor Extension: Set magic shader UAV slot"); + + STRINGISE_ENUM_CLASS_NAMED(Device_CreateCommittedResource2, + "ID3D12Device8::CreateCommittedResource2"); + STRINGISE_ENUM_CLASS_NAMED(Device_CreatePlacedResource1, + "ID3D12Device8::CreatePlacedResource1"); STRINGISE_ENUM_CLASS_NAMED(Max, "Max Chunk"); } END_ENUM_STRINGISE() diff --git a/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj b/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj index f6331e6b3..16faca8bc 100644 --- a/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj +++ b/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj @@ -107,6 +107,7 @@ + @@ -119,6 +120,9 @@ + + + diff --git a/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj.filters b/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj.filters index 3e65d1a22..1fda08c75 100644 --- a/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj.filters +++ b/renderdoc/driver/d3d12/renderdoc_d3d12.vcxproj.filters @@ -185,5 +185,17 @@ Replay + + Wrapped + + + Wrapped + + + Wrapped + + + Wrapped + \ No newline at end of file