1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[dxvk] Drop VK_EXT_4444_formats

These formats are core in Vulkan 1.3 and all relevant drivers support them.
This commit is contained in:
Philip Rebohle 2022-07-14 21:13:06 +02:00
parent f60bdcbcbf
commit d6d7d5137b
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
8 changed files with 10 additions and 57 deletions

View File

@ -39,7 +39,7 @@ namespace dxvk {
VK_IMAGE_ASPECT_COLOR_BIT };
case D3D9Format::A4R4G4B4: return {
VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT,
VK_FORMAT_A4R4G4B4_UNORM_PACK16,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT };
@ -55,7 +55,7 @@ namespace dxvk {
case D3D9Format::A8R3G3B2: return {}; // Unsupported
case D3D9Format::X4R4G4B4: return {
VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT,
VK_FORMAT_A4R4G4B4_UNORM_PACK16,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT };
@ -445,9 +445,6 @@ namespace dxvk {
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT);
// VK_EXT_4444_formats
m_a4r4g4b4Support = CheckImageFormatSupport(adapter, VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT);
if (!m_d24s8Support)
Logger::info("D3D9: VK_FORMAT_D24_UNORM_S8_UINT -> VK_FORMAT_D32_SFLOAT_S8_UINT");
@ -457,9 +454,6 @@ namespace dxvk {
else
Logger::info("D3D9: VK_FORMAT_D16_UNORM_S8_UINT -> VK_FORMAT_D32_SFLOAT_S8_UINT");
}
if (!m_a4r4g4b4Support)
Logger::warn("D3D9: VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT -> VK_FORMAT_B4G4R4A4_UNORM_PACK16");
}
D3D9_VK_FORMAT_MAPPING D3D9VkFormatTable::GetFormatMapping(
@ -484,17 +478,6 @@ namespace dxvk {
if (!m_d16s8Support && mapping.FormatColor == VK_FORMAT_D16_UNORM_S8_UINT)
mapping.FormatColor = m_d24s8Support ? VK_FORMAT_D24_UNORM_S8_UINT : VK_FORMAT_D32_SFLOAT_S8_UINT;
if (!m_a4r4g4b4Support && mapping.FormatColor == VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT) {
VkComponentSwizzle alphaSwizzle = Format == D3D9Format::A4R4G4B4
? VK_COMPONENT_SWIZZLE_B
: VK_COMPONENT_SWIZZLE_ONE;
mapping.FormatColor = VK_FORMAT_B4G4R4A4_UNORM_PACK16;
mapping.Swizzle = {
VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_R,
VK_COMPONENT_SWIZZLE_A, alphaSwizzle };
}
return mapping;
}

View File

@ -211,7 +211,6 @@ namespace dxvk {
VkFormat Format,
VkFormatFeatureFlags Features) const;
bool m_a4r4g4b4Support;
bool m_d24s8Support;
bool m_d16s8Support;

View File

@ -529,7 +529,7 @@ namespace dxvk {
// DXGI_FORMAT_A8P8
{ }, // Unsupported
// DXGI_FORMAT_B4G4R4A4_UNORM
{ VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT,
{ VK_FORMAT_A4R4G4B4_UNORM_PACK16,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
@ -860,12 +860,6 @@ namespace dxvk {
RemapDepthFormat(DXGI_FORMAT_X24_TYPELESS_G8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT);
RemapDepthFormat(DXGI_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT);
}
if (!adapter->features().ext4444Formats.formatA4R4G4B4) {
RemapColorFormat(DXGI_FORMAT_B4G4R4A4_UNORM, VK_FORMAT_B4G4R4A4_UNORM_PACK16,
{ VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_R,
VK_COMPONENT_SWIZZLE_A, VK_COMPONENT_SWIZZLE_B });
}
}

View File

@ -248,10 +248,6 @@ namespace dxvk {
|| !required.vk13.dynamicRendering)
&& (m_deviceFeatures.vk13.maintenance4
|| !required.vk13.maintenance4)
&& (m_deviceFeatures.ext4444Formats.formatA4R4G4B4
|| !required.ext4444Formats.formatA4R4G4B4)
&& (m_deviceFeatures.ext4444Formats.formatA4B4G4R4
|| !required.ext4444Formats.formatA4B4G4R4)
&& (m_deviceFeatures.extCustomBorderColor.customBorderColors
|| !required.extCustomBorderColor.customBorderColors)
&& (m_deviceFeatures.extCustomBorderColor.customBorderColorWithoutFormat
@ -291,10 +287,9 @@ namespace dxvk {
DxvkDeviceFeatures enabledFeatures) {
DxvkDeviceExtensions devExtensions;
std::array<DxvkExt*, 21> devExtensionList = {{
std::array<DxvkExt*, 20> devExtensionList = {{
&devExtensions.amdMemoryOverallocationBehaviour,
&devExtensions.amdShaderFragmentMask,
&devExtensions.ext4444Formats,
&devExtensions.extConservativeRasterization,
&devExtensions.extCustomBorderColor,
&devExtensions.extDepthClipEnable,
@ -356,9 +351,6 @@ namespace dxvk {
enabledFeatures.extGraphicsPipelineLibrary.graphicsPipelineLibrary =
m_deviceFeatures.extGraphicsPipelineLibrary.graphicsPipelineLibrary;
enabledFeatures.ext4444Formats.formatA4B4G4R4 = m_deviceFeatures.ext4444Formats.formatA4B4G4R4;
enabledFeatures.ext4444Formats.formatA4R4G4B4 = m_deviceFeatures.ext4444Formats.formatA4R4G4B4;
enabledFeatures.extRobustness2.robustBufferAccess2 = VK_TRUE;
enabledFeatures.extRobustness2.robustImageAccess2 = m_deviceFeatures.extRobustness2.robustImageAccess2;
enabledFeatures.extRobustness2.nullDescriptor = VK_TRUE;
@ -390,11 +382,6 @@ namespace dxvk {
enabledFeatures.vk13.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES;
enabledFeatures.vk13.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.vk13);
if (devExtensions.ext4444Formats) {
enabledFeatures.ext4444Formats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT;
enabledFeatures.ext4444Formats.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.ext4444Formats);
}
if (devExtensions.extCustomBorderColor) {
enabledFeatures.extCustomBorderColor.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT;
enabledFeatures.extCustomBorderColor.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.extCustomBorderColor);
@ -680,11 +667,6 @@ namespace dxvk {
m_deviceFeatures.vk13.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES;
m_deviceFeatures.vk13.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.vk13);
if (m_deviceExtensions.supports(VK_EXT_4444_FORMATS_EXTENSION_NAME)) {
m_deviceFeatures.ext4444Formats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT;
m_deviceFeatures.ext4444Formats.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.ext4444Formats);
}
if (m_deviceExtensions.supports(VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME)) {
m_deviceFeatures.extCustomBorderColor.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT;
m_deviceFeatures.extCustomBorderColor.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extCustomBorderColor);
@ -813,9 +795,6 @@ namespace dxvk {
"\n synchronization2 : ", features.vk13.synchronization2,
"\n dynamicRendering : ", features.vk13.dynamicRendering,
"\n maintenance4 : ", features.vk13.maintenance4,
"\n", VK_EXT_4444_FORMATS_EXTENSION_NAME,
"\n formatA4R4G4B4 : ", features.ext4444Formats.formatA4R4G4B4 ? "1" : "0",
"\n formatA4B4G4R4 : ", features.ext4444Formats.formatA4B4G4R4 ? "1" : "0",
"\n", VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME,
"\n customBorderColors : ", features.extCustomBorderColor.customBorderColors ? "1" : "0",
"\n customBorderColorWithoutFormat : ", features.extCustomBorderColor.customBorderColorWithoutFormat ? "1" : "0",

View File

@ -38,7 +38,6 @@ namespace dxvk {
VkPhysicalDeviceVulkan11Features vk11;
VkPhysicalDeviceVulkan12Features vk12;
VkPhysicalDeviceVulkan13Features vk13;
VkPhysicalDevice4444FormatsFeaturesEXT ext4444Formats;
VkPhysicalDeviceCustomBorderColorFeaturesEXT extCustomBorderColor;
VkPhysicalDeviceDepthClipEnableFeaturesEXT extDepthClipEnable;
VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT extGraphicsPipelineLibrary;

View File

@ -278,7 +278,6 @@ namespace dxvk {
struct DxvkDeviceExtensions {
DxvkExt amdMemoryOverallocationBehaviour = { VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt amdShaderFragmentMask = { VK_AMD_SHADER_FRAGMENT_MASK_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt ext4444Formats = { VK_EXT_4444_FORMATS_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt extConservativeRasterization = { VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt extCustomBorderColor = { VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME, DxvkExtMode::Optional };
DxvkExt extDepthClipEnable = { VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME, DxvkExtMode::Optional };

View File

@ -550,10 +550,10 @@ namespace dxvk {
DxvkFormatFlag::BlockCompressed,
VkExtent3D { 2, 1, 1 } },
// VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT
// VK_FORMAT_A4R4G4B4_UNORM_PACK16
{ 2, RGBA, VK_IMAGE_ASPECT_COLOR_BIT },
// VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT
// VK_FORMAT_A4B4G4R4_UNORM_PACK16
{ 2, RGBA, VK_IMAGE_ASPECT_COLOR_BIT },
// VK_FORMAT_G8_B8R8_2PLANE_420_UNORM
@ -567,7 +567,7 @@ namespace dxvk {
const std::array<std::pair<VkFormat, VkFormat>, 4> g_formatGroups = {{
{ VK_FORMAT_UNDEFINED, VK_FORMAT_BC7_SRGB_BLOCK },
{ VK_FORMAT_G8B8G8R8_422_UNORM_KHR, VK_FORMAT_B8G8R8G8_422_UNORM_KHR },
{ VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT, VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT },
{ VK_FORMAT_A4R4G4B4_UNORM_PACK16, VK_FORMAT_A4B4G4R4_UNORM_PACK16 },
{ VK_FORMAT_G8_B8R8_2PLANE_420_UNORM, VK_FORMAT_G8_B8R8_2PLANE_420_UNORM },
}};

View File

@ -507,8 +507,8 @@ namespace dxvk {
static uint64_t encodeColorFormat(VkFormat format, uint32_t index) {
uint64_t value = uint64_t(format);
if (value >= uint64_t(VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT)) {
value -= uint64_t(VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT);
if (value >= uint64_t(VK_FORMAT_A4R4G4B4_UNORM_PACK16)) {
value -= uint64_t(VK_FORMAT_A4R4G4B4_UNORM_PACK16);
value += uint64_t(VK_FORMAT_E5B9G9R9_UFLOAT_PACK32) + 1;
} else if (value > uint64_t(VK_FORMAT_E5B9G9R9_UFLOAT_PACK32)) {
value = 0;
@ -534,7 +534,7 @@ namespace dxvk {
if (value > uint64_t(VK_FORMAT_E5B9G9R9_UFLOAT_PACK32)) {
value -= uint64_t(VK_FORMAT_E5B9G9R9_UFLOAT_PACK32) + 1ull;
value += uint64_t(VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT);
value += uint64_t(VK_FORMAT_A4R4G4B4_UNORM_PACK16);
}
return VkFormat(value);