diff --git a/src/d3d11/d3d11_buffer.h b/src/d3d11/d3d11_buffer.h index 5c9c0645b..b3420dc21 100644 --- a/src/d3d11/d3d11_buffer.h +++ b/src/d3d11/d3d11_buffer.h @@ -66,6 +66,10 @@ namespace dxvk { return &m_desc; } + BOOL IsTilePool() const { + return bool(m_desc.MiscFlags & D3D11_RESOURCE_MISC_TILE_POOL); + } + D3D11_COMMON_BUFFER_MAP_MODE GetMapMode() const { return m_mapMode; } diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 414a9117a..b8549475a 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -2656,12 +2656,24 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE D3D11CommonContext::ResizeTilePool( ID3D11Buffer* pTilePool, UINT64 NewSizeInBytes) { - static bool s_errorShown = false; + if (NewSizeInBytes % SparseMemoryPageSize) + return E_INVALIDARG; - if (!std::exchange(s_errorShown, true)) - Logger::err("D3D11DeviceContext::ResizeTilePool: Not implemented"); + auto buffer = static_cast(pTilePool); - return DXGI_ERROR_INVALID_CALL; + if (!buffer->IsTilePool()) + return E_INVALIDARG; + + // Perform the resize operation. This is somewhat trivialized + // since all lifetime tracking is done by the backend. + EmitCs([ + cAllocator = buffer->GetSparseAllocator(), + cPageCount = NewSizeInBytes / SparseMemoryPageSize + ] (DxvkContext* ctx) { + cAllocator->setCapacity(cPageCount); + }); + + return S_OK; }