diff --git a/src/d3d11/d3d11_buffer.cpp b/src/d3d11/d3d11_buffer.cpp index 40499b9ad..63bf7ce58 100644 --- a/src/d3d11/d3d11_buffer.cpp +++ b/src/d3d11/d3d11_buffer.cpp @@ -204,6 +204,10 @@ namespace dxvk { if (!pDesc->ByteWidth) return E_INVALIDARG; + // We don't support tiled resources + if (pDesc->MiscFlags & (D3D11_RESOURCE_MISC_TILE_POOL | D3D11_RESOURCE_MISC_TILED)) + return E_INVALIDARG; + // Basic validation for structured buffers if ((pDesc->MiscFlags & D3D11_RESOURCE_MISC_BUFFER_STRUCTURED) && ((pDesc->StructureByteStride == 0) diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index f77c0b53a..5f9bf43b5 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -1040,6 +1040,13 @@ namespace dxvk { return S_OK; } + HRESULT STDMETHODCALLTYPE D3D11Device::CreateDeferredContext2( + UINT ContextFlags, + ID3D11DeviceContext2** ppDeferredContext) { + *ppDeferredContext = ref(new D3D11DeferredContext(this, m_dxvkDevice, ContextFlags)); + return S_OK; + } + HRESULT STDMETHODCALLTYPE D3D11Device::CreateDeviceContextState( UINT Flags, const D3D_FEATURE_LEVEL* pFeatureLevels, @@ -1125,12 +1132,28 @@ namespace dxvk { DXGI_FORMAT Format, UINT SampleCount, UINT* pNumQualityLevels) { + return CheckMultisampleQualityLevels1(Format, SampleCount, 0, pNumQualityLevels); + } + + + HRESULT STDMETHODCALLTYPE D3D11Device::CheckMultisampleQualityLevels1( + DXGI_FORMAT Format, + UINT SampleCount, + UINT Flags, + UINT* pNumQualityLevels) { // There are many error conditions, so we'll just assume // that we will fail and return a non-zero value in case // the device does actually support the format. if (!pNumQualityLevels) return E_INVALIDARG; + // We don't support tiled resources, but it's unclear what + // we are supposed to return in this case. Be conservative. + if (Flags) { + *pNumQualityLevels = 0; + return E_FAIL; + } + // For some reason, we can query DXGI_FORMAT_UNKNOWN if (Format == DXGI_FORMAT_UNKNOWN) { *pNumQualityLevels = SampleCount == 1 ? 1 : 0; @@ -1167,8 +1190,8 @@ namespace dxvk { *pNumQualityLevels = 1; return S_OK; } - - + + void STDMETHODCALLTYPE D3D11Device::CheckCounterInfo(D3D11_COUNTER_INFO* pCounterInfo) { // We basically don't support counters pCounterInfo->LastDeviceDependentCounter = D3D11_COUNTER(0); @@ -1392,7 +1415,12 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11Device::GetImmediateContext1(ID3D11DeviceContext1 ** ppImmediateContext) { + void STDMETHODCALLTYPE D3D11Device::GetImmediateContext1(ID3D11DeviceContext1** ppImmediateContext) { + *ppImmediateContext = ref(m_context); + } + + + void STDMETHODCALLTYPE D3D11Device::GetImmediateContext2(ID3D11DeviceContext2** ppImmediateContext) { *ppImmediateContext = ref(m_context); } @@ -1407,6 +1435,21 @@ namespace dxvk { Logger::err("D3D11Device::GetExceptionMode: Not implemented"); return 0; } + + + void STDMETHODCALLTYPE D3D11Device::GetResourceTiling( + ID3D11Resource* pTiledResource, + UINT* pNumTilesForEntireResource, + D3D11_PACKED_MIP_DESC* pPackedMipDesc, + D3D11_TILE_SHAPE* pStandardTileShapeForNonPackedMips, + UINT* pNumSubresourceTilings, + UINT FirstSubresourceTilingToGet, + D3D11_SUBRESOURCE_TILING* pSubresourceTilingsForNonPackedMips) { + static bool s_errorShown = false; + + if (!std::exchange(s_errorShown, true)) + Logger::err("D3D11Device::GetResourceTiling: Not implemented"); + } DXGI_VK_FORMAT_INFO D3D11Device::LookupFormat( @@ -1995,7 +2038,8 @@ namespace dxvk { } if (riid == __uuidof(ID3D11Device) - || riid == __uuidof(ID3D11Device1)) { + || riid == __uuidof(ID3D11Device1) + || riid == __uuidof(ID3D11Device2)) { *ppvObject = ref(&m_d3d11Device); return S_OK; } diff --git a/src/d3d11/d3d11_device.h b/src/d3d11/d3d11_device.h index ab227696d..3c2a30c22 100644 --- a/src/d3d11/d3d11_device.h +++ b/src/d3d11/d3d11_device.h @@ -45,7 +45,7 @@ namespace dxvk { * Implements the ID3D11Device interfaces * as part of a \ref D3D11DeviceContainer. */ - class D3D11Device final : public ID3D11Device1 { + class D3D11Device final : public ID3D11Device2 { /// Maximum number of resource init commands per command buffer constexpr static uint64_t InitCommandThreshold = 50; public: @@ -206,6 +206,10 @@ namespace dxvk { UINT ContextFlags, ID3D11DeviceContext1** ppDeferredContext); + HRESULT STDMETHODCALLTYPE CreateDeferredContext2( + UINT ContextFlags, + ID3D11DeviceContext2** ppDeferredContext); + HRESULT STDMETHODCALLTYPE CreateDeviceContextState( UINT Flags, const D3D_FEATURE_LEVEL* pFeatureLevels, @@ -240,6 +244,12 @@ namespace dxvk { UINT SampleCount, UINT* pNumQualityLevels); + HRESULT STDMETHODCALLTYPE CheckMultisampleQualityLevels1( + DXGI_FORMAT Format, + UINT SampleCount, + UINT Flags, + UINT* pNumQualityLevels); + void STDMETHODCALLTYPE CheckCounterInfo( D3D11_COUNTER_INFO* pCounterInfo); @@ -285,10 +295,22 @@ namespace dxvk { void STDMETHODCALLTYPE GetImmediateContext1( ID3D11DeviceContext1** ppImmediateContext); + void STDMETHODCALLTYPE GetImmediateContext2( + ID3D11DeviceContext2** ppImmediateContext); + HRESULT STDMETHODCALLTYPE SetExceptionMode(UINT RaiseFlags); UINT STDMETHODCALLTYPE GetExceptionMode(); + void STDMETHODCALLTYPE GetResourceTiling( + ID3D11Resource* pTiledResource, + UINT* pNumTilesForEntireResource, + D3D11_PACKED_MIP_DESC* pPackedMipDesc, + D3D11_TILE_SHAPE* pStandardTileShapeForNonPackedMips, + UINT* pNumSubresourceTilings, + UINT FirstSubresourceTilingToGet, + D3D11_SUBRESOURCE_TILING* pSubresourceTilingsForNonPackedMips); + Rc GetDXVKDevice() { return m_dxvkDevice; } diff --git a/src/d3d11/d3d11_texture.cpp b/src/d3d11/d3d11_texture.cpp index 0e00d13a3..d640856e6 100644 --- a/src/d3d11/d3d11_texture.cpp +++ b/src/d3d11/d3d11_texture.cpp @@ -282,6 +282,10 @@ namespace dxvk { != (D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET)) return E_INVALIDARG; + // TILE_POOL is invalid, but we don't support TILED either + if (pDesc->MiscFlags & (D3D11_RESOURCE_MISC_TILE_POOL | D3D11_RESOURCE_MISC_TILED)) + return E_INVALIDARG; + // Use the maximum possible mip level count if the supplied // mip level count is either unspecified (0) or invalid const uint32_t maxMipLevelCount = pDesc->SampleDesc.Count <= 1