From c1a7243811985175c1e380c5a9251f74e311c5aa Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 15 Sep 2019 18:40:08 +0200 Subject: [PATCH] [d3d11] Implement ID3D11DeviceContext2 We don't support tiled resources nor markers for now. Marker support could be added through debug layers. --- src/d3d11/d3d11_context.cpp | 114 +++++++++++++++++++++++++++++++++++- src/d3d11/d3d11_context.h | 59 ++++++++++++++++++- 2 files changed, 168 insertions(+), 5 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index cef6210f9..294b98e92 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -54,7 +54,8 @@ namespace dxvk { if (riid == __uuidof(IUnknown) || riid == __uuidof(ID3D11DeviceChild) || riid == __uuidof(ID3D11DeviceContext) - || riid == __uuidof(ID3D11DeviceContext1)) { + || riid == __uuidof(ID3D11DeviceContext1) + || riid == __uuidof(ID3D11DeviceContext2)) { *ppvObject = ref(this); return S_OK; } @@ -710,8 +711,57 @@ namespace dxvk { sizeof(uint32_t)); }); } - - + + + void STDMETHODCALLTYPE D3D11DeviceContext::CopyTiles( + ID3D11Resource* pTiledResource, + const D3D11_TILED_RESOURCE_COORDINATE* pTileRegionStartCoordinate, + const D3D11_TILE_REGION_SIZE* pTileRegionSize, + ID3D11Buffer* pBuffer, + UINT64 BufferStartOffsetInBytes, + UINT Flags) { + static bool s_errorShown = false; + + if (!std::exchange(s_errorShown, true)) + Logger::err("D3D11DeviceContext::CopyTiles: Not implemented"); + } + + + HRESULT STDMETHODCALLTYPE D3D11DeviceContext::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) { + static bool s_errorShown = false; + + if (!std::exchange(s_errorShown, true)) + Logger::err("D3D11DeviceContext::CopyTileMappings: Not implemented"); + + return DXGI_ERROR_INVALID_CALL; + } + + + HRESULT STDMETHODCALLTYPE D3D11DeviceContext::ResizeTilePool( + ID3D11Buffer* pTilePool, + UINT64 NewSizeInBytes) { + static bool s_errorShown = false; + + if (!std::exchange(s_errorShown, true)) + Logger::err("D3D11DeviceContext::ResizeTilePool: Not implemented"); + + return DXGI_ERROR_INVALID_CALL; + } + + + void STDMETHODCALLTYPE D3D11DeviceContext::TiledResourceBarrier( + ID3D11DeviceChild* pTiledResourceOrViewAccessBeforeBarrier, + ID3D11DeviceChild* pTiledResourceOrViewAccessAfterBarrier) { + + } + + void STDMETHODCALLTYPE D3D11DeviceContext::ClearRenderTargetView( ID3D11RenderTargetView* pRenderTargetView, const FLOAT ColorRGBA[4]) { @@ -1250,6 +1300,39 @@ namespace dxvk { UpdateMappedBuffer(textureInfo, subresource); } } + + + HRESULT STDMETHODCALLTYPE D3D11DeviceContext::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) { + bool s_errorShown = false; + + if (std::exchange(s_errorShown, true)) + Logger::err("D3D11DeviceContext::UpdateTileMappings: Not implemented"); + + return DXGI_ERROR_INVALID_CALL; + } + + + void STDMETHODCALLTYPE D3D11DeviceContext::UpdateTiles( + ID3D11Resource* pDestTiledResource, + const D3D11_TILED_RESOURCE_COORDINATE* pDestTileRegionStartCoordinate, + const D3D11_TILE_REGION_SIZE* pDestTileRegionSize, + const void* pSourceTileData, + UINT Flags) { + bool s_errorShown = false; + + if (std::exchange(s_errorShown, true)) + Logger::err("D3D11DeviceContext::UpdateTiles: Not implemented"); + } void STDMETHODCALLTYPE D3D11DeviceContext::SetResourceMinLOD( @@ -3016,6 +3099,31 @@ namespace dxvk { } + BOOL STDMETHODCALLTYPE D3D11DeviceContext::IsAnnotationEnabled() { + // Not implemented in the backend + return FALSE; + } + + + void STDMETHODCALLTYPE D3D11DeviceContext::SetMarkerInt( + LPCWSTR pLabel, + INT Data) { + // Not implemented in the backend, ignore + } + + + void STDMETHODCALLTYPE D3D11DeviceContext::BeginEventInt( + LPCWSTR pLabel, + INT Data) { + // Not implemented in the backend, ignore + } + + + void STDMETHODCALLTYPE D3D11DeviceContext::EndEvent() { + // Not implemented in the backend, ignore + } + + void STDMETHODCALLTYPE D3D11DeviceContext::TransitionSurfaceLayout( IDXGIVkInteropSurface* pSurface, const VkImageSubresourceRange* pSubresources, diff --git a/src/d3d11/d3d11_context.h b/src/d3d11/d3d11_context.h index a9f4bdee8..a438c9e8b 100644 --- a/src/d3d11/d3d11_context.h +++ b/src/d3d11/d3d11_context.h @@ -17,7 +17,7 @@ namespace dxvk { class D3D11Device; - class D3D11DeviceContext : public D3D11DeviceChild { + class D3D11DeviceContext : public D3D11DeviceChild { friend class D3D11DeviceContextExt; public: @@ -85,7 +85,31 @@ namespace dxvk { ID3D11Buffer* pDstBuffer, UINT DstAlignedByteOffset, ID3D11UnorderedAccessView* pSrcView); + + void STDMETHODCALLTYPE CopyTiles( + ID3D11Resource* pTiledResource, + const D3D11_TILED_RESOURCE_COORDINATE* pTileRegionStartCoordinate, + const D3D11_TILE_REGION_SIZE* pTileRegionSize, + ID3D11Buffer* pBuffer, + UINT64 BufferStartOffsetInBytes, + UINT Flags); + 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); + + HRESULT STDMETHODCALLTYPE ResizeTilePool( + ID3D11Buffer* pTilePool, + UINT64 NewSizeInBytes); + + void STDMETHODCALLTYPE TiledResourceBarrier( + ID3D11DeviceChild* pTiledResourceOrViewAccessBeforeBarrier, + ID3D11DeviceChild* pTiledResourceOrViewAccessAfterBarrier); + void STDMETHODCALLTYPE ClearRenderTargetView( ID3D11RenderTargetView* pRenderTargetView, const FLOAT ColorRGBA[4]); @@ -129,7 +153,26 @@ namespace dxvk { UINT SrcRowPitch, UINT SrcDepthPitch, UINT CopyFlags); - + + 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); + + void STDMETHODCALLTYPE UpdateTiles( + ID3D11Resource* pDestTiledResource, + const D3D11_TILED_RESOURCE_COORDINATE* pDestTileRegionStartCoordinate, + const D3D11_TILE_REGION_SIZE* pDestTileRegionSize, + const void* pSourceTileData, + UINT Flags); + void STDMETHODCALLTYPE SetResourceMinLOD( ID3D11Resource* pResource, FLOAT MinLOD); @@ -637,6 +680,18 @@ namespace dxvk { ID3D11Buffer** ppSOTargets, UINT* pOffsets); + BOOL STDMETHODCALLTYPE IsAnnotationEnabled(); + + void STDMETHODCALLTYPE SetMarkerInt( + LPCWSTR pLabel, + INT Data); + + void STDMETHODCALLTYPE BeginEventInt( + LPCWSTR pLabel, + INT Data); + + void STDMETHODCALLTYPE EndEvent(); + void STDMETHODCALLTYPE TransitionSurfaceLayout( IDXGIVkInteropSurface* pSurface, const VkImageSubresourceRange* pSubresources,