[d3d11] Implement ResizeTilePool

This commit is contained in:
Philip Rebohle 2022-08-20 22:25:02 +02:00
parent e8f59bfd7c
commit 5130638ebe
2 changed files with 20 additions and 4 deletions

View File

@ -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;
}

View File

@ -2656,12 +2656,24 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE D3D11CommonContext<ContextType>::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<D3D11Buffer*>(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;
}