1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-30 22:24:15 +01:00

[dxgi] Added typeless format flag

This commit is contained in:
Philip Rebohle 2018-01-28 18:06:08 +01:00
parent 8a3dcf7c99
commit 3144a57ade
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 143 additions and 112 deletions

View File

@ -173,7 +173,7 @@ namespace dxvk {
}
void DxgiAdapter::AddColorFormat(
void DxgiAdapter::AddColorFormatTypeless(
DXGI_FORMAT srcFormat,
VkFormat dstFormat) {
DxgiFormatInfo formatPair;
@ -183,8 +183,8 @@ namespace dxvk {
VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY,
};
VK_COMPONENT_SWIZZLE_IDENTITY };
formatPair.flags = DxgiFormatFlag::Typeless;
m_colorFormats.insert(std::make_pair(srcFormat, formatPair));
}
@ -197,10 +197,27 @@ namespace dxvk {
formatPair.format = dstFormat;
formatPair.aspect = VK_IMAGE_ASPECT_COLOR_BIT;
formatPair.swizzle = swizzle;
formatPair.flags = DxgiFormatFlags();
m_colorFormats.insert(std::make_pair(srcFormat, formatPair));
}
void DxgiAdapter::AddDepthFormatTypeless(
DXGI_FORMAT srcFormat,
VkFormat dstFormat) {
DxgiFormatInfo formatPair;
formatPair.format = dstFormat;
formatPair.aspect = 0;
formatPair.swizzle = {
VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY };
formatPair.flags = DxgiFormatFlag::Typeless;
m_depthFormats.insert(std::make_pair(srcFormat, formatPair));
}
void DxgiAdapter::AddDepthFormat(
DXGI_FORMAT srcFormat,
VkFormat dstFormat,
@ -212,8 +229,8 @@ namespace dxvk {
VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY,
};
VK_COMPONENT_SWIZZLE_IDENTITY };
formatPair.flags = DxgiFormatFlags();
m_depthFormats.insert(std::make_pair(srcFormat, formatPair));
}
@ -221,99 +238,97 @@ namespace dxvk {
void DxgiAdapter::SetupFormatTable() {
/***********************************************************************************/
/* C O L O R F O R M A T S */
AddColorFormat(DXGI_FORMAT_UNKNOWN, VK_FORMAT_UNDEFINED);
AddColorFormat (DXGI_FORMAT_UNKNOWN, VK_FORMAT_UNDEFINED);
AddColorFormat(DXGI_FORMAT_R32G32B32A32_TYPELESS, VK_FORMAT_R32G32B32A32_UINT);
AddColorFormat(DXGI_FORMAT_R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT);
AddColorFormat(DXGI_FORMAT_R32G32B32A32_UINT, VK_FORMAT_R32G32B32A32_UINT);
AddColorFormat(DXGI_FORMAT_R32G32B32A32_SINT, VK_FORMAT_R32G32B32A32_SINT);
AddColorFormatTypeless(DXGI_FORMAT_R32G32B32A32_TYPELESS, VK_FORMAT_R32G32B32A32_UINT);
AddColorFormat (DXGI_FORMAT_R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT);
AddColorFormat (DXGI_FORMAT_R32G32B32A32_UINT, VK_FORMAT_R32G32B32A32_UINT);
AddColorFormat (DXGI_FORMAT_R32G32B32A32_SINT, VK_FORMAT_R32G32B32A32_SINT);
AddColorFormat(DXGI_FORMAT_R32G32B32_TYPELESS, VK_FORMAT_R32G32B32_UINT);
AddColorFormat(DXGI_FORMAT_R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT);
AddColorFormat(DXGI_FORMAT_R32G32B32_UINT, VK_FORMAT_R32G32B32_UINT);
AddColorFormat(DXGI_FORMAT_R32G32B32_SINT, VK_FORMAT_R32G32B32_SINT);
AddColorFormatTypeless(DXGI_FORMAT_R32G32B32_TYPELESS, VK_FORMAT_R32G32B32_UINT);
AddColorFormat (DXGI_FORMAT_R32G32B32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT);
AddColorFormat (DXGI_FORMAT_R32G32B32_UINT, VK_FORMAT_R32G32B32_UINT);
AddColorFormat (DXGI_FORMAT_R32G32B32_SINT, VK_FORMAT_R32G32B32_SINT);
AddColorFormat(DXGI_FORMAT_R16G16B16A16_TYPELESS, VK_FORMAT_R16G16B16A16_UINT);
AddColorFormat(DXGI_FORMAT_R16G16B16A16_FLOAT, VK_FORMAT_R16G16B16A16_SFLOAT);
AddColorFormat(DXGI_FORMAT_R16G16B16A16_UNORM, VK_FORMAT_R16G16B16A16_UNORM);
AddColorFormat(DXGI_FORMAT_R16G16B16A16_UINT, VK_FORMAT_R16G16B16A16_UINT);
AddColorFormat(DXGI_FORMAT_R16G16B16A16_SNORM, VK_FORMAT_R16G16B16A16_SNORM);
AddColorFormat(DXGI_FORMAT_R16G16B16A16_SINT, VK_FORMAT_R16G16B16A16_SINT);
AddColorFormatTypeless(DXGI_FORMAT_R16G16B16A16_TYPELESS, VK_FORMAT_R16G16B16A16_UINT);
AddColorFormat (DXGI_FORMAT_R16G16B16A16_FLOAT, VK_FORMAT_R16G16B16A16_SFLOAT);
AddColorFormat (DXGI_FORMAT_R16G16B16A16_UNORM, VK_FORMAT_R16G16B16A16_UNORM);
AddColorFormat (DXGI_FORMAT_R16G16B16A16_UINT, VK_FORMAT_R16G16B16A16_UINT);
AddColorFormat (DXGI_FORMAT_R16G16B16A16_SNORM, VK_FORMAT_R16G16B16A16_SNORM);
AddColorFormat (DXGI_FORMAT_R16G16B16A16_SINT, VK_FORMAT_R16G16B16A16_SINT);
AddColorFormat(DXGI_FORMAT_R32G32_TYPELESS, VK_FORMAT_R32G32_UINT);
AddColorFormat(DXGI_FORMAT_R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT);
AddColorFormat(DXGI_FORMAT_R32G32_UINT, VK_FORMAT_R32G32_UINT);
AddColorFormat(DXGI_FORMAT_R32G32_SINT, VK_FORMAT_R32G32_SINT);
AddColorFormatTypeless(DXGI_FORMAT_R32G32_TYPELESS, VK_FORMAT_R32G32_UINT);
AddColorFormat (DXGI_FORMAT_R32G32_FLOAT, VK_FORMAT_R32G32_SFLOAT);
AddColorFormat (DXGI_FORMAT_R32G32_UINT, VK_FORMAT_R32G32_UINT);
AddColorFormat (DXGI_FORMAT_R32G32_SINT, VK_FORMAT_R32G32_SINT);
AddColorFormat(DXGI_FORMAT_R10G10B10A2_TYPELESS, VK_FORMAT_A2R10G10B10_UINT_PACK32);
AddColorFormat(DXGI_FORMAT_R10G10B10A2_UINT, VK_FORMAT_A2R10G10B10_UINT_PACK32);
AddColorFormat(DXGI_FORMAT_R10G10B10A2_UNORM, VK_FORMAT_A2R10G10B10_UNORM_PACK32);
AddColorFormatTypeless(DXGI_FORMAT_R10G10B10A2_TYPELESS, VK_FORMAT_A2R10G10B10_UINT_PACK32);
AddColorFormat (DXGI_FORMAT_R10G10B10A2_UINT, VK_FORMAT_A2R10G10B10_UINT_PACK32);
AddColorFormat (DXGI_FORMAT_R10G10B10A2_UNORM, VK_FORMAT_A2R10G10B10_UNORM_PACK32);
AddColorFormat(DXGI_FORMAT_R11G11B10_FLOAT, VK_FORMAT_B10G11R11_UFLOAT_PACK32);
AddColorFormat (DXGI_FORMAT_R11G11B10_FLOAT, VK_FORMAT_B10G11R11_UFLOAT_PACK32);
AddColorFormat(DXGI_FORMAT_R8G8B8A8_TYPELESS, VK_FORMAT_R8G8B8A8_UINT);
AddColorFormat(DXGI_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM);
AddColorFormat(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, VK_FORMAT_R8G8B8A8_SRGB);
AddColorFormat(DXGI_FORMAT_R8G8B8A8_UINT, VK_FORMAT_R8G8B8A8_UINT);
AddColorFormat(DXGI_FORMAT_R8G8B8A8_SNORM, VK_FORMAT_R8G8B8A8_SNORM);
AddColorFormat(DXGI_FORMAT_R8G8B8A8_SINT, VK_FORMAT_R8G8B8A8_SINT);
AddColorFormatTypeless(DXGI_FORMAT_R8G8B8A8_TYPELESS, VK_FORMAT_R8G8B8A8_UINT);
AddColorFormat (DXGI_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM);
AddColorFormat (DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, VK_FORMAT_R8G8B8A8_SRGB);
AddColorFormat (DXGI_FORMAT_R8G8B8A8_UINT, VK_FORMAT_R8G8B8A8_UINT);
AddColorFormat (DXGI_FORMAT_R8G8B8A8_SNORM, VK_FORMAT_R8G8B8A8_SNORM);
AddColorFormat (DXGI_FORMAT_R8G8B8A8_SINT, VK_FORMAT_R8G8B8A8_SINT);
AddColorFormat(DXGI_FORMAT_R16G16_TYPELESS, VK_FORMAT_R16G16_UINT);
AddColorFormat(DXGI_FORMAT_R16G16_FLOAT, VK_FORMAT_R16G16_SFLOAT);
AddColorFormat(DXGI_FORMAT_R16G16_UNORM, VK_FORMAT_R16G16_UNORM);
AddColorFormat(DXGI_FORMAT_R16G16_UINT, VK_FORMAT_R16G16_UINT);
AddColorFormat(DXGI_FORMAT_R16G16_SNORM, VK_FORMAT_R16G16_SNORM);
AddColorFormat(DXGI_FORMAT_R16G16_SINT, VK_FORMAT_R16G16_SINT);
AddColorFormatTypeless(DXGI_FORMAT_R16G16_TYPELESS, VK_FORMAT_R16G16_UINT);
AddColorFormat (DXGI_FORMAT_R16G16_FLOAT, VK_FORMAT_R16G16_SFLOAT);
AddColorFormat (DXGI_FORMAT_R16G16_UNORM, VK_FORMAT_R16G16_UNORM);
AddColorFormat (DXGI_FORMAT_R16G16_UINT, VK_FORMAT_R16G16_UINT);
AddColorFormat (DXGI_FORMAT_R16G16_SNORM, VK_FORMAT_R16G16_SNORM);
AddColorFormat (DXGI_FORMAT_R16G16_SINT, VK_FORMAT_R16G16_SINT);
AddColorFormat(DXGI_FORMAT_R32_TYPELESS, VK_FORMAT_R32_UINT);
AddColorFormat(DXGI_FORMAT_R32_FLOAT, VK_FORMAT_R32_SFLOAT);
AddColorFormat(DXGI_FORMAT_R32_UINT, VK_FORMAT_R32_UINT);
AddColorFormat(DXGI_FORMAT_R32_SINT, VK_FORMAT_R32_SINT);
AddColorFormatTypeless(DXGI_FORMAT_R32_TYPELESS, VK_FORMAT_R32_UINT);
AddColorFormat (DXGI_FORMAT_R32_FLOAT, VK_FORMAT_R32_SFLOAT);
AddColorFormat (DXGI_FORMAT_R32_UINT, VK_FORMAT_R32_UINT);
AddColorFormat (DXGI_FORMAT_R32_SINT, VK_FORMAT_R32_SINT);
AddColorFormat(DXGI_FORMAT_R8G8_TYPELESS, VK_FORMAT_R8G8_UINT);
AddColorFormat(DXGI_FORMAT_R8G8_UNORM, VK_FORMAT_R8G8_UNORM);
AddColorFormat(DXGI_FORMAT_R8G8_UINT, VK_FORMAT_R8G8_UINT);
AddColorFormat(DXGI_FORMAT_R8G8_SNORM, VK_FORMAT_R8G8_SNORM);
AddColorFormat(DXGI_FORMAT_R8G8_SINT, VK_FORMAT_R8G8_SINT);
AddColorFormatTypeless(DXGI_FORMAT_R8G8_TYPELESS, VK_FORMAT_R8G8_UINT);
AddColorFormat (DXGI_FORMAT_R8G8_UNORM, VK_FORMAT_R8G8_UNORM);
AddColorFormat (DXGI_FORMAT_R8G8_UINT, VK_FORMAT_R8G8_UINT);
AddColorFormat (DXGI_FORMAT_R8G8_SNORM, VK_FORMAT_R8G8_SNORM);
AddColorFormat (DXGI_FORMAT_R8G8_SINT, VK_FORMAT_R8G8_SINT);
AddColorFormat(DXGI_FORMAT_R16_TYPELESS, VK_FORMAT_R16_UINT);
AddColorFormat(DXGI_FORMAT_R16_FLOAT, VK_FORMAT_R16_SFLOAT);
AddColorFormat(DXGI_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM);
AddColorFormat(DXGI_FORMAT_R16_UINT, VK_FORMAT_R16_UINT);
AddColorFormat(DXGI_FORMAT_R16_SNORM, VK_FORMAT_R16_SNORM);
AddColorFormat(DXGI_FORMAT_R16_SINT, VK_FORMAT_R16_SINT);
AddColorFormatTypeless(DXGI_FORMAT_R16_TYPELESS, VK_FORMAT_R16_UINT);
AddColorFormat (DXGI_FORMAT_R16_FLOAT, VK_FORMAT_R16_SFLOAT);
AddColorFormat (DXGI_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM);
AddColorFormat (DXGI_FORMAT_R16_UINT, VK_FORMAT_R16_UINT);
AddColorFormat (DXGI_FORMAT_R16_SNORM, VK_FORMAT_R16_SNORM);
AddColorFormat (DXGI_FORMAT_R16_SINT, VK_FORMAT_R16_SINT);
AddColorFormat(DXGI_FORMAT_R8_TYPELESS, VK_FORMAT_R8_UINT);
AddColorFormat(DXGI_FORMAT_R8_UNORM, VK_FORMAT_R8_UNORM);
AddColorFormat(DXGI_FORMAT_R8_UINT, VK_FORMAT_R8_UINT);
AddColorFormat(DXGI_FORMAT_R8_SNORM, VK_FORMAT_R8_SNORM);
AddColorFormat(DXGI_FORMAT_R8_SINT, VK_FORMAT_R8_SINT);
AddColorFormatTypeless(DXGI_FORMAT_R8_TYPELESS, VK_FORMAT_R8_UINT);
AddColorFormat (DXGI_FORMAT_R8_UNORM, VK_FORMAT_R8_UNORM);
AddColorFormat (DXGI_FORMAT_R8_UINT, VK_FORMAT_R8_UINT);
AddColorFormat (DXGI_FORMAT_R8_SNORM, VK_FORMAT_R8_SNORM);
AddColorFormat (DXGI_FORMAT_R8_SINT, VK_FORMAT_R8_SINT);
AddColorFormat(DXGI_FORMAT_A8_UNORM, VK_FORMAT_R8_UNORM,
AddColorFormat (DXGI_FORMAT_A8_UNORM, VK_FORMAT_R8_UNORM,
{ VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ZERO,
VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_R });
// AddColorFormat(DXGI_FORMAT_R1_UNORM, VK_FORMAT_UNDEFINED);
AddColorFormat(DXGI_FORMAT_R9G9B9E5_SHAREDEXP, VK_FORMAT_E5B9G9R9_UFLOAT_PACK32);
AddColorFormat (DXGI_FORMAT_R9G9B9E5_SHAREDEXP, VK_FORMAT_E5B9G9R9_UFLOAT_PACK32);
// AddColorFormat(DXGI_FORMAT_R8G8_B8G8_UNORM, VK_FORMAT_UNDEFINED);
// AddColorFormat(DXGI_FORMAT_G8R8_G8B8_UNORM, VK_FORMAT_UNDEFINED);
AddColorFormat(DXGI_FORMAT_B5G6R5_UNORM, VK_FORMAT_B5G6R5_UNORM_PACK16);
AddColorFormat(DXGI_FORMAT_B5G5R5A1_UNORM, VK_FORMAT_B5G5R5A1_UNORM_PACK16);
AddColorFormat (DXGI_FORMAT_B5G6R5_UNORM, VK_FORMAT_B5G6R5_UNORM_PACK16);
AddColorFormat (DXGI_FORMAT_B5G5R5A1_UNORM, VK_FORMAT_B5G5R5A1_UNORM_PACK16);
AddColorFormat(DXGI_FORMAT_B8G8R8A8_TYPELESS, VK_FORMAT_B8G8R8A8_UNORM);
AddColorFormat(DXGI_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_UNORM);
AddColorFormat(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, VK_FORMAT_B8G8R8A8_SRGB);
AddColorFormatTypeless(DXGI_FORMAT_B8G8R8A8_TYPELESS, VK_FORMAT_B8G8R8A8_UNORM);
AddColorFormat (DXGI_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_UNORM);
AddColorFormat (DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, VK_FORMAT_B8G8R8A8_SRGB);
AddColorFormatTypeless(DXGI_FORMAT_B8G8R8X8_TYPELESS, VK_FORMAT_B8G8R8A8_UNORM);
AddColorFormat(DXGI_FORMAT_B8G8R8X8_UNORM, VK_FORMAT_B8G8R8A8_UNORM,
{ VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G,
VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_ONE });
AddColorFormat(DXGI_FORMAT_B8G8R8X8_TYPELESS, VK_FORMAT_B8G8R8A8_UNORM,
{ VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G,
VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_ONE });
AddColorFormat(DXGI_FORMAT_B8G8R8X8_UNORM_SRGB, VK_FORMAT_B8G8R8A8_SRGB,
{ VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G,
VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_ONE });
@ -322,62 +337,62 @@ namespace dxvk {
/***********************************************************************************/
/* B L O C K F O R M A T S */
AddColorFormat(DXGI_FORMAT_BC1_TYPELESS, VK_FORMAT_BC1_RGBA_UNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC1_UNORM, VK_FORMAT_BC1_RGBA_UNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC1_UNORM_SRGB, VK_FORMAT_BC1_RGBA_SRGB_BLOCK);
AddColorFormatTypeless(DXGI_FORMAT_BC1_TYPELESS, VK_FORMAT_BC1_RGBA_UNORM_BLOCK);
AddColorFormat (DXGI_FORMAT_BC1_UNORM, VK_FORMAT_BC1_RGBA_UNORM_BLOCK);
AddColorFormat (DXGI_FORMAT_BC1_UNORM_SRGB, VK_FORMAT_BC1_RGBA_SRGB_BLOCK);
AddColorFormat(DXGI_FORMAT_BC2_TYPELESS, VK_FORMAT_BC2_UNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC2_UNORM, VK_FORMAT_BC2_UNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC2_UNORM_SRGB, VK_FORMAT_BC2_SRGB_BLOCK);
AddColorFormatTypeless(DXGI_FORMAT_BC2_TYPELESS, VK_FORMAT_BC2_UNORM_BLOCK);
AddColorFormat (DXGI_FORMAT_BC2_UNORM, VK_FORMAT_BC2_UNORM_BLOCK);
AddColorFormat (DXGI_FORMAT_BC2_UNORM_SRGB, VK_FORMAT_BC2_SRGB_BLOCK);
AddColorFormat(DXGI_FORMAT_BC3_TYPELESS, VK_FORMAT_BC3_UNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC3_UNORM, VK_FORMAT_BC3_UNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC3_UNORM_SRGB, VK_FORMAT_BC3_SRGB_BLOCK);
AddColorFormatTypeless(DXGI_FORMAT_BC3_TYPELESS, VK_FORMAT_BC3_UNORM_BLOCK);
AddColorFormat (DXGI_FORMAT_BC3_UNORM, VK_FORMAT_BC3_UNORM_BLOCK);
AddColorFormat (DXGI_FORMAT_BC3_UNORM_SRGB, VK_FORMAT_BC3_SRGB_BLOCK);
AddColorFormat(DXGI_FORMAT_BC4_TYPELESS, VK_FORMAT_BC4_UNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC4_UNORM, VK_FORMAT_BC4_UNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC4_SNORM, VK_FORMAT_BC4_SNORM_BLOCK);
AddColorFormatTypeless(DXGI_FORMAT_BC4_TYPELESS, VK_FORMAT_BC4_UNORM_BLOCK);
AddColorFormat (DXGI_FORMAT_BC4_UNORM, VK_FORMAT_BC4_UNORM_BLOCK);
AddColorFormat (DXGI_FORMAT_BC4_SNORM, VK_FORMAT_BC4_SNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC5_TYPELESS, VK_FORMAT_BC5_UNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC5_UNORM, VK_FORMAT_BC5_UNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC5_SNORM, VK_FORMAT_BC5_SNORM_BLOCK);
AddColorFormatTypeless(DXGI_FORMAT_BC5_TYPELESS, VK_FORMAT_BC5_UNORM_BLOCK);
AddColorFormat (DXGI_FORMAT_BC5_UNORM, VK_FORMAT_BC5_UNORM_BLOCK);
AddColorFormat (DXGI_FORMAT_BC5_SNORM, VK_FORMAT_BC5_SNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC6H_TYPELESS, VK_FORMAT_BC6H_UFLOAT_BLOCK);
AddColorFormat(DXGI_FORMAT_BC6H_UF16, VK_FORMAT_BC6H_UFLOAT_BLOCK);
AddColorFormat(DXGI_FORMAT_BC6H_SF16, VK_FORMAT_BC6H_SFLOAT_BLOCK);
AddColorFormatTypeless(DXGI_FORMAT_BC6H_TYPELESS, VK_FORMAT_BC6H_UFLOAT_BLOCK);
AddColorFormat (DXGI_FORMAT_BC6H_UF16, VK_FORMAT_BC6H_UFLOAT_BLOCK);
AddColorFormat (DXGI_FORMAT_BC6H_SF16, VK_FORMAT_BC6H_SFLOAT_BLOCK);
AddColorFormat(DXGI_FORMAT_BC7_TYPELESS, VK_FORMAT_BC7_UNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC7_UNORM, VK_FORMAT_BC7_UNORM_BLOCK);
AddColorFormat(DXGI_FORMAT_BC7_UNORM_SRGB, VK_FORMAT_BC7_SRGB_BLOCK);
AddColorFormatTypeless(DXGI_FORMAT_BC7_TYPELESS, VK_FORMAT_BC7_UNORM_BLOCK);
AddColorFormat (DXGI_FORMAT_BC7_UNORM, VK_FORMAT_BC7_UNORM_BLOCK);
AddColorFormat (DXGI_FORMAT_BC7_UNORM_SRGB, VK_FORMAT_BC7_SRGB_BLOCK);
/***********************************************************************************/
/* D E P T H F O R M A T S */
AddDepthFormat(DXGI_FORMAT_D16_UNORM, VK_FORMAT_D16_UNORM, 0);
AddDepthFormat(DXGI_FORMAT_R16_TYPELESS, VK_FORMAT_D16_UNORM, 0);
AddDepthFormat(DXGI_FORMAT_R16_UNORM, VK_FORMAT_D16_UNORM, VK_IMAGE_ASPECT_DEPTH_BIT);
AddDepthFormatTypeless(DXGI_FORMAT_R16_TYPELESS, VK_FORMAT_D16_UNORM);
AddDepthFormat (DXGI_FORMAT_D16_UNORM, VK_FORMAT_D16_UNORM, 0);
AddDepthFormat (DXGI_FORMAT_R16_UNORM, VK_FORMAT_D16_UNORM, VK_IMAGE_ASPECT_DEPTH_BIT);
AddDepthFormat(DXGI_FORMAT_D32_FLOAT, VK_FORMAT_D32_SFLOAT, 0);
AddDepthFormat(DXGI_FORMAT_R32_TYPELESS, VK_FORMAT_D32_SFLOAT, 0);
AddDepthFormat(DXGI_FORMAT_R32_FLOAT, VK_FORMAT_D32_SFLOAT, VK_IMAGE_ASPECT_DEPTH_BIT);
AddDepthFormatTypeless(DXGI_FORMAT_R32_TYPELESS, VK_FORMAT_D32_SFLOAT);
AddDepthFormat (DXGI_FORMAT_D32_FLOAT, VK_FORMAT_D32_SFLOAT, 0);
AddDepthFormat (DXGI_FORMAT_R32_FLOAT, VK_FORMAT_D32_SFLOAT, VK_IMAGE_ASPECT_DEPTH_BIT);
AddDepthFormat(DXGI_FORMAT_D32_FLOAT_S8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, 0);
AddDepthFormat(DXGI_FORMAT_R32G8X24_TYPELESS, VK_FORMAT_D32_SFLOAT_S8_UINT, 0);
AddDepthFormat(DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_IMAGE_ASPECT_DEPTH_BIT);
AddDepthFormat(DXGI_FORMAT_X32_TYPELESS_G8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_IMAGE_ASPECT_STENCIL_BIT);
AddDepthFormatTypeless(DXGI_FORMAT_R32G8X24_TYPELESS, VK_FORMAT_D32_SFLOAT_S8_UINT);
AddDepthFormat (DXGI_FORMAT_D32_FLOAT_S8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, 0);
AddDepthFormat (DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_IMAGE_ASPECT_DEPTH_BIT);
AddDepthFormat (DXGI_FORMAT_X32_TYPELESS_G8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_IMAGE_ASPECT_STENCIL_BIT);
// Vulkan implementations are not required to support 24-bit depth buffers natively
// and AMD decided to not implement them, so we'll fall back to 32-bit depth buffers
if (HasFormatSupport(VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) {
AddDepthFormat(DXGI_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, 0);
AddDepthFormat(DXGI_FORMAT_R24G8_TYPELESS, VK_FORMAT_D24_UNORM_S8_UINT, 0);
AddDepthFormat(DXGI_FORMAT_R24_UNORM_X8_TYPELESS, VK_FORMAT_D24_UNORM_S8_UINT, VK_IMAGE_ASPECT_DEPTH_BIT);
AddDepthFormat(DXGI_FORMAT_X24_TYPELESS_G8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, VK_IMAGE_ASPECT_STENCIL_BIT);
AddDepthFormatTypeless(DXGI_FORMAT_R24G8_TYPELESS, VK_FORMAT_D24_UNORM_S8_UINT);
AddDepthFormat (DXGI_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, 0);
AddDepthFormat (DXGI_FORMAT_R24_UNORM_X8_TYPELESS, VK_FORMAT_D24_UNORM_S8_UINT, VK_IMAGE_ASPECT_DEPTH_BIT);
AddDepthFormat (DXGI_FORMAT_X24_TYPELESS_G8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, VK_IMAGE_ASPECT_STENCIL_BIT);
} else {
Logger::warn("DxgiAdapter: DXGI_FORMAT_D24_UNORM_S8_UINT -> VK_FORMAT_D32_SFLOAT_S8_UINT");
AddDepthFormat(DXGI_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, 0);
AddDepthFormat(DXGI_FORMAT_R24G8_TYPELESS, VK_FORMAT_D32_SFLOAT_S8_UINT, 0);
AddDepthFormat(DXGI_FORMAT_R24_UNORM_X8_TYPELESS, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_IMAGE_ASPECT_DEPTH_BIT);
AddDepthFormat(DXGI_FORMAT_X24_TYPELESS_G8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_IMAGE_ASPECT_STENCIL_BIT);
AddDepthFormatTypeless(DXGI_FORMAT_R24G8_TYPELESS, VK_FORMAT_D32_SFLOAT_S8_UINT);
AddDepthFormat (DXGI_FORMAT_R24_UNORM_X8_TYPELESS, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_IMAGE_ASPECT_DEPTH_BIT);
AddDepthFormat (DXGI_FORMAT_X24_TYPELESS_G8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_IMAGE_ASPECT_STENCIL_BIT);
AddDepthFormat (DXGI_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, 0);
}
}

View File

@ -65,14 +65,20 @@ namespace dxvk {
FormatMap m_colorFormats;
FormatMap m_depthFormats;
void AddColorFormat(
void AddColorFormatTypeless(
DXGI_FORMAT srcFormat,
VkFormat dstFormat);
void AddColorFormat(
DXGI_FORMAT srcFormat,
VkFormat dstFormat,
VkComponentMapping swizzle);
VkComponentMapping swizzle = {
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY });
void AddDepthFormatTypeless(
DXGI_FORMAT srcFormat,
VkFormat dstFormat);
void AddDepthFormat(
DXGI_FORMAT srcFormat,

View File

@ -11,6 +11,15 @@ namespace dxvk {
class DxvkDevice;
class DxvkImage;
/**
* \brief Format information
*/
enum class DxgiFormatFlag {
Typeless = 0,
};
using DxgiFormatFlags = Flags<DxgiFormatFlag>;
/**
* \brief Format info
*
@ -23,6 +32,7 @@ namespace dxvk {
VkFormat format;
VkImageAspectFlags aspect;
VkComponentMapping swizzle;
DxgiFormatFlags flags;
};
/**