From 9194157eeccd8e162f0e423044a0f4e6b7c0bebd Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 18 Sep 2017 15:34:09 +0100 Subject: [PATCH] Add explicit template instantiation of serialise functions --- renderdoc/driver/d3d11/d3d11_context.h | 1112 ++++++++--------- .../driver/d3d11/d3d11_context1_wrap.cpp | 9 + renderdoc/driver/d3d11/d3d11_context_wrap.cpp | 10 + renderdoc/driver/d3d11/d3d11_device.h | 447 +++---- renderdoc/driver/d3d11/d3d11_device1_wrap.cpp | 7 + renderdoc/driver/d3d11/d3d11_device3_wrap.cpp | 9 +- renderdoc/driver/d3d11/d3d11_device_wrap.cpp | 8 + renderdoc/driver/d3d11/d3d11_initstate.cpp | 5 + 8 files changed, 799 insertions(+), 808 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_context.h b/renderdoc/driver/d3d11/d3d11_context.h index 02aa5c388..3228f2e8e 100644 --- a/renderdoc/driver/d3d11/d3d11_context.h +++ b/renderdoc/driver/d3d11/d3d11_context.h @@ -236,13 +236,19 @@ private: ID3D11DepthStencilView *DSV, UINT UAVStartSlot, UINT NumUAVs, ID3D11UnorderedAccessView *UAVs[]); - //////////////////////////////////////////////////////////////// - // implement InterceptorSystem privately, since it is not thread safe (like all other context - // functions) - IMPLEMENT_FUNCTION_SERIALISED(void, SetMarker, uint32_t col, const wchar_t *name); - IMPLEMENT_FUNCTION_SERIALISED(int, PushMarker, uint32_t col, const wchar_t *name); +//////////////////////////////////////////////////////////////// +// implement InterceptorSystem privately, since it is not thread safe (like all other context +// functions) + +// this is defined as a macro so that we can re-use it to explicitly instantiate these functions as +// templates in the wrapper definition file. +#define SERIALISED_ID3D11CONTEXT_MARKER_FUNCTIONS() \ + IMPLEMENT_FUNCTION_SERIALISED(void, SetMarker, uint32_t col, const wchar_t *name); \ + IMPLEMENT_FUNCTION_SERIALISED(int, PushMarker, uint32_t col, const wchar_t *name); \ IMPLEMENT_FUNCTION_SERIALISED(int, PopMarker); + SERIALISED_ID3D11CONTEXT_MARKER_FUNCTIONS(); + public: static const int AllocPoolCount = 1024; static const int AllocPoolMaxByteSize = 3 * 1024 * 1024; @@ -327,590 +333,518 @@ public: virtual void STDMETHODCALLTYPE GetDevice(ID3D11Device **ppDevice); - ////////////////////////////// - // implement ID3D11DeviceContext - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - VSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer *const *ppConstantBuffers)); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual void STDMETHODCALLTYPE, - PSSetShaderResources(UINT StartSlot, UINT NumViews, - ID3D11ShaderResourceView *const *ppShaderResourceViews)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - PSSetShader(ID3D11PixelShader *pPixelShader, - ID3D11ClassInstance *const *ppClassInstances, - UINT NumClassInstances)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - PSSetSamplers(UINT StartSlot, UINT NumSamplers, - ID3D11SamplerState *const *ppSamplers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - VSSetShader(ID3D11VertexShader *pVertexShader, - ID3D11ClassInstance *const *ppClassInstances, - UINT NumClassInstances)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DrawIndexed(UINT IndexCount, UINT StartIndexLocation, - INT BaseVertexLocation)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - Draw(UINT VertexCount, UINT StartVertexLocation)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, - Map(ID3D11Resource *pResource, UINT Subresource, D3D11_MAP MapType, - UINT MapFlags, D3D11_MAPPED_SUBRESOURCE *pMappedResource)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - Unmap(ID3D11Resource *pResource, UINT Subresource)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - PSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer *const *ppConstantBuffers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - IASetInputLayout(ID3D11InputLayout *pInputLayout)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - IASetVertexBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer *const *ppVertexBuffers, - const UINT *pStrides, const UINT *pOffsets)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - IASetIndexBuffer(ID3D11Buffer *pIndexBuffer, DXGI_FORMAT Format, - UINT Offset)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DrawIndexedInstanced(UINT IndexCountPerInstance, UINT InstanceCount, - UINT StartIndexLocation, INT BaseVertexLocation, - UINT StartInstanceLocation)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DrawInstanced(UINT VertexCountPerInstance, UINT InstanceCount, - UINT StartVertexLocation, UINT StartInstanceLocation)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - GSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer *const *ppConstantBuffers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - GSSetShader(ID3D11GeometryShader *pShader, - ID3D11ClassInstance *const *ppClassInstances, - UINT NumClassInstances)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY Topology)); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual void STDMETHODCALLTYPE, - VSSetShaderResources(UINT StartSlot, UINT NumViews, - ID3D11ShaderResourceView *const *ppShaderResourceViews)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - VSSetSamplers(UINT StartSlot, UINT NumSamplers, - ID3D11SamplerState *const *ppSamplers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, Begin(ID3D11Asynchronous *pAsync)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, End(ID3D11Asynchronous *pAsync)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, - GetData(ID3D11Asynchronous *pAsync, void *pData, UINT DataSize, - UINT GetDataFlags)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - SetPredication(ID3D11Predicate *pPredicate, BOOL PredicateValue)); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual void STDMETHODCALLTYPE, - GSSetShaderResources(UINT StartSlot, UINT NumViews, - ID3D11ShaderResourceView *const *ppShaderResourceViews)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - GSSetSamplers(UINT StartSlot, UINT NumSamplers, - ID3D11SamplerState *const *ppSamplers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - OMSetRenderTargets(UINT NumViews, - ID3D11RenderTargetView *const *ppRenderTargetViews, - ID3D11DepthStencilView *pDepthStencilView)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - OMSetRenderTargetsAndUnorderedAccessViews( - UINT NumRTVs, ID3D11RenderTargetView *const *ppRenderTargetViews, - ID3D11DepthStencilView *pDepthStencilView, UINT UAVStartSlot, - UINT NumUAVs, - ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, - const UINT *pUAVInitialCounts)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - OMSetBlendState(ID3D11BlendState *pBlendState, - const FLOAT BlendFactor[4], UINT SampleMask)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - OMSetDepthStencilState(ID3D11DepthStencilState *pDepthStencilState, - UINT StencilRef)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - SOSetTargets(UINT NumBuffers, ID3D11Buffer *const *ppSOTargets, - const UINT *pOffsets)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DrawAuto(void)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DrawIndexedInstancedIndirect(ID3D11Buffer *pBufferForArgs, - UINT AlignedByteOffsetForArgs)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DrawInstancedIndirect(ID3D11Buffer *pBufferForArgs, - UINT AlignedByteOffsetForArgs)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - Dispatch(UINT ThreadGroupCountX, UINT ThreadGroupCountY, - UINT ThreadGroupCountZ)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DispatchIndirect(ID3D11Buffer *pBufferForArgs, - UINT AlignedByteOffsetForArgs)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - RSSetState(ID3D11RasterizerState *pRasterizerState)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - RSSetViewports(UINT NumViewports, const D3D11_VIEWPORT *pViewports)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - RSSetScissorRects(UINT NumRects, const D3D11_RECT *pRects)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - CopySubresourceRegion(ID3D11Resource *pDstResource, - UINT DstSubresource, UINT DstX, UINT DstY, - UINT DstZ, ID3D11Resource *pSrcResource, - UINT SrcSubresource, const D3D11_BOX *pSrcBox)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - CopyResource(ID3D11Resource *pDstResource, - ID3D11Resource *pSrcResource)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - UpdateSubresource(ID3D11Resource *pDstResource, UINT DstSubresource, - const D3D11_BOX *pDstBox, const void *pSrcData, - UINT SrcRowPitch, UINT SrcDepthPitch)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - CopyStructureCount(ID3D11Buffer *pDstBuffer, UINT DstAlignedByteOffset, - ID3D11UnorderedAccessView *pSrcView)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - ClearRenderTargetView(ID3D11RenderTargetView *pRenderTargetView, - const FLOAT ColorRGBA[4])); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual void STDMETHODCALLTYPE, - ClearUnorderedAccessViewUint(ID3D11UnorderedAccessView *pUnorderedAccessView, - const UINT Values[4])); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual void STDMETHODCALLTYPE, - ClearUnorderedAccessViewFloat(ID3D11UnorderedAccessView *pUnorderedAccessView, - const FLOAT Values[4])); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - ClearDepthStencilView(ID3D11DepthStencilView *pDepthStencilView, - UINT ClearFlags, FLOAT Depth, UINT8 Stencil)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - GenerateMips(ID3D11ShaderResourceView *pShaderResourceView)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - SetResourceMinLOD(ID3D11Resource *pResource, FLOAT MinLOD)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual FLOAT STDMETHODCALLTYPE, - GetResourceMinLOD(ID3D11Resource *pResource)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - ResolveSubresource(ID3D11Resource *pDstResource, - UINT DstSubresource, ID3D11Resource *pSrcResource, - UINT SrcSubresource, DXGI_FORMAT Format)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - ExecuteCommandList(ID3D11CommandList *pCommandList, - BOOL RestoreContextState)); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual void STDMETHODCALLTYPE, - HSSetShaderResources(UINT StartSlot, UINT NumViews, - ID3D11ShaderResourceView *const *ppShaderResourceViews)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - HSSetShader(ID3D11HullShader *pHullShader, - ID3D11ClassInstance *const *ppClassInstances, - UINT NumClassInstances)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - HSSetSamplers(UINT StartSlot, UINT NumSamplers, - ID3D11SamplerState *const *ppSamplers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - HSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer *const *ppConstantBuffers)); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual void STDMETHODCALLTYPE, - DSSetShaderResources(UINT StartSlot, UINT NumViews, - ID3D11ShaderResourceView *const *ppShaderResourceViews)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DSSetShader(ID3D11DomainShader *pDomainShader, - ID3D11ClassInstance *const *ppClassInstances, - UINT NumClassInstances)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DSSetSamplers(UINT StartSlot, UINT NumSamplers, - ID3D11SamplerState *const *ppSamplers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer *const *ppConstantBuffers)); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual void STDMETHODCALLTYPE, - CSSetShaderResources(UINT StartSlot, UINT NumViews, - ID3D11ShaderResourceView *const *ppShaderResourceViews)); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual void STDMETHODCALLTYPE, - CSSetUnorderedAccessViews(UINT StartSlot, UINT NumUAVs, - ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, - const UINT *pUAVInitialCounts)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - CSSetShader(ID3D11ComputeShader *pComputeShader, - ID3D11ClassInstance *const *ppClassInstances, - UINT NumClassInstances)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - CSSetSamplers(UINT StartSlot, UINT NumSamplers, - ID3D11SamplerState *const *ppSamplers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - CSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer *const *ppConstantBuffers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - VSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer **ppConstantBuffers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - PSGetShaderResources(UINT StartSlot, UINT NumViews, - ID3D11ShaderResourceView **ppShaderResourceViews)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - PSGetShader(ID3D11PixelShader **ppPixelShader, - ID3D11ClassInstance **ppClassInstances, - UINT *pNumClassInstances)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - PSGetSamplers(UINT StartSlot, UINT NumSamplers, - ID3D11SamplerState **ppSamplers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - VSGetShader(ID3D11VertexShader **ppVertexShader, - ID3D11ClassInstance **ppClassInstances, - UINT *pNumClassInstances)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - PSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer **ppConstantBuffers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - IAGetInputLayout(ID3D11InputLayout **ppInputLayout)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - IAGetVertexBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer **ppVertexBuffers, UINT *pStrides, - UINT *pOffsets)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - IAGetIndexBuffer(ID3D11Buffer **pIndexBuffer, DXGI_FORMAT *Format, - UINT *Offset)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - GSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer **ppConstantBuffers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - GSGetShader(ID3D11GeometryShader **ppGeometryShader, - ID3D11ClassInstance **ppClassInstances, - UINT *pNumClassInstances)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - IAGetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY *pTopology)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - VSGetShaderResources(UINT StartSlot, UINT NumViews, - ID3D11ShaderResourceView **ppShaderResourceViews)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - VSGetSamplers(UINT StartSlot, UINT NumSamplers, - ID3D11SamplerState **ppSamplers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - GetPredication(ID3D11Predicate **ppPredicate, BOOL *pPredicateValue)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - GSGetShaderResources(UINT StartSlot, UINT NumViews, - ID3D11ShaderResourceView **ppShaderResourceViews)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - GSGetSamplers(UINT StartSlot, UINT NumSamplers, - ID3D11SamplerState **ppSamplers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - OMGetRenderTargets(UINT NumViews, - ID3D11RenderTargetView **ppRenderTargetViews, - ID3D11DepthStencilView **ppDepthStencilView)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - OMGetRenderTargetsAndUnorderedAccessViews( - UINT NumRTVs, ID3D11RenderTargetView **ppRenderTargetViews, - ID3D11DepthStencilView **ppDepthStencilView, UINT UAVStartSlot, - UINT NumUAVs, ID3D11UnorderedAccessView **ppUnorderedAccessViews)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - OMGetBlendState(ID3D11BlendState **ppBlendState, - FLOAT BlendFactor[4], UINT *pSampleMask)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - OMGetDepthStencilState(ID3D11DepthStencilState **ppDepthStencilState, - UINT *pStencilRef)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - SOGetTargets(UINT NumBuffers, ID3D11Buffer **ppSOTargets)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - RSGetState(ID3D11RasterizerState **ppRasterizerState)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - RSGetViewports(UINT *pNumViewports, D3D11_VIEWPORT *pViewports)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - RSGetScissorRects(UINT *pNumRects, D3D11_RECT *pRects)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - HSGetShaderResources(UINT StartSlot, UINT NumViews, - ID3D11ShaderResourceView **ppShaderResourceViews)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - HSGetShader(ID3D11HullShader **ppHullShader, - ID3D11ClassInstance **ppClassInstances, - UINT *pNumClassInstances)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - HSGetSamplers(UINT StartSlot, UINT NumSamplers, - ID3D11SamplerState **ppSamplers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - HSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer **ppConstantBuffers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DSGetShaderResources(UINT StartSlot, UINT NumViews, - ID3D11ShaderResourceView **ppShaderResourceViews)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DSGetShader(ID3D11DomainShader **ppDomainShader, - ID3D11ClassInstance **ppClassInstances, - UINT *pNumClassInstances)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DSGetSamplers(UINT StartSlot, UINT NumSamplers, - ID3D11SamplerState **ppSamplers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer **ppConstantBuffers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - CSGetShaderResources(UINT StartSlot, UINT NumViews, - ID3D11ShaderResourceView **ppShaderResourceViews)); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual void STDMETHODCALLTYPE, - CSGetUnorderedAccessViews(UINT StartSlot, UINT NumUAVs, - ID3D11UnorderedAccessView **ppUnorderedAccessViews)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - CSGetShader(ID3D11ComputeShader **ppComputeShader, - ID3D11ClassInstance **ppClassInstances, - UINT *pNumClassInstances)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - CSGetSamplers(UINT StartSlot, UINT NumSamplers, - ID3D11SamplerState **ppSamplers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - CSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer **ppConstantBuffers)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, ClearState(void)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, Flush(void)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE, GetType(void)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual UINT STDMETHODCALLTYPE, GetContextFlags(void)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, - FinishCommandList(BOOL RestoreDeferredContextState, - ID3D11CommandList **ppCommandList)); - - ////////////////////////////// - // implement ID3D11DeviceContext1 - - // outside the define as it doesn't depend on any 11_1 definitions, and it's just an unused - // virtual function. We re-use the Serialise_UpdateSubresource1 function for - // Serialise_UpdateSubresource - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - UpdateSubresource1(ID3D11Resource *pDstResource, - UINT DstSubresource, const D3D11_BOX *pDstBox, - const void *pSrcData, UINT SrcRowPitch, - UINT SrcDepthPitch, UINT CopyFlags)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - CopySubresourceRegion1(ID3D11Resource *pDstResource, - UINT DstSubresource, UINT DstX, UINT DstY, - UINT DstZ, ID3D11Resource *pSrcResource, - UINT SrcSubresource, - const D3D11_BOX *pSrcBox, UINT CopyFlags)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DiscardResource(ID3D11Resource *pResource)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DiscardView(ID3D11View *pResourceView)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - VSSetConstantBuffers1(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer *const *ppConstantBuffers, - const UINT *pFirstConstant, - const UINT *pNumConstants)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - HSSetConstantBuffers1(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer *const *ppConstantBuffers, - const UINT *pFirstConstant, - const UINT *pNumConstants)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DSSetConstantBuffers1(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer *const *ppConstantBuffers, - const UINT *pFirstConstant, - const UINT *pNumConstants)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - GSSetConstantBuffers1(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer *const *ppConstantBuffers, - const UINT *pFirstConstant, - const UINT *pNumConstants)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - PSSetConstantBuffers1(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer *const *ppConstantBuffers, - const UINT *pFirstConstant, - const UINT *pNumConstants)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - CSSetConstantBuffers1(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer *const *ppConstantBuffers, - const UINT *pFirstConstant, - const UINT *pNumConstants)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - VSGetConstantBuffers1(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer **ppConstantBuffers, - UINT *pFirstConstant, UINT *pNumConstants)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - HSGetConstantBuffers1(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer **ppConstantBuffers, - UINT *pFirstConstant, UINT *pNumConstants)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DSGetConstantBuffers1(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer **ppConstantBuffers, - UINT *pFirstConstant, UINT *pNumConstants)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - GSGetConstantBuffers1(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer **ppConstantBuffers, - UINT *pFirstConstant, UINT *pNumConstants)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - PSGetConstantBuffers1(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer **ppConstantBuffers, - UINT *pFirstConstant, UINT *pNumConstants)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - CSGetConstantBuffers1(UINT StartSlot, UINT NumBuffers, - ID3D11Buffer **ppConstantBuffers, - UINT *pFirstConstant, UINT *pNumConstants)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - SwapDeviceContextState(ID3DDeviceContextState *pState, - ID3DDeviceContextState **ppPreviousState)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - ClearView(ID3D11View *pView, const FLOAT Color[4], - const D3D11_RECT *pRect, UINT NumRects)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, - DiscardView1(ID3D11View *pResourceView, const D3D11_RECT *pRects, - UINT NumRects)); - - ////////////////////////////// - // implement ID3D11DeviceContext2 - - IMPLEMENT_FUNCTION_SERIALISED( - virtual HRESULT STDMETHODCALLTYPE, - UpdateTileMappings(ID3D11Resource *pTiledResource, UINT NumTiledResourceRegions, - const D3D11_TILED_RESOURCE_COORDINATE *pTiledResourceRegionStartCoordinates, - const D3D11_TILE_REGION_SIZE *pTiledResourceRegionSizes, - ID3D11Buffer *pTilePool, UINT NumRanges, const UINT *pRangeFlags, - const UINT *pTilePoolStartOffsets, const UINT *pRangeTileCounts, UINT Flags)); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual HRESULT STDMETHODCALLTYPE, - CopyTileMappings(ID3D11Resource *pDestTiledResource, - const D3D11_TILED_RESOURCE_COORDINATE *pDestRegionStartCoordinate, - ID3D11Resource *pSourceTiledResource, - const D3D11_TILED_RESOURCE_COORDINATE *pSourceRegionStartCoordinate, - const D3D11_TILE_REGION_SIZE *pTileRegionSize, UINT Flags)); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual void STDMETHODCALLTYPE, - CopyTiles(ID3D11Resource *pTiledResource, - const D3D11_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, - const D3D11_TILE_REGION_SIZE *pTileRegionSize, ID3D11Buffer *pBuffer, - UINT64 BufferStartOffsetInBytes, UINT Flags)); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual void STDMETHODCALLTYPE, - UpdateTiles(ID3D11Resource *pDestTiledResource, - const D3D11_TILED_RESOURCE_COORDINATE *pDestTileRegionStartCoordinate, - const D3D11_TILE_REGION_SIZE *pDestTileRegionSize, const void *pSourceTileData, - UINT Flags)); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, - ResizeTilePool(ID3D11Buffer *pTilePool, UINT64 NewSizeInBytes)); - - IMPLEMENT_FUNCTION_SERIALISED( - virtual void STDMETHODCALLTYPE, - TiledResourceBarrier(ID3D11DeviceChild *pTiledResourceOrViewAccessBeforeBarrier, - ID3D11DeviceChild *pTiledResourceOrViewAccessAfterBarrier)); +////////////////////////////// +// implement ID3D11DeviceContext + +// this is defined as a macro so that we can re-use it to explicitly instantiate these functions as +// templates in the wrapper definition file. +#define SERIALISED_ID3D11CONTEXT_FUNCTIONS() \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, VSSetConstantBuffers, \ + UINT StartSlot, UINT NumBuffers, \ + ID3D11Buffer *const *ppConstantBuffers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, PSSetShaderResources, \ + UINT StartSlot, UINT NumViews, \ + ID3D11ShaderResourceView *const *ppShaderResourceViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual void STDMETHODCALLTYPE, PSSetShader, ID3D11PixelShader *pPixelShader, \ + ID3D11ClassInstance *const *ppClassInstances, UINT NumClassInstances); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, PSSetSamplers, UINT StartSlot, \ + UINT NumSamplers, ID3D11SamplerState *const *ppSamplers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual void STDMETHODCALLTYPE, VSSetShader, ID3D11VertexShader *pVertexShader, \ + ID3D11ClassInstance *const *ppClassInstances, UINT NumClassInstances); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DrawIndexed, UINT IndexCount, \ + UINT StartIndexLocation, INT BaseVertexLocation); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, Draw, UINT VertexCount, \ + UINT StartVertexLocation); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, Map, ID3D11Resource *pResource, \ + UINT Subresource, D3D11_MAP MapType, UINT MapFlags, \ + D3D11_MAPPED_SUBRESOURCE *pMappedResource); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, Unmap, ID3D11Resource *pResource, \ + UINT Subresource); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, PSSetConstantBuffers, \ + UINT StartSlot, UINT NumBuffers, \ + ID3D11Buffer *const *ppConstantBuffers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, IASetInputLayout, \ + ID3D11InputLayout *pInputLayout); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, IASetVertexBuffers, UINT StartSlot, \ + UINT NumBuffers, ID3D11Buffer *const *ppVertexBuffers, \ + const UINT *pStrides, const UINT *pOffsets); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, IASetIndexBuffer, \ + ID3D11Buffer *pIndexBuffer, DXGI_FORMAT Format, UINT Offset); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DrawIndexedInstanced, \ + UINT IndexCountPerInstance, UINT InstanceCount, \ + UINT StartIndexLocation, INT BaseVertexLocation, \ + UINT StartInstanceLocation); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DrawInstanced, \ + UINT VertexCountPerInstance, UINT InstanceCount, \ + UINT StartVertexLocation, UINT StartInstanceLocation); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GSSetConstantBuffers, \ + UINT StartSlot, UINT NumBuffers, \ + ID3D11Buffer *const *ppConstantBuffers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual void STDMETHODCALLTYPE, GSSetShader, ID3D11GeometryShader *pShader, \ + ID3D11ClassInstance *const *ppClassInstances, UINT NumClassInstances); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, IASetPrimitiveTopology, \ + D3D11_PRIMITIVE_TOPOLOGY Topology); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, VSSetShaderResources, \ + UINT StartSlot, UINT NumViews, \ + ID3D11ShaderResourceView *const *ppShaderResourceViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, VSSetSamplers, UINT StartSlot, \ + UINT NumSamplers, ID3D11SamplerState *const *ppSamplers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, Begin, ID3D11Asynchronous *pAsync); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, End, ID3D11Asynchronous *pAsync); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, GetData, \ + ID3D11Asynchronous *pAsync, void *pData, UINT DataSize, \ + UINT GetDataFlags); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, SetPredication, \ + ID3D11Predicate *pPredicate, BOOL PredicateValue); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GSSetShaderResources, \ + UINT StartSlot, UINT NumViews, \ + ID3D11ShaderResourceView *const *ppShaderResourceViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GSSetSamplers, UINT StartSlot, \ + UINT NumSamplers, ID3D11SamplerState *const *ppSamplers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, OMSetRenderTargets, UINT NumViews, \ + ID3D11RenderTargetView *const *ppRenderTargetViews, \ + ID3D11DepthStencilView *pDepthStencilView); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual void STDMETHODCALLTYPE, OMSetRenderTargetsAndUnorderedAccessViews, UINT NumRTVs, \ + ID3D11RenderTargetView *const *ppRenderTargetViews, \ + ID3D11DepthStencilView *pDepthStencilView, UINT UAVStartSlot, UINT NumUAVs, \ + ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, const UINT *pUAVInitialCounts); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, OMSetBlendState, \ + ID3D11BlendState *pBlendState, const FLOAT BlendFactor[4], \ + UINT SampleMask); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, OMSetDepthStencilState, \ + ID3D11DepthStencilState *pDepthStencilState, UINT StencilRef); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, SOSetTargets, UINT NumBuffers, \ + ID3D11Buffer *const *ppSOTargets, const UINT *pOffsets); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DrawAuto); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DrawIndexedInstancedIndirect, \ + ID3D11Buffer *pBufferForArgs, UINT AlignedByteOffsetForArgs); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DrawInstancedIndirect, \ + ID3D11Buffer *pBufferForArgs, UINT AlignedByteOffsetForArgs); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, Dispatch, UINT ThreadGroupCountX, \ + UINT ThreadGroupCountY, UINT ThreadGroupCountZ); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DispatchIndirect, \ + ID3D11Buffer *pBufferForArgs, UINT AlignedByteOffsetForArgs); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, RSSetState, \ + ID3D11RasterizerState *pRasterizerState); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, RSSetViewports, UINT NumViewports, \ + const D3D11_VIEWPORT *pViewports); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, RSSetScissorRects, UINT NumRects, \ + const D3D11_RECT *pRects); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CopySubresourceRegion, \ + ID3D11Resource *pDstResource, UINT DstSubresource, UINT DstX, \ + UINT DstY, UINT DstZ, ID3D11Resource *pSrcResource, \ + UINT SrcSubresource, const D3D11_BOX *pSrcBox); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CopyResource, \ + ID3D11Resource *pDstResource, ID3D11Resource *pSrcResource); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, UpdateSubresource, \ + ID3D11Resource *pDstResource, UINT DstSubresource, \ + const D3D11_BOX *pDstBox, const void *pSrcData, UINT SrcRowPitch, \ + UINT SrcDepthPitch); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CopyStructureCount, \ + ID3D11Buffer *pDstBuffer, UINT DstAlignedByteOffset, \ + ID3D11UnorderedAccessView *pSrcView); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, ClearRenderTargetView, \ + ID3D11RenderTargetView *pRenderTargetView, \ + const FLOAT ColorRGBA[4]); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, ClearUnorderedAccessViewUint, \ + ID3D11UnorderedAccessView *pUnorderedAccessView, \ + const UINT Values[4]); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, ClearUnorderedAccessViewFloat, \ + ID3D11UnorderedAccessView *pUnorderedAccessView, \ + const FLOAT Values[4]); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, ClearDepthStencilView, \ + ID3D11DepthStencilView *pDepthStencilView, UINT ClearFlags, \ + FLOAT Depth, UINT8 Stencil); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GenerateMips, \ + ID3D11ShaderResourceView *pShaderResourceView); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, SetResourceMinLOD, \ + ID3D11Resource *pResource, FLOAT MinLOD); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual FLOAT STDMETHODCALLTYPE, GetResourceMinLOD, \ + ID3D11Resource *pResource); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual void STDMETHODCALLTYPE, ResolveSubresource, ID3D11Resource *pDstResource, \ + UINT DstSubresource, ID3D11Resource *pSrcResource, UINT SrcSubresource, DXGI_FORMAT Format); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, ExecuteCommandList, \ + ID3D11CommandList *pCommandList, BOOL RestoreContextState); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, HSSetShaderResources, \ + UINT StartSlot, UINT NumViews, \ + ID3D11ShaderResourceView *const *ppShaderResourceViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual void STDMETHODCALLTYPE, HSSetShader, ID3D11HullShader *pHullShader, \ + ID3D11ClassInstance *const *ppClassInstances, UINT NumClassInstances); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, HSSetSamplers, UINT StartSlot, \ + UINT NumSamplers, ID3D11SamplerState *const *ppSamplers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, HSSetConstantBuffers, \ + UINT StartSlot, UINT NumBuffers, \ + ID3D11Buffer *const *ppConstantBuffers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DSSetShaderResources, \ + UINT StartSlot, UINT NumViews, \ + ID3D11ShaderResourceView *const *ppShaderResourceViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual void STDMETHODCALLTYPE, DSSetShader, ID3D11DomainShader *pDomainShader, \ + ID3D11ClassInstance *const *ppClassInstances, UINT NumClassInstances); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DSSetSamplers, UINT StartSlot, \ + UINT NumSamplers, ID3D11SamplerState *const *ppSamplers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DSSetConstantBuffers, \ + UINT StartSlot, UINT NumBuffers, \ + ID3D11Buffer *const *ppConstantBuffers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CSSetShaderResources, \ + UINT StartSlot, UINT NumViews, \ + ID3D11ShaderResourceView *const *ppShaderResourceViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual void STDMETHODCALLTYPE, CSSetUnorderedAccessViews, UINT StartSlot, UINT NumUAVs, \ + ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, const UINT *pUAVInitialCounts); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual void STDMETHODCALLTYPE, CSSetShader, ID3D11ComputeShader *pComputeShader, \ + ID3D11ClassInstance *const *ppClassInstances, UINT NumClassInstances); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CSSetSamplers, UINT StartSlot, \ + UINT NumSamplers, ID3D11SamplerState *const *ppSamplers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CSSetConstantBuffers, \ + UINT StartSlot, UINT NumBuffers, \ + ID3D11Buffer *const *ppConstantBuffers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, VSGetConstantBuffers, \ + UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppConstantBuffers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, PSGetShaderResources, \ + UINT StartSlot, UINT NumViews, \ + ID3D11ShaderResourceView **ppShaderResourceViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, PSGetShader, \ + ID3D11PixelShader **ppPixelShader, \ + ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, PSGetSamplers, UINT StartSlot, \ + UINT NumSamplers, ID3D11SamplerState **ppSamplers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, VSGetShader, \ + ID3D11VertexShader **ppVertexShader, \ + ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, PSGetConstantBuffers, \ + UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppConstantBuffers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, IAGetInputLayout, \ + ID3D11InputLayout **ppInputLayout); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, IAGetVertexBuffers, \ + UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppVertexBuffers, \ + UINT *pStrides, UINT *pOffsets); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, IAGetIndexBuffer, \ + ID3D11Buffer **pIndexBuffer, DXGI_FORMAT *Format, UINT *Offset); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GSGetConstantBuffers, \ + UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppConstantBuffers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GSGetShader, \ + ID3D11GeometryShader **ppGeometryShader, \ + ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, IAGetPrimitiveTopology, \ + D3D11_PRIMITIVE_TOPOLOGY *pTopology); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, VSGetShaderResources, \ + UINT StartSlot, UINT NumViews, \ + ID3D11ShaderResourceView **ppShaderResourceViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, VSGetSamplers, UINT StartSlot, \ + UINT NumSamplers, ID3D11SamplerState **ppSamplers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GetPredication, \ + ID3D11Predicate **ppPredicate, BOOL *pPredicateValue); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GSGetShaderResources, \ + UINT StartSlot, UINT NumViews, \ + ID3D11ShaderResourceView **ppShaderResourceViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GSGetSamplers, UINT StartSlot, \ + UINT NumSamplers, ID3D11SamplerState **ppSamplers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, OMGetRenderTargets, UINT NumViews, \ + ID3D11RenderTargetView **ppRenderTargetViews, \ + ID3D11DepthStencilView **ppDepthStencilView); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual void STDMETHODCALLTYPE, OMGetRenderTargetsAndUnorderedAccessViews, UINT NumRTVs, \ + ID3D11RenderTargetView **ppRenderTargetViews, ID3D11DepthStencilView **ppDepthStencilView, \ + UINT UAVStartSlot, UINT NumUAVs, ID3D11UnorderedAccessView **ppUnorderedAccessViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, OMGetBlendState, \ + ID3D11BlendState **ppBlendState, FLOAT BlendFactor[4], \ + UINT *pSampleMask); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, OMGetDepthStencilState, \ + ID3D11DepthStencilState **ppDepthStencilState, UINT *pStencilRef); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, SOGetTargets, UINT NumBuffers, \ + ID3D11Buffer **ppSOTargets); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, RSGetState, \ + ID3D11RasterizerState **ppRasterizerState); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, RSGetViewports, \ + UINT *pNumViewports, D3D11_VIEWPORT *pViewports); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, RSGetScissorRects, \ + UINT *pNumRects, D3D11_RECT *pRects); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, HSGetShaderResources, \ + UINT StartSlot, UINT NumViews, \ + ID3D11ShaderResourceView **ppShaderResourceViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, HSGetShader, \ + ID3D11HullShader **ppHullShader, \ + ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, HSGetSamplers, UINT StartSlot, \ + UINT NumSamplers, ID3D11SamplerState **ppSamplers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, HSGetConstantBuffers, \ + UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppConstantBuffers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DSGetShaderResources, \ + UINT StartSlot, UINT NumViews, \ + ID3D11ShaderResourceView **ppShaderResourceViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DSGetShader, \ + ID3D11DomainShader **ppDomainShader, \ + ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DSGetSamplers, UINT StartSlot, \ + UINT NumSamplers, ID3D11SamplerState **ppSamplers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DSGetConstantBuffers, \ + UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppConstantBuffers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CSGetShaderResources, \ + UINT StartSlot, UINT NumViews, \ + ID3D11ShaderResourceView **ppShaderResourceViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CSGetUnorderedAccessViews, \ + UINT StartSlot, UINT NumUAVs, \ + ID3D11UnorderedAccessView **ppUnorderedAccessViews); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CSGetShader, \ + ID3D11ComputeShader **ppComputeShader, \ + ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CSGetSamplers, UINT StartSlot, \ + UINT NumSamplers, ID3D11SamplerState **ppSamplers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CSGetConstantBuffers, \ + UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppConstantBuffers); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, ClearState); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, Flush); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE, GetType); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual UINT STDMETHODCALLTYPE, GetContextFlags); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, FinishCommandList, \ + BOOL RestoreDeferredContextState, \ + ID3D11CommandList **ppCommandList); + + SERIALISED_ID3D11CONTEXT_FUNCTIONS(); + +////////////////////////////// +// implement ID3D11DeviceContext1 + +// this is defined as a macro so that we can re-use it to explicitly instantiate these functions as +// templates in the wrapper definition file. +#define SERIALISED_ID3D11CONTEXT1_FUNCTIONS() \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, UpdateSubresource1, \ + ID3D11Resource *pDstResource, UINT DstSubresource, \ + const D3D11_BOX *pDstBox, const void *pSrcData, UINT SrcRowPitch, \ + UINT SrcDepthPitch, UINT CopyFlags); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CopySubresourceRegion1, \ + ID3D11Resource *pDstResource, UINT DstSubresource, UINT DstX, \ + UINT DstY, UINT DstZ, ID3D11Resource *pSrcResource, \ + UINT SrcSubresource, const D3D11_BOX *pSrcBox, UINT CopyFlags); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DiscardResource, \ + ID3D11Resource *pResource); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DiscardView, \ + ID3D11View *pResourceView); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, VSSetConstantBuffers1, \ + UINT StartSlot, UINT NumBuffers, \ + ID3D11Buffer *const *ppConstantBuffers, \ + const UINT *pFirstConstant, const UINT *pNumConstants); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, HSSetConstantBuffers1, \ + UINT StartSlot, UINT NumBuffers, \ + ID3D11Buffer *const *ppConstantBuffers, \ + const UINT *pFirstConstant, const UINT *pNumConstants); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DSSetConstantBuffers1, \ + UINT StartSlot, UINT NumBuffers, \ + ID3D11Buffer *const *ppConstantBuffers, \ + const UINT *pFirstConstant, const UINT *pNumConstants); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GSSetConstantBuffers1, \ + UINT StartSlot, UINT NumBuffers, \ + ID3D11Buffer *const *ppConstantBuffers, \ + const UINT *pFirstConstant, const UINT *pNumConstants); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, PSSetConstantBuffers1, \ + UINT StartSlot, UINT NumBuffers, \ + ID3D11Buffer *const *ppConstantBuffers, \ + const UINT *pFirstConstant, const UINT *pNumConstants); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CSSetConstantBuffers1, \ + UINT StartSlot, UINT NumBuffers, \ + ID3D11Buffer *const *ppConstantBuffers, \ + const UINT *pFirstConstant, const UINT *pNumConstants); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, VSGetConstantBuffers1, \ + UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppConstantBuffers, \ + UINT *pFirstConstant, UINT *pNumConstants); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, HSGetConstantBuffers1, \ + UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppConstantBuffers, \ + UINT *pFirstConstant, UINT *pNumConstants); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DSGetConstantBuffers1, \ + UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppConstantBuffers, \ + UINT *pFirstConstant, UINT *pNumConstants); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GSGetConstantBuffers1, \ + UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppConstantBuffers, \ + UINT *pFirstConstant, UINT *pNumConstants); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, PSGetConstantBuffers1, \ + UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppConstantBuffers, \ + UINT *pFirstConstant, UINT *pNumConstants); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CSGetConstantBuffers1, \ + UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppConstantBuffers, \ + UINT *pFirstConstant, UINT *pNumConstants); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, SwapDeviceContextState, \ + ID3DDeviceContextState *pState, \ + ID3DDeviceContextState **ppPreviousState); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, ClearView, ID3D11View *pView, \ + const FLOAT Color[4], const D3D11_RECT *pRect, UINT NumRects); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, DiscardView1, \ + ID3D11View *pResourceView, const D3D11_RECT *pRects, UINT NumRects); + + SERIALISED_ID3D11CONTEXT1_FUNCTIONS(); + +////////////////////////////// +// implement ID3D11DeviceContext2 + +// this is defined as a macro so that we can re-use it to explicitly instantiate these functions as +// templates in the wrapper definition file. +#define SERIALISED_ID3D11CONTEXT2_FUNCTIONS() \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, UpdateTileMappings, ID3D11Resource *pTiledResource, \ + UINT NumTiledResourceRegions, \ + const D3D11_TILED_RESOURCE_COORDINATE *pTiledResourceRegionStartCoordinates, \ + const D3D11_TILE_REGION_SIZE *pTiledResourceRegionSizes, ID3D11Buffer *pTilePool, \ + UINT NumRanges, const UINT *pRangeFlags, const UINT *pTilePoolStartOffsets, \ + const UINT *pRangeTileCounts, UINT Flags); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CopyTileMappings, ID3D11Resource *pDestTiledResource, \ + const D3D11_TILED_RESOURCE_COORDINATE *pDestRegionStartCoordinate, \ + ID3D11Resource *pSourceTiledResource, \ + const D3D11_TILED_RESOURCE_COORDINATE *pSourceRegionStartCoordinate, \ + const D3D11_TILE_REGION_SIZE *pTileRegionSize, UINT Flags); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual void STDMETHODCALLTYPE, CopyTiles, ID3D11Resource *pTiledResource, \ + const D3D11_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, \ + const D3D11_TILE_REGION_SIZE *pTileRegionSize, ID3D11Buffer *pBuffer, \ + UINT64 BufferStartOffsetInBytes, UINT Flags); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual void STDMETHODCALLTYPE, UpdateTiles, ID3D11Resource *pDestTiledResource, \ + const D3D11_TILED_RESOURCE_COORDINATE *pDestTileRegionStartCoordinate, \ + const D3D11_TILE_REGION_SIZE *pDestTileRegionSize, const void *pSourceTileData, UINT Flags); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, ResizeTilePool, \ + ID3D11Buffer *pTilePool, UINT64 NewSizeInBytes); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, TiledResourceBarrier, \ + ID3D11DeviceChild *pTiledResourceOrViewAccessBeforeBarrier, \ + ID3D11DeviceChild *pTiledResourceOrViewAccessAfterBarrier); + + SERIALISED_ID3D11CONTEXT2_FUNCTIONS(); virtual BOOL STDMETHODCALLTYPE IsAnnotationEnabled(); diff --git a/renderdoc/driver/d3d11/d3d11_context1_wrap.cpp b/renderdoc/driver/d3d11/d3d11_context1_wrap.cpp index aae947266..06facfc38 100644 --- a/renderdoc/driver/d3d11/d3d11_context1_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_context1_wrap.cpp @@ -2129,3 +2129,12 @@ void WrappedID3D11DeviceContext::SwapDeviceContextState(ID3DDeviceContextState * m_ContextRecord->AddChunk(scope.Get()); } } + +#undef IMPLEMENT_FUNCTION_SERIALISED +#define IMPLEMENT_FUNCTION_SERIALISED(ret, func, ...) \ + template bool WrappedID3D11DeviceContext::CONCAT(Serialise_, \ + func(ReadSerialiser &ser, __VA_ARGS__)); \ + template bool WrappedID3D11DeviceContext::CONCAT(Serialise_, \ + func(WriteSerialiser &ser, __VA_ARGS__)); + +SERIALISED_ID3D11CONTEXT1_FUNCTIONS(); diff --git a/renderdoc/driver/d3d11/d3d11_context_wrap.cpp b/renderdoc/driver/d3d11/d3d11_context_wrap.cpp index bc3253cc0..ba24c5ac2 100644 --- a/renderdoc/driver/d3d11/d3d11_context_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_context_wrap.cpp @@ -7986,3 +7986,13 @@ void WrappedID3D11DeviceContext::Unmap(ID3D11Resource *pResource, UINT Subresour } #pragma endregion Map + +#undef IMPLEMENT_FUNCTION_SERIALISED +#define IMPLEMENT_FUNCTION_SERIALISED(ret, func, ...) \ + template bool WrappedID3D11DeviceContext::CONCAT(Serialise_, \ + func(ReadSerialiser &ser, __VA_ARGS__)); \ + template bool WrappedID3D11DeviceContext::CONCAT(Serialise_, \ + func(WriteSerialiser &ser, __VA_ARGS__)); + +SERIALISED_ID3D11CONTEXT_FUNCTIONS(); +SERIALISED_ID3D11CONTEXT_MARKER_FUNCTIONS(); \ No newline at end of file diff --git a/renderdoc/driver/d3d11/d3d11_device.h b/renderdoc/driver/d3d11/d3d11_device.h index 8d70eeb17..3591c936f 100644 --- a/renderdoc/driver/d3d11/d3d11_device.h +++ b/renderdoc/driver/d3d11/d3d11_device.h @@ -514,19 +514,24 @@ public: const char *Path); IMPLEMENT_FUNCTION_SERIALISED(void, ReleaseResource, ID3D11DeviceChild *pResource); - // Class Linkage - IMPLEMENT_FUNCTION_SERIALISED(ID3D11ClassInstance *, CreateClassInstance, LPCSTR pClassTypeName, - UINT ConstantBufferOffset, UINT ConstantVectorOffset, - UINT TextureOffset, UINT SamplerOffset, - WrappedID3D11ClassLinkage *linkage, ID3D11ClassInstance *inst); - - IMPLEMENT_FUNCTION_SERIALISED(ID3D11ClassInstance *, GetClassInstance, LPCSTR pClassInstanceName, - UINT InstanceIndex, WrappedID3D11ClassLinkage *linkage, - ID3D11ClassInstance *inst); - // Swap Chain IMPLEMENT_FUNCTION_SERIALISED(IUnknown *, WrapSwapchainBuffer, WrappedIDXGISwapChain4 *swap, DXGI_SWAP_CHAIN_DESC *desc, UINT buffer, IUnknown *realSurface); + +// this is defined as a macro so that we can re-use it to explicitly instantiate these functions as +// templates in the wrapper definition file. +#define SERIALISED_ID3D11DEVICE_FAKE_FUNCTIONS() \ + IMPLEMENT_FUNCTION_SERIALISED(ID3D11ClassInstance *, CreateClassInstance, LPCSTR pClassTypeName, \ + UINT ConstantBufferOffset, UINT ConstantVectorOffset, \ + UINT TextureOffset, UINT SamplerOffset, \ + WrappedID3D11ClassLinkage *linkage, ID3D11ClassInstance *inst); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(ID3D11ClassInstance *, GetClassInstance, \ + LPCSTR pClassInstanceName, UINT InstanceIndex, \ + WrappedID3D11ClassLinkage *linkage, ID3D11ClassInstance *inst); + + SERIALISED_ID3D11DEVICE_FAKE_FUNCTIONS(); + HRESULT Present(WrappedIDXGISwapChain4 *swap, UINT SyncInterval, UINT Flags); void NewSwapchainBuffer(IUnknown *backbuffer); @@ -565,9 +570,6 @@ public: ////////////////////////////// // implement ID3D11Device - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateBuffer, - const D3D11_BUFFER_DESC *pDesc, - const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Buffer **ppBuffer); template TextureDisplayType DispTypeForTexture(TexDesc &Descriptor) @@ -596,185 +598,194 @@ public: SerialiserType &ser, ID3D11Resource *tex, ResourceId id, const D3D11_SUBRESOURCE_DATA *data, UINT w, UINT h, UINT d, DXGI_FORMAT fmt, UINT mips, UINT arr, bool HasData); - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateTexture1D, - const D3D11_TEXTURE1D_DESC *pDesc, - const D3D11_SUBRESOURCE_DATA *pInitialData, - ID3D11Texture1D **ppTexture1D); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateTexture2D, - const D3D11_TEXTURE2D_DESC *pDesc, - const D3D11_SUBRESOURCE_DATA *pInitialData, - ID3D11Texture2D **ppTexture2D); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateTexture3D, - const D3D11_TEXTURE3D_DESC *pDesc, - const D3D11_SUBRESOURCE_DATA *pInitialData, - ID3D11Texture3D **ppTexture3D); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateShaderResourceView, - ID3D11Resource *pResource, - const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, - ID3D11ShaderResourceView **ppSRView); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateUnorderedAccessView, - ID3D11Resource *pResource, - const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, - ID3D11UnorderedAccessView **ppUAView); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateRenderTargetView, - ID3D11Resource *pResource, const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, - ID3D11RenderTargetView **ppRTView); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateDepthStencilView, - ID3D11Resource *pResource, const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, - ID3D11DepthStencilView **ppDepthStencilView); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateInputLayout, - const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, - UINT NumElements, const void *pShaderBytecodeWithInputSignature, - SIZE_T BytecodeLength, ID3D11InputLayout **ppInputLayout); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateVertexShader, - const void *pShaderBytecode, SIZE_T BytecodeLength, - ID3D11ClassLinkage *pClassLinkage, - ID3D11VertexShader **ppVertexShader); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateGeometryShader, - const void *pShaderBytecode, SIZE_T BytecodeLength, - ID3D11ClassLinkage *pClassLinkage, - ID3D11GeometryShader **ppGeometryShader); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, - CreateGeometryShaderWithStreamOutput, const void *pShaderBytecode, - SIZE_T BytecodeLength, - const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, UINT NumEntries, - const UINT *pBufferStrides, UINT NumStrides, UINT RasterizedStream, - ID3D11ClassLinkage *pClassLinkage, - ID3D11GeometryShader **ppGeometryShader); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreatePixelShader, - const void *pShaderBytecode, SIZE_T BytecodeLength, - ID3D11ClassLinkage *pClassLinkage, ID3D11PixelShader **ppPixelShader); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateHullShader, - const void *pShaderBytecode, SIZE_T BytecodeLength, - ID3D11ClassLinkage *pClassLinkage, ID3D11HullShader **ppHullShader); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateDomainShader, - const void *pShaderBytecode, SIZE_T BytecodeLength, - ID3D11ClassLinkage *pClassLinkage, - ID3D11DomainShader **ppDomainShader); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateComputeShader, - const void *pShaderBytecode, SIZE_T BytecodeLength, - ID3D11ClassLinkage *pClassLinkage, - ID3D11ComputeShader **ppComputeShader); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateClassLinkage, - ID3D11ClassLinkage **ppLinkage); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateBlendState, - const D3D11_BLEND_DESC *pBlendStateDesc, - ID3D11BlendState **ppBlendState); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateDepthStencilState, - const D3D11_DEPTH_STENCIL_DESC *pDepthStencilDesc, - ID3D11DepthStencilState **ppDepthStencilState); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateRasterizerState, - const D3D11_RASTERIZER_DESC *pRasterizerDesc, - ID3D11RasterizerState **ppRasterizerState); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateSamplerState, - const D3D11_SAMPLER_DESC *pSamplerDesc, - ID3D11SamplerState **ppSamplerState); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateQuery, - const D3D11_QUERY_DESC *pQueryDesc, ID3D11Query **ppQuery); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreatePredicate, - const D3D11_QUERY_DESC *pPredicateDesc, - ID3D11Predicate **ppPredicate); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateCounter, - const D3D11_COUNTER_DESC *pCounterDesc, ID3D11Counter **ppCounter); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateDeferredContext, - UINT ContextFlags, ID3D11DeviceContext **ppDeferredContext); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, OpenSharedResource, - HANDLE hResource, REFIID ReturnedInterface, void **ppResource); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CheckFormatSupport, - DXGI_FORMAT Format, UINT *pFormatSupport); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CheckMultisampleQualityLevels, - DXGI_FORMAT Format, UINT SampleCount, UINT *pNumQualityLevels); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CheckCounterInfo, - D3D11_COUNTER_INFO *pCounterInfo); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CheckCounter, - const D3D11_COUNTER_DESC *pDesc, D3D11_COUNTER_TYPE *pType, - UINT *pActiveCounters, LPSTR szName, UINT *pNameLength, LPSTR szUnits, - UINT *pUnitsLength, LPSTR szDescription, UINT *pDescriptionLength); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CheckFeatureSupport, - D3D11_FEATURE Feature, void *pFeatureSupportData, - UINT FeatureSupportDataSize); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, GetPrivateData, REFGUID guid, - UINT *pDataSize, void *pData); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, SetPrivateData, REFGUID guid, - UINT DataSize, const void *pData); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, SetPrivateDataInterface, - REFGUID guid, const IUnknown *pData); - - IMPLEMENT_FUNCTION_SERIALISED(virtual D3D_FEATURE_LEVEL STDMETHODCALLTYPE, GetFeatureLevel); - - IMPLEMENT_FUNCTION_SERIALISED(virtual UINT STDMETHODCALLTYPE, GetCreationFlags); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, GetDeviceRemovedReason); - - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GetImmediateContext, - ID3D11DeviceContext **ppImmediateContext); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, SetExceptionMode, UINT RaiseFlags); - +// this is defined as a macro so that we can re-use it to explicitly instantiate these functions as +// templates in the wrapper definition file. +#define SERIALISED_ID3D11DEVICE_FUNCTIONS() \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateBuffer, const D3D11_BUFFER_DESC *pDesc, \ + const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Buffer **ppBuffer); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateTexture1D, const D3D11_TEXTURE1D_DESC *pDesc, \ + const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Texture1D **ppTexture1D); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateTexture2D, const D3D11_TEXTURE2D_DESC *pDesc, \ + const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Texture2D **ppTexture2D); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateTexture3D, const D3D11_TEXTURE3D_DESC *pDesc, \ + const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Texture3D **ppTexture3D); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateShaderResourceView, ID3D11Resource *pResource, \ + const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, ID3D11ShaderResourceView **ppSRView); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateUnorderedAccessView, ID3D11Resource *pResource, \ + const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, ID3D11UnorderedAccessView **ppUAView); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateRenderTargetView, ID3D11Resource *pResource, \ + const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, ID3D11RenderTargetView **ppRTView); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateDepthStencilView, ID3D11Resource *pResource, \ + const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, ID3D11DepthStencilView **ppDepthStencilView); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateInputLayout, \ + const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, \ + UINT NumElements, const void *pShaderBytecodeWithInputSignature, \ + SIZE_T BytecodeLength, ID3D11InputLayout **ppInputLayout); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateVertexShader, \ + const void *pShaderBytecode, SIZE_T BytecodeLength, \ + ID3D11ClassLinkage *pClassLinkage, \ + ID3D11VertexShader **ppVertexShader); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateGeometryShader, \ + const void *pShaderBytecode, SIZE_T BytecodeLength, \ + ID3D11ClassLinkage *pClassLinkage, \ + ID3D11GeometryShader **ppGeometryShader); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateGeometryShaderWithStreamOutput, \ + const void *pShaderBytecode, SIZE_T BytecodeLength, \ + const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, UINT NumEntries, \ + const UINT *pBufferStrides, UINT NumStrides, UINT RasterizedStream, \ + ID3D11ClassLinkage *pClassLinkage, ID3D11GeometryShader **ppGeometryShader); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreatePixelShader, const void *pShaderBytecode, \ + SIZE_T BytecodeLength, ID3D11ClassLinkage *pClassLinkage, ID3D11PixelShader **ppPixelShader); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateHullShader, const void *pShaderBytecode, \ + SIZE_T BytecodeLength, ID3D11ClassLinkage *pClassLinkage, ID3D11HullShader **ppHullShader); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateDomainShader, \ + const void *pShaderBytecode, SIZE_T BytecodeLength, \ + ID3D11ClassLinkage *pClassLinkage, \ + ID3D11DomainShader **ppDomainShader); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateComputeShader, \ + const void *pShaderBytecode, SIZE_T BytecodeLength, \ + ID3D11ClassLinkage *pClassLinkage, \ + ID3D11ComputeShader **ppComputeShader); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateClassLinkage, \ + ID3D11ClassLinkage **ppLinkage); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateBlendState, \ + const D3D11_BLEND_DESC *pBlendStateDesc, \ + ID3D11BlendState **ppBlendState); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateDepthStencilState, \ + const D3D11_DEPTH_STENCIL_DESC *pDepthStencilDesc, \ + ID3D11DepthStencilState **ppDepthStencilState); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateRasterizerState, \ + const D3D11_RASTERIZER_DESC *pRasterizerDesc, \ + ID3D11RasterizerState **ppRasterizerState); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateSamplerState, \ + const D3D11_SAMPLER_DESC *pSamplerDesc, \ + ID3D11SamplerState **ppSamplerState); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateQuery, \ + const D3D11_QUERY_DESC *pQueryDesc, ID3D11Query **ppQuery); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreatePredicate, \ + const D3D11_QUERY_DESC *pPredicateDesc, \ + ID3D11Predicate **ppPredicate); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateCounter, \ + const D3D11_COUNTER_DESC *pCounterDesc, ID3D11Counter **ppCounter); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateDeferredContext, \ + UINT ContextFlags, ID3D11DeviceContext **ppDeferredContext); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, OpenSharedResource, \ + HANDLE hResource, REFIID ReturnedInterface, void **ppResource); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CheckFormatSupport, \ + DXGI_FORMAT Format, UINT *pFormatSupport); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CheckMultisampleQualityLevels, \ + DXGI_FORMAT Format, UINT SampleCount, UINT *pNumQualityLevels); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, CheckCounterInfo, \ + D3D11_COUNTER_INFO *pCounterInfo); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CheckCounter, const D3D11_COUNTER_DESC *pDesc, \ + D3D11_COUNTER_TYPE *pType, UINT *pActiveCounters, LPSTR szName, UINT *pNameLength, \ + LPSTR szUnits, UINT *pUnitsLength, LPSTR szDescription, UINT *pDescriptionLength); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CheckFeatureSupport, \ + D3D11_FEATURE Feature, void *pFeatureSupportData, \ + UINT FeatureSupportDataSize); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, GetPrivateData, REFGUID guid, \ + UINT *pDataSize, void *pData); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, SetPrivateData, REFGUID guid, \ + UINT DataSize, const void *pData); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, SetPrivateDataInterface, \ + REFGUID guid, const IUnknown *pData); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual D3D_FEATURE_LEVEL STDMETHODCALLTYPE, GetFeatureLevel); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual UINT STDMETHODCALLTYPE, GetCreationFlags); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, GetDeviceRemovedReason); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GetImmediateContext, \ + ID3D11DeviceContext **ppImmediateContext); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, SetExceptionMode, \ + UINT RaiseFlags); \ + \ IMPLEMENT_FUNCTION_SERIALISED(virtual UINT STDMETHODCALLTYPE, GetExceptionMode); - ////////////////////////////// - // implement ID3D11Device1 + SERIALISED_ID3D11DEVICE_FUNCTIONS(); - IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GetImmediateContext1, - ID3D11DeviceContext1 **ppImmediateContext); +////////////////////////////// +// implement ID3D11Device1 - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateDeferredContext1, - UINT ContextFlags, ID3D11DeviceContext1 **ppDeferredContext); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateBlendState1, - const D3D11_BLEND_DESC1 *pBlendStateDesc, - ID3D11BlendState1 **ppBlendState); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateRasterizerState1, - const D3D11_RASTERIZER_DESC1 *pRasterizerDesc, - ID3D11RasterizerState1 **ppRasterizerState); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateDeviceContextState, - UINT Flags, const D3D_FEATURE_LEVEL *pFeatureLevels, - UINT FeatureLevels, UINT SDKVersion, REFIID EmulatedInterface, - D3D_FEATURE_LEVEL *pChosenFeatureLevel, - ID3DDeviceContextState **ppContextState); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, OpenSharedResource1, - HANDLE hResource, REFIID returnedInterface, void **ppResource); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, OpenSharedResourceByName, - LPCWSTR lpName, DWORD dwDesiredAccess, REFIID returnedInterface, +// this is defined as a macro so that we can re-use it to explicitly instantiate these functions as +// templates in the wrapper definition file. +#define SERIALISED_ID3D11DEVICE1_FUNCTIONS() \ + IMPLEMENT_FUNCTION_SERIALISED(virtual void STDMETHODCALLTYPE, GetImmediateContext1, \ + ID3D11DeviceContext1 **ppImmediateContext); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateDeferredContext1, \ + UINT ContextFlags, ID3D11DeviceContext1 **ppDeferredContext); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateBlendState1, \ + const D3D11_BLEND_DESC1 *pBlendStateDesc, \ + ID3D11BlendState1 **ppBlendState); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateRasterizerState1, \ + const D3D11_RASTERIZER_DESC1 *pRasterizerDesc, \ + ID3D11RasterizerState1 **ppRasterizerState); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateDeviceContextState, \ + UINT Flags, const D3D_FEATURE_LEVEL *pFeatureLevels, \ + UINT FeatureLevels, UINT SDKVersion, REFIID EmulatedInterface, \ + D3D_FEATURE_LEVEL *pChosenFeatureLevel, \ + ID3DDeviceContextState **ppContextState); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, OpenSharedResource1, \ + HANDLE hResource, REFIID returnedInterface, void **ppResource); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, OpenSharedResourceByName, \ + LPCWSTR lpName, DWORD dwDesiredAccess, REFIID returnedInterface, \ void **ppResource); + SERIALISED_ID3D11DEVICE1_FUNCTIONS(); + ////////////////////////////// // implement ID3D11Device2 @@ -793,41 +804,41 @@ public: UINT SampleCount, UINT Flags, UINT *pNumQualityLevels); - ////////////////////////////// - // implement ID3D11Device3 +////////////////////////////// +// implement ID3D11Device3 - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateTexture2D1, - const D3D11_TEXTURE2D_DESC1 *pDesc1, - const D3D11_SUBRESOURCE_DATA *pInitialData, - ID3D11Texture2D1 **ppTexture2D); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateTexture3D1, - const D3D11_TEXTURE3D_DESC1 *pDesc1, - const D3D11_SUBRESOURCE_DATA *pInitialData, - ID3D11Texture3D1 **ppTexture3D); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateRasterizerState2, - const D3D11_RASTERIZER_DESC2 *pRasterizerDesc, - ID3D11RasterizerState2 **ppRasterizerState); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateShaderResourceView1, - ID3D11Resource *pResource, - const D3D11_SHADER_RESOURCE_VIEW_DESC1 *pDesc1, - ID3D11ShaderResourceView1 **ppSRView1); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateUnorderedAccessView1, - ID3D11Resource *pResource, - const D3D11_UNORDERED_ACCESS_VIEW_DESC1 *pDesc1, - ID3D11UnorderedAccessView1 **ppUAView1); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateRenderTargetView1, - ID3D11Resource *pResource, - const D3D11_RENDER_TARGET_VIEW_DESC1 *pDesc1, - ID3D11RenderTargetView1 **ppRTView1); - - IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateQuery1, +// this is defined as a macro so that we can re-use it to explicitly instantiate these functions as +// templates in the wrapper definition file. +#define SERIALISED_ID3D11DEVICE3_FUNCTIONS() \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateTexture2D1, const D3D11_TEXTURE2D_DESC1 *pDesc1, \ + const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Texture2D1 **ppTexture2D); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateTexture3D1, const D3D11_TEXTURE3D_DESC1 *pDesc1, \ + const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Texture3D1 **ppTexture3D); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateRasterizerState2, \ + const D3D11_RASTERIZER_DESC2 *pRasterizerDesc, \ + ID3D11RasterizerState2 **ppRasterizerState); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateShaderResourceView1, ID3D11Resource *pResource, \ + const D3D11_SHADER_RESOURCE_VIEW_DESC1 *pDesc1, ID3D11ShaderResourceView1 **ppSRView1); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateUnorderedAccessView1, ID3D11Resource *pResource, \ + const D3D11_UNORDERED_ACCESS_VIEW_DESC1 *pDesc1, ID3D11UnorderedAccessView1 **ppUAView1); \ + \ + IMPLEMENT_FUNCTION_SERIALISED( \ + virtual HRESULT STDMETHODCALLTYPE, CreateRenderTargetView1, ID3D11Resource *pResource, \ + const D3D11_RENDER_TARGET_VIEW_DESC1 *pDesc1, ID3D11RenderTargetView1 **ppRTView1); \ + \ + IMPLEMENT_FUNCTION_SERIALISED(virtual HRESULT STDMETHODCALLTYPE, CreateQuery1, \ const D3D11_QUERY_DESC1 *pQueryDesc1, ID3D11Query1 **ppQuery1); + SERIALISED_ID3D11DEVICE3_FUNCTIONS(); + virtual void STDMETHODCALLTYPE GetImmediateContext3(ID3D11DeviceContext3 **ppImmediateContext); virtual HRESULT STDMETHODCALLTYPE CreateDeferredContext3(UINT ContextFlags, diff --git a/renderdoc/driver/d3d11/d3d11_device1_wrap.cpp b/renderdoc/driver/d3d11/d3d11_device1_wrap.cpp index fc267f4e0..946cc4c13 100644 --- a/renderdoc/driver/d3d11/d3d11_device1_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_device1_wrap.cpp @@ -298,3 +298,10 @@ HRESULT WrappedID3D11Device::OpenSharedResourceByName(LPCWSTR lpName, DWORD dwDe RDCUNIMPLEMENTED("Not wrapping OpenSharedResourceByName"); return m_pDevice1->OpenSharedResourceByName(lpName, dwDesiredAccess, returnedInterface, ppResource); } + +#undef IMPLEMENT_FUNCTION_SERIALISED +#define IMPLEMENT_FUNCTION_SERIALISED(ret, func, ...) \ + template bool WrappedID3D11Device::CONCAT(Serialise_, func(ReadSerialiser &ser, __VA_ARGS__)); \ + template bool WrappedID3D11Device::CONCAT(Serialise_, func(WriteSerialiser &ser, __VA_ARGS__)); + +SERIALISED_ID3D11DEVICE1_FUNCTIONS(); \ No newline at end of file diff --git a/renderdoc/driver/d3d11/d3d11_device3_wrap.cpp b/renderdoc/driver/d3d11/d3d11_device3_wrap.cpp index a286cc9f3..dec2eab7e 100644 --- a/renderdoc/driver/d3d11/d3d11_device3_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_device3_wrap.cpp @@ -872,4 +872,11 @@ void WrappedID3D11Device::UnregisterDeviceRemoved(DWORD dwCookie) return; return m_pDevice4->UnregisterDeviceRemoved(dwCookie); -} \ No newline at end of file +} + +#undef IMPLEMENT_FUNCTION_SERIALISED +#define IMPLEMENT_FUNCTION_SERIALISED(ret, func, ...) \ + template bool WrappedID3D11Device::CONCAT(Serialise_, func(ReadSerialiser &ser, __VA_ARGS__)); \ + template bool WrappedID3D11Device::CONCAT(Serialise_, func(WriteSerialiser &ser, __VA_ARGS__)); + +SERIALISED_ID3D11DEVICE3_FUNCTIONS(); \ No newline at end of file diff --git a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp index f13c62816..a96230f55 100644 --- a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp @@ -3013,3 +3013,11 @@ UINT WrappedID3D11Device::GetExceptionMode() { return m_pDevice->GetExceptionMode(); } + +#undef IMPLEMENT_FUNCTION_SERIALISED +#define IMPLEMENT_FUNCTION_SERIALISED(ret, func, ...) \ + template bool WrappedID3D11Device::CONCAT(Serialise_, func(ReadSerialiser &ser, __VA_ARGS__)); \ + template bool WrappedID3D11Device::CONCAT(Serialise_, func(WriteSerialiser &ser, __VA_ARGS__)); + +SERIALISED_ID3D11DEVICE_FUNCTIONS(); +SERIALISED_ID3D11DEVICE_FAKE_FUNCTIONS(); \ No newline at end of file diff --git a/renderdoc/driver/d3d11/d3d11_initstate.cpp b/renderdoc/driver/d3d11/d3d11_initstate.cpp index 6c25162ec..20bb41807 100644 --- a/renderdoc/driver/d3d11/d3d11_initstate.cpp +++ b/renderdoc/driver/d3d11/d3d11_initstate.cpp @@ -1283,3 +1283,8 @@ void WrappedID3D11Device::Apply_InitialState(ID3D11DeviceChild *live, } } } + +template bool WrappedID3D11Device::Serialise_InitialState(ReadSerialiser &ser, ResourceId resid, + ID3D11DeviceChild *res); +template bool WrappedID3D11Device::Serialise_InitialState(WriteSerialiser &ser, ResourceId resid, + ID3D11DeviceChild *res); \ No newline at end of file