1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-05 01:24:14 +01:00

[dxgi] Use new format support queries to initialize format table

This commit is contained in:
Philip Rebohle 2022-08-17 15:06:36 +02:00
parent 4aeb397ba3
commit 13152088d4
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 14 additions and 14 deletions

View File

@ -41,7 +41,7 @@ namespace dxvk {
m_featureFlags (FeatureFlags),
m_dxvkDevice (pContainer->GetDXVKDevice()),
m_dxvkAdapter (m_dxvkDevice->adapter()),
m_d3d11Formats (m_dxvkAdapter),
m_d3d11Formats (m_dxvkDevice),
m_d3d11Options (m_dxvkDevice->instance()->config(), m_dxvkDevice),
m_dxbcOptions (m_dxvkDevice, m_d3d11Options) {
m_initializer = new D3D11Initializer(this);

View File

@ -847,13 +847,13 @@ namespace dxvk {
}};
DXGIVkFormatTable::DXGIVkFormatTable(const Rc<DxvkAdapter>& adapter)
DXGIVkFormatTable::DXGIVkFormatTable(const Rc<DxvkDevice>& device)
: m_dxgiFormats (g_dxgiFormats), m_dxgiFamilies(g_dxgiFamilies) {
// AMD do not support 24-bit depth buffers on Vulkan,
// so we have to fall back to a 32-bit depth format.
if (!CheckImageFormatSupport(adapter, VK_FORMAT_D24_UNORM_S8_UINT,
VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) {
if (!CheckImageFormatSupport(device, VK_FORMAT_D24_UNORM_S8_UINT,
VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT)) {
Logger::info("DXGI: VK_FORMAT_D24_UNORM_S8_UINT -> VK_FORMAT_D32_SFLOAT_S8_UINT");
RemapDepthFormat(DXGI_FORMAT_R24G8_TYPELESS, VK_FORMAT_D32_SFLOAT_S8_UINT);
RemapDepthFormat(DXGI_FORMAT_R24_UNORM_X8_TYPELESS, VK_FORMAT_D32_SFLOAT_S8_UINT);
@ -943,13 +943,13 @@ namespace dxvk {
bool DXGIVkFormatTable::CheckImageFormatSupport(
const Rc<DxvkAdapter>& Adapter,
const Rc<DxvkDevice>& Device,
VkFormat Format,
VkFormatFeatureFlags Features) const {
VkFormatProperties supported = Adapter->formatProperties(Format);
VkFormatFeatureFlags2 Features) const {
DxvkFormatFeatures supported = Device->getFormatFeatures(Format);
return (supported.linearTilingFeatures & Features) == Features
|| (supported.optimalTilingFeatures & Features) == Features;
return (supported.linear & Features) == Features
|| (supported.optimal & Features) == Features;
}

View File

@ -2,7 +2,7 @@
#include "dxgi_include.h"
#include "../dxvk/dxvk_adapter.h"
#include "../dxvk/dxvk_device.h"
#include "../dxvk/dxvk_format.h"
namespace dxvk {
@ -100,7 +100,7 @@ namespace dxvk {
public:
DXGIVkFormatTable(
const Rc<DxvkAdapter>& adapter);
const Rc<DxvkDevice>& device);
~DXGIVkFormatTable();
/**
@ -155,9 +155,9 @@ namespace dxvk {
DXGI_FORMAT Format) const;
bool CheckImageFormatSupport(
const Rc<DxvkAdapter>& Adapter,
const Rc<DxvkDevice>& Device,
VkFormat Format,
VkFormatFeatureFlags Features) const;
VkFormatFeatureFlags2 Features) const;
void RemapDepthFormat(
DXGI_FORMAT Format,