From 2844d4bad7587448ead4ff98e99b67c3a2c61b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gu=C3=A9rin?= Date: Sat, 13 Jan 2018 18:52:07 -0800 Subject: [PATCH 1/4] [d3d11] don't fail when creating unsupported queries just keep going, and fail when trying to use them. this lets ManiaPlanet boot. --- src/d3d11/d3d11_device.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index f1a36d6d..2a1bc686 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -1066,8 +1066,7 @@ namespace dxvk { // Other query types are currently unsupported if (pQueryDesc->Query != D3D11_QUERY_OCCLUSION && pQueryDesc->Query != D3D11_QUERY_OCCLUSION_PREDICATE) { - Logger::err(str::format("D3D11Device: Unsupported query type: ", pQueryDesc->Query)); - return E_INVALIDARG; + Logger::warn(str::format("D3D11Device: Unsupported query type: ", pQueryDesc->Query)); } if (ppQuery == nullptr) From fc43b836239257704fef1bbae79421abc7c2b820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gu=C3=A9rin?= Date: Sat, 13 Jan 2018 23:35:33 -0800 Subject: [PATCH 2/4] [d3d11] move supported query check to d3d11_query it's better to have everything in one place. --- src/d3d11/d3d11_device.cpp | 8 +------- src/d3d11/d3d11_query.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index 2a1bc686..38ffbc31 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -1063,15 +1063,9 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE D3D11Device::CreateQuery( const D3D11_QUERY_DESC* pQueryDesc, ID3D11Query** ppQuery) { - // Other query types are currently unsupported - if (pQueryDesc->Query != D3D11_QUERY_OCCLUSION - && pQueryDesc->Query != D3D11_QUERY_OCCLUSION_PREDICATE) { - Logger::warn(str::format("D3D11Device: Unsupported query type: ", pQueryDesc->Query)); - } - if (ppQuery == nullptr) return S_FALSE; - + try { *ppQuery = ref(new D3D11Query(this, *pQueryDesc)); return S_OK; diff --git a/src/d3d11/d3d11_query.cpp b/src/d3d11/d3d11_query.cpp index 41139406..c7e53e7d 100644 --- a/src/d3d11/d3d11_query.cpp +++ b/src/d3d11/d3d11_query.cpp @@ -7,7 +7,15 @@ namespace dxvk { D3D11Device* device, const D3D11_QUERY_DESC& desc) : m_device(device), m_desc(desc) { - Logger::warn("D3D11Query: Stub"); + switch (desc.Query) { + // Other query types are currently unsupported + case D3D11_QUERY_OCCLUSION: + case D3D11_QUERY_OCCLUSION_PREDICATE: + break; + + default: + Logger::warn(str::format("D3D11Query: Unsupported query type ", desc.Query)); + } } From 482147d92973c73a7a17c6dee631b4b6ef87950a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gu=C3=A9rin?= Date: Sun, 14 Jan 2018 01:39:59 -0800 Subject: [PATCH 3/4] [d3d11] support textures in CopyResource fixes green textures and log spam with TrackMania --- src/d3d11/d3d11_context.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 6f1e8488..0386d43e 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -488,7 +488,26 @@ namespace dxvk { srcBuffer.offset(), srcBuffer.length()); } else { - Logger::err("D3D11DeviceContext::CopyResource: Images not supported"); + const D3D11TextureInfo* dstTextureInfo = GetCommonTextureInfo(pDstResource); + const D3D11TextureInfo* srcTextureInfo = GetCommonTextureInfo(pSrcResource); + + VkExtent3D extent = srcTextureInfo->image->mipLevelExtent( + dstTextureInfo->mappedSubresource.mipLevel); + + const VkImageSubresourceLayers dstLayers = { + dstTextureInfo->mappedSubresource.aspectMask, + dstTextureInfo->mappedSubresource.mipLevel, + dstTextureInfo->mappedSubresource.arrayLayer, 1 }; + + const VkImageSubresourceLayers srcLayers = { + srcTextureInfo->mappedSubresource.aspectMask, + srcTextureInfo->mappedSubresource.mipLevel, + srcTextureInfo->mappedSubresource.arrayLayer, 1 }; + + m_context->copyImage( + dstTextureInfo->image, dstLayers, VkOffset3D { 0, 0, 0 }, + srcTextureInfo->image, srcLayers, VkOffset3D { 0, 0, 0 }, + extent); } } From 340438954dcf627cc5ac7e520ff055ecab86995b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gu=C3=A9rin?= Date: Sun, 14 Jan 2018 12:17:51 -0800 Subject: [PATCH 4/4] [d3d11] copy all layers and mipmaps in CopyResource avoid using potentially undefined mappedSubresource --- src/d3d11/d3d11_context.cpp | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 0386d43e..d1d04160 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -491,34 +491,36 @@ namespace dxvk { const D3D11TextureInfo* dstTextureInfo = GetCommonTextureInfo(pDstResource); const D3D11TextureInfo* srcTextureInfo = GetCommonTextureInfo(pSrcResource); - VkExtent3D extent = srcTextureInfo->image->mipLevelExtent( - dstTextureInfo->mappedSubresource.mipLevel); + const DxvkFormatInfo* dstFormatInfo = imageFormatInfo(dstTextureInfo->image->info().format); + const DxvkFormatInfo* srcFormatInfo = imageFormatInfo(srcTextureInfo->image->info().format); - const VkImageSubresourceLayers dstLayers = { - dstTextureInfo->mappedSubresource.aspectMask, - dstTextureInfo->mappedSubresource.mipLevel, - dstTextureInfo->mappedSubresource.arrayLayer, 1 }; + for (uint32_t i = 0; i < srcTextureInfo->image->info().mipLevels; i++) { + VkExtent3D extent = srcTextureInfo->image->mipLevelExtent(i); - const VkImageSubresourceLayers srcLayers = { - srcTextureInfo->mappedSubresource.aspectMask, - srcTextureInfo->mappedSubresource.mipLevel, - srcTextureInfo->mappedSubresource.arrayLayer, 1 }; + const VkImageSubresourceLayers dstLayers = { + dstFormatInfo->aspectMask & srcFormatInfo->aspectMask, + i, 0, dstTextureInfo->image->info().numLayers }; - m_context->copyImage( - dstTextureInfo->image, dstLayers, VkOffset3D { 0, 0, 0 }, - srcTextureInfo->image, srcLayers, VkOffset3D { 0, 0, 0 }, - extent); + const VkImageSubresourceLayers srcLayers = { + dstFormatInfo->aspectMask & srcFormatInfo->aspectMask, + i, 0, srcTextureInfo->image->info().numLayers }; + + m_context->copyImage( + dstTextureInfo->image, dstLayers, VkOffset3D { 0, 0, 0 }, + srcTextureInfo->image, srcLayers, VkOffset3D { 0, 0, 0 }, + extent); + } } } - - + + void STDMETHODCALLTYPE D3D11DeviceContext::CopyStructureCount( ID3D11Buffer* pDstBuffer, UINT DstAlignedByteOffset, ID3D11UnorderedAccessView* pSrcView) { auto buf = static_cast(pDstBuffer); auto uav = static_cast(pSrcView); - + const DxvkBufferSlice dstSlice = buf->GetBufferSlice(DstAlignedByteOffset); const DxvkBufferSlice srcSlice = uav->GetCounterSlice();