diff --git a/src/d3d9/d3d9_adapter.cpp b/src/d3d9/d3d9_adapter.cpp index 7ca05fff..c8e813c8 100644 --- a/src/d3d9/d3d9_adapter.cpp +++ b/src/d3d9/d3d9_adapter.cpp @@ -717,32 +717,32 @@ namespace dxvk { VkFormat Format, DWORD Usage, D3DRESOURCETYPE RType) { - VkFormatFeatureFlags checkFlags = 0; + VkFormatFeatureFlags2 checkFlags = 0; if (RType != D3DRTYPE_SURFACE) - checkFlags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; + checkFlags |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT; if (Usage & D3DUSAGE_RENDERTARGET) { - checkFlags |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; + checkFlags |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT; if (Usage & D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) - checkFlags |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT; + checkFlags |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT; } if (Usage & D3DUSAGE_DEPTHSTENCIL) - checkFlags |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; + checkFlags |= VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT; else - checkFlags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; + checkFlags |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT; - VkFormatFeatureFlags checkFlagsMipGen = checkFlags; + VkFormatFeatureFlags2 checkFlagsMipGen = checkFlags; if (Usage & D3DUSAGE_AUTOGENMIPMAP) { - checkFlagsMipGen |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; - checkFlagsMipGen |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; + checkFlagsMipGen |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT; + checkFlagsMipGen |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT; } - VkFormatProperties fmtSupport = m_adapter->formatProperties(Format); - VkFormatFeatureFlags imgFeatures = fmtSupport.optimalTilingFeatures | fmtSupport.linearTilingFeatures; + DxvkFormatFeatures fmtSupport = m_adapter->getFormatFeatures(Format); + VkFormatFeatureFlags2 imgFeatures = fmtSupport.optimal | fmtSupport.linear; if ((imgFeatures & checkFlags) != checkFlags) return D3DERR_NOTAVAILABLE; diff --git a/src/d3d9/d3d9_common_texture.cpp b/src/d3d9/d3d9_common_texture.cpp index 55b7182d..e1d675b9 100644 --- a/src/d3d9/d3d9_common_texture.cpp +++ b/src/d3d9/d3d9_common_texture.cpp @@ -379,53 +379,49 @@ namespace dxvk { BOOL D3D9CommonTexture::CheckImageSupport( const DxvkImageCreateInfo* pImageInfo, VkImageTiling Tiling) const { - const Rc adapter = m_device->GetDXVKDevice()->adapter(); - - VkImageFormatProperties formatProps = { }; - - VkResult status = adapter->imageFormatProperties( + auto properties = m_device->GetDXVKDevice()->getFormatLimits( pImageInfo->format, pImageInfo->type, Tiling, - pImageInfo->usage, pImageInfo->flags, formatProps); + pImageInfo->usage, pImageInfo->flags); - if (status != VK_SUCCESS) + if (!properties) return FALSE; - return (pImageInfo->extent.width <= formatProps.maxExtent.width) - && (pImageInfo->extent.height <= formatProps.maxExtent.height) - && (pImageInfo->extent.depth <= formatProps.maxExtent.depth) - && (pImageInfo->numLayers <= formatProps.maxArrayLayers) - && (pImageInfo->mipLevels <= formatProps.maxMipLevels) - && (pImageInfo->sampleCount & formatProps.sampleCounts); + return (pImageInfo->extent.width <= properties->maxExtent.width) + && (pImageInfo->extent.height <= properties->maxExtent.height) + && (pImageInfo->extent.depth <= properties->maxExtent.depth) + && (pImageInfo->numLayers <= properties->maxArrayLayers) + && (pImageInfo->mipLevels <= properties->maxMipLevels) + && (pImageInfo->sampleCount & properties->sampleCounts); } VkImageUsageFlags D3D9CommonTexture::EnableMetaCopyUsage( VkFormat Format, VkImageTiling Tiling) const { - VkFormatFeatureFlags requestedFeatures = 0; + VkFormatFeatureFlags2 requestedFeatures = 0; if (Format == VK_FORMAT_D16_UNORM || Format == VK_FORMAT_D32_SFLOAT) - requestedFeatures |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; + requestedFeatures |= VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT; if (Format == VK_FORMAT_R16_UNORM || Format == VK_FORMAT_R32_SFLOAT) - requestedFeatures |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; + requestedFeatures |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT; - if (requestedFeatures == 0) + if (!requestedFeatures) return 0; // Enable usage flags for all supported and requested features - VkFormatProperties properties = m_device->GetDXVKDevice()->adapter()->formatProperties(Format); + DxvkFormatFeatures properties = m_device->GetDXVKDevice()->getFormatFeatures(Format); requestedFeatures &= Tiling == VK_IMAGE_TILING_OPTIMAL - ? properties.optimalTilingFeatures - : properties.linearTilingFeatures; + ? properties.optimal + : properties.linear; VkImageUsageFlags requestedUsage = 0; - if (requestedFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) + if (requestedFeatures & VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT) requestedUsage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; - if (requestedFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) + if (requestedFeatures & VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT) requestedUsage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; return requestedUsage; diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 63c92dd6..69064448 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -3903,7 +3903,6 @@ namespace dxvk { enabled.core.features.vertexPipelineStoresAndAtomics = supported.core.features.vertexPipelineStoresAndAtomics; // DXVK Meta - enabled.core.features.shaderStorageImageWriteWithoutFormat = VK_TRUE; enabled.core.features.imageCubeArray = VK_TRUE; // SM1 level hardware diff --git a/src/d3d9/d3d9_format.cpp b/src/d3d9/d3d9_format.cpp index 28da3158..089d9b1c 100644 --- a/src/d3d9/d3d9_format.cpp +++ b/src/d3d9/d3d9_format.cpp @@ -435,14 +435,14 @@ namespace dxvk { // AMD do not support 24-bit depth buffers on Vulkan, // so we have to fall back to a 32-bit depth format. m_d24s8Support = CheckImageFormatSupport(adapter, VK_FORMAT_D24_UNORM_S8_UINT, - VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT | - VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT); + VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT | + VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT); // NVIDIA do not support 16-bit depth buffers with stencil on Vulkan, // so we have to fall back to a 32-bit depth format. m_d16s8Support = CheckImageFormatSupport(adapter, VK_FORMAT_D16_UNORM_S8_UINT, - VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT | - VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT); + VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT | + VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT); // VK_EXT_4444_formats if (!m_d24s8Support) @@ -538,11 +538,11 @@ namespace dxvk { bool D3D9VkFormatTable::CheckImageFormatSupport( const Rc& Adapter, VkFormat Format, - VkFormatFeatureFlags Features) const { - VkFormatProperties supported = Adapter->formatProperties(Format); + VkFormatFeatureFlags2 Features) const { + DxvkFormatFeatures supported = Adapter->getFormatFeatures(Format); - return (supported.linearTilingFeatures & Features) == Features - || (supported.optimalTilingFeatures & Features) == Features; + return (supported.linear & Features) == Features + || (supported.optimal & Features) == Features; } } \ No newline at end of file diff --git a/src/d3d9/d3d9_format.h b/src/d3d9/d3d9_format.h index 1b9f72a7..1bdb4fb0 100644 --- a/src/d3d9/d3d9_format.h +++ b/src/d3d9/d3d9_format.h @@ -209,7 +209,7 @@ namespace dxvk { bool CheckImageFormatSupport( const Rc& Adapter, VkFormat Format, - VkFormatFeatureFlags Features) const; + VkFormatFeatureFlags2 Features) const; bool m_d24s8Support; bool m_d16s8Support; diff --git a/src/d3d9/d3d9_util.cpp b/src/d3d9/d3d9_util.cpp index b5d24f44..d740313e 100644 --- a/src/d3d9/d3d9_util.cpp +++ b/src/d3d9/d3d9_util.cpp @@ -97,14 +97,14 @@ namespace dxvk { } - VkFormatFeatureFlags GetImageFormatFeatures(DWORD Usage) { - VkFormatFeatureFlags features = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; + VkFormatFeatureFlags2 GetImageFormatFeatures(DWORD Usage) { + VkFormatFeatureFlags2 features = VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT; if (Usage & D3DUSAGE_DEPTHSTENCIL) - features |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; + features |= VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT; if (Usage & D3DUSAGE_RENDERTARGET) - features |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; + features |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT; return features; } diff --git a/src/d3d9/d3d9_util.h b/src/d3d9/d3d9_util.h index bbde19ad..ab564f90 100644 --- a/src/d3d9/d3d9_util.h +++ b/src/d3d9/d3d9_util.h @@ -102,7 +102,7 @@ namespace dxvk { VkFormat GetPackedDepthStencilFormat(D3D9Format Format); - VkFormatFeatureFlags GetImageFormatFeatures(DWORD Usage); + VkFormatFeatureFlags2 GetImageFormatFeatures(DWORD Usage); VkImageUsageFlags GetImageUsageFlags(DWORD Usage);