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

[dxgi] Added DXGI format family info

This commit is contained in:
Philip Rebohle 2018-05-05 12:57:22 +02:00
parent a55bee9554
commit e1a27faa4a
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
7 changed files with 269 additions and 124 deletions

View File

@ -1642,10 +1642,16 @@ namespace dxvk {
}
DXGI_VK_FORMAT_INFO STDMETHODCALLTYPE D3D11Device::LookupFormat(
DXGI_FORMAT format,
DXGI_VK_FORMAT_MODE mode) const {
return m_dxgiAdapter->LookupFormat(format, mode);
DXGI_VK_FORMAT_MAPPING D3D11Device::GetFormatMapping(
DXGI_FORMAT Format) const {
return m_dxgiAdapter->GetFormatMapping(Format);
}
DXGI_VK_FORMAT_INFO D3D11Device::LookupFormat(
DXGI_FORMAT Format,
DXGI_VK_FORMAT_MODE Mode) const {
return m_dxgiAdapter->LookupFormat(Format, Mode);
}

View File

@ -322,9 +322,12 @@ namespace dxvk {
VkPipelineStageFlags GetEnabledShaderStages() const;
DXGI_VK_FORMAT_INFO STDMETHODCALLTYPE LookupFormat(
DXGI_FORMAT format,
DXGI_VK_FORMAT_MODE mode) const;
DXGI_VK_FORMAT_MAPPING GetFormatMapping(
DXGI_FORMAT Format) const;
DXGI_VK_FORMAT_INFO LookupFormat(
DXGI_FORMAT Format,
DXGI_VK_FORMAT_MODE Mode) const;
bool TestOption(D3D11Option Option) const {
return m_d3d11Options.test(Option);

View File

@ -188,6 +188,12 @@ namespace dxvk {
}
DXGI_VK_FORMAT_MAPPING STDMETHODCALLTYPE DxgiAdapter::GetFormatMapping(
DXGI_FORMAT Format) {
return *GetDXGIFormatMapping(Format);
}
DXGI_VK_FORMAT_INFO STDMETHODCALLTYPE DxgiAdapter::LookupFormat(
DXGI_FORMAT Format,
DXGI_VK_FORMAT_MODE Mode) {

View File

@ -54,6 +54,9 @@ namespace dxvk {
const VkPhysicalDeviceFeatures* pFeatures,
IDXGIVkDevice** ppDevice) final;
DXGI_VK_FORMAT_MAPPING STDMETHODCALLTYPE GetFormatMapping(
DXGI_FORMAT Format) final;
DXGI_VK_FORMAT_INFO STDMETHODCALLTYPE LookupFormat(
DXGI_FORMAT Format,
DXGI_VK_FORMAT_MODE Mode) final;

View File

@ -8,316 +8,381 @@ namespace dxvk {
// DXGI_FORMAT_UNKNOWN
{ },
// DXGI_FORMAT_R32G32B32A32_TYPELESS
{ VK_FORMAT_R32G32B32A32_UINT,
{ DXGI_FORMAT_R32G32B32A32_TYPELESS,
VK_FORMAT_R32G32B32A32_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32G32B32A32_UINT },
// DXGI_FORMAT_R32G32B32A32_FLOAT
{ VK_FORMAT_R32G32B32A32_SFLOAT,
{ DXGI_FORMAT_R32G32B32A32_TYPELESS,
VK_FORMAT_R32G32B32A32_SFLOAT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32G32B32A32_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R32G32B32A32_UINT
{ VK_FORMAT_R32G32B32A32_UINT,
{ DXGI_FORMAT_R32G32B32A32_TYPELESS,
VK_FORMAT_R32G32B32A32_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32G32B32A32_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R32G32B32A32_SINT
{ VK_FORMAT_R32G32B32A32_SINT,
{ DXGI_FORMAT_R32G32B32A32_TYPELESS,
VK_FORMAT_R32G32B32A32_SINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32G32B32A32_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R32G32B32_TYPELESS
{ VK_FORMAT_R32G32B32_UINT,
{ DXGI_FORMAT_R32G32B32_TYPELESS,
VK_FORMAT_R32G32B32_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32G32B32_UINT },
// DXGI_FORMAT_R32G32B32_FLOAT
{ VK_FORMAT_R32G32B32_SFLOAT,
{ DXGI_FORMAT_R32G32B32_TYPELESS,
VK_FORMAT_R32G32B32_SFLOAT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32G32B32_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R32G32B32_UINT
{ VK_FORMAT_R32G32B32_UINT,
{ DXGI_FORMAT_R32G32B32_TYPELESS,
VK_FORMAT_R32G32B32_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32G32B32_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R32G32B32_SINT
{ VK_FORMAT_R32G32B32_SINT,
{ DXGI_FORMAT_R32G32B32_TYPELESS,
VK_FORMAT_R32G32B32_SINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32G32B32_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R16G16B16A16_TYPELESS
{ VK_FORMAT_R16G16B16A16_UINT,
{ DXGI_FORMAT_R16G16B16A16_TYPELESS,
VK_FORMAT_R16G16B16A16_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16G16B16A16_UINT },
// DXGI_FORMAT_R16G16B16A16_FLOAT
{ VK_FORMAT_R16G16B16A16_SFLOAT,
{ DXGI_FORMAT_R16G16B16A16_TYPELESS,
VK_FORMAT_R16G16B16A16_SFLOAT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16G16B16A16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R16G16B16A16_UNORM
{ VK_FORMAT_R16G16B16A16_UNORM,
{ DXGI_FORMAT_R16G16B16A16_TYPELESS,
VK_FORMAT_R16G16B16A16_UNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16G16B16A16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R16G16B16A16_UINT
{ VK_FORMAT_R16G16B16A16_UINT,
{ DXGI_FORMAT_R16G16B16A16_TYPELESS,
VK_FORMAT_R16G16B16A16_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16G16B16A16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R16G16B16A16_SNORM
{ VK_FORMAT_R16G16B16A16_SNORM,
{ DXGI_FORMAT_R16G16B16A16_TYPELESS,
VK_FORMAT_R16G16B16A16_SNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16G16B16A16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R16G16B16A16_SINT
{ VK_FORMAT_R16G16B16A16_SINT,
{ DXGI_FORMAT_R16G16B16A16_TYPELESS,
VK_FORMAT_R16G16B16A16_SINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16G16B16A16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R32G32_TYPELESS
{ VK_FORMAT_R32G32_UINT,
{ DXGI_FORMAT_R32G32_TYPELESS,
VK_FORMAT_R32G32_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32G32_UINT },
// DXGI_FORMAT_R32G32_FLOAT
{ VK_FORMAT_R32G32_SFLOAT,
{ DXGI_FORMAT_R32G32_TYPELESS,
VK_FORMAT_R32G32_SFLOAT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32G32_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R32G32_UINT
{ VK_FORMAT_R32G32_UINT,
{ DXGI_FORMAT_R32G32_TYPELESS,
VK_FORMAT_R32G32_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32G32_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R32G32_SINT
{ VK_FORMAT_R32G32_SINT,
{ DXGI_FORMAT_R32G32_TYPELESS,
VK_FORMAT_R32G32_SINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32G32_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R32G8X24_TYPELESS
{ VK_FORMAT_UNDEFINED,
{ DXGI_FORMAT_R32G8X24_TYPELESS,
VK_FORMAT_UNDEFINED,
VK_FORMAT_D32_SFLOAT_S8_UINT,
VK_FORMAT_UNDEFINED },
// DXGI_FORMAT_D32_FLOAT_S8X24_UINT
{ VK_FORMAT_UNDEFINED,
{ DXGI_FORMAT_R32G8X24_TYPELESS,
VK_FORMAT_UNDEFINED,
VK_FORMAT_D32_SFLOAT_S8_UINT,
VK_FORMAT_UNDEFINED,
0, VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT },
// DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS
{ VK_FORMAT_UNDEFINED,
{ DXGI_FORMAT_R32G8X24_TYPELESS,
VK_FORMAT_UNDEFINED,
VK_FORMAT_D32_SFLOAT_S8_UINT,
VK_FORMAT_UNDEFINED,
0, VK_IMAGE_ASPECT_DEPTH_BIT },
// DXGI_FORMAT_X32_TYPELESS_G8X24_UINT
{ VK_FORMAT_UNDEFINED,
{ DXGI_FORMAT_R32G8X24_TYPELESS,
VK_FORMAT_UNDEFINED,
VK_FORMAT_D32_SFLOAT_S8_UINT,
VK_FORMAT_UNDEFINED,
0, VK_IMAGE_ASPECT_STENCIL_BIT },
// DXGI_FORMAT_R10G10B10A2_TYPELESS
{ VK_FORMAT_A2B10G10R10_UINT_PACK32,
{ DXGI_FORMAT_R10G10B10A2_TYPELESS,
VK_FORMAT_A2B10G10R10_UINT_PACK32,
VK_FORMAT_UNDEFINED,
VK_FORMAT_A2B10G10R10_UINT_PACK32 },
// DXGI_FORMAT_R10G10B10A2_UNORM
{ VK_FORMAT_A2B10G10R10_UNORM_PACK32,
{ DXGI_FORMAT_R10G10B10A2_TYPELESS,
VK_FORMAT_A2B10G10R10_UNORM_PACK32,
VK_FORMAT_UNDEFINED,
VK_FORMAT_A2B10G10R10_UINT_PACK32,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R10G10B10A2_UINT
{ VK_FORMAT_A2B10G10R10_UINT_PACK32,
{ DXGI_FORMAT_R10G10B10A2_TYPELESS,
VK_FORMAT_A2B10G10R10_UINT_PACK32,
VK_FORMAT_UNDEFINED,
VK_FORMAT_A2B10G10R10_UINT_PACK32,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R11G11B10_FLOAT
{ VK_FORMAT_B10G11R11_UFLOAT_PACK32,
{ DXGI_FORMAT_R10G10B10A2_TYPELESS,
VK_FORMAT_B10G11R11_UFLOAT_PACK32,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R8G8B8A8_TYPELESS
{ VK_FORMAT_R8G8B8A8_UINT,
{ DXGI_FORMAT_R8G8B8A8_TYPELESS,
VK_FORMAT_R8G8B8A8_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8G8B8A8_UINT },
// DXGI_FORMAT_R8G8B8A8_UNORM
{ VK_FORMAT_R8G8B8A8_UNORM,
{ DXGI_FORMAT_R8G8B8A8_TYPELESS,
VK_FORMAT_R8G8B8A8_UNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8G8B8A8_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
{ VK_FORMAT_R8G8B8A8_SRGB,
{ DXGI_FORMAT_R8G8B8A8_TYPELESS,
VK_FORMAT_R8G8B8A8_SRGB,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8G8B8A8_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R8G8B8A8_UINT
{ VK_FORMAT_R8G8B8A8_UINT,
{ DXGI_FORMAT_R8G8B8A8_TYPELESS,
VK_FORMAT_R8G8B8A8_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8G8B8A8_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R8G8B8A8_SNORM
{ VK_FORMAT_R8G8B8A8_SNORM,
{ DXGI_FORMAT_R8G8B8A8_TYPELESS,
VK_FORMAT_R8G8B8A8_SNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8G8B8A8_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R8G8B8A8_SINT
{ VK_FORMAT_R8G8B8A8_SINT,
{ DXGI_FORMAT_R8G8B8A8_TYPELESS,
VK_FORMAT_R8G8B8A8_SINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8G8B8A8_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R16G16_TYPELESS
{ VK_FORMAT_R16G16_UINT,
{ DXGI_FORMAT_R16G16_TYPELESS,
VK_FORMAT_R16G16_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16G16_UINT },
// DXGI_FORMAT_R16G16_FLOAT
{ VK_FORMAT_R16G16_SFLOAT,
{ DXGI_FORMAT_R16G16_TYPELESS,
VK_FORMAT_R16G16_SFLOAT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16G16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R16G16_UNORM
{ VK_FORMAT_R16G16_UNORM,
{ DXGI_FORMAT_R16G16_TYPELESS,
VK_FORMAT_R16G16_UNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16G16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R16G16_UINT
{ VK_FORMAT_R16G16_UINT,
{ DXGI_FORMAT_R16G16_TYPELESS,
VK_FORMAT_R16G16_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16G16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R16G16_SNORM
{ VK_FORMAT_R16G16_SNORM,
{ DXGI_FORMAT_R16G16_TYPELESS,
VK_FORMAT_R16G16_SNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16G16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R16G16_SINT
{ VK_FORMAT_R16G16_SINT,
{ DXGI_FORMAT_R16G16_TYPELESS,
VK_FORMAT_R16G16_SINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16G16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R32_TYPELESS
{ VK_FORMAT_R32_UINT,
{ DXGI_FORMAT_R32_TYPELESS,
VK_FORMAT_R32_UINT,
VK_FORMAT_D32_SFLOAT,
VK_FORMAT_R32_UINT },
// DXGI_FORMAT_D32_FLOAT
{ VK_FORMAT_UNDEFINED,
{ DXGI_FORMAT_R32_TYPELESS,
VK_FORMAT_UNDEFINED,
VK_FORMAT_D32_SFLOAT,
VK_FORMAT_UNDEFINED,
0, VK_IMAGE_ASPECT_DEPTH_BIT },
// DXGI_FORMAT_R32_FLOAT
{ VK_FORMAT_R32_SFLOAT,
{ DXGI_FORMAT_R32_TYPELESS,
VK_FORMAT_R32_SFLOAT,
VK_FORMAT_D32_SFLOAT,
VK_FORMAT_R32_UINT,
VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_ASPECT_DEPTH_BIT },
// DXGI_FORMAT_R32_UINT
{ VK_FORMAT_R32_UINT,
{ DXGI_FORMAT_R32_TYPELESS,
VK_FORMAT_R32_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R32_SINT
{ VK_FORMAT_R32_SINT,
{ DXGI_FORMAT_R32_TYPELESS,
VK_FORMAT_R32_SINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R32_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R24G8_TYPELESS
{ VK_FORMAT_UNDEFINED,
{ DXGI_FORMAT_R24G8_TYPELESS,
VK_FORMAT_UNDEFINED,
VK_FORMAT_D32_SFLOAT_S8_UINT,
VK_FORMAT_UNDEFINED },
// DXGI_FORMAT_D24_UNORM_S8_UINT
{ VK_FORMAT_UNDEFINED,
{ DXGI_FORMAT_R24G8_TYPELESS,
VK_FORMAT_UNDEFINED,
VK_FORMAT_D32_SFLOAT_S8_UINT,
VK_FORMAT_UNDEFINED,
0, VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT },
// DXGI_FORMAT_R24_UNORM_X8_TYPELESS
{ VK_FORMAT_UNDEFINED,
{ DXGI_FORMAT_R24G8_TYPELESS,
VK_FORMAT_UNDEFINED,
VK_FORMAT_D32_SFLOAT_S8_UINT,
VK_FORMAT_UNDEFINED,
0, VK_IMAGE_ASPECT_DEPTH_BIT },
// DXGI_FORMAT_X24_TYPELESS_G8_UINT
{ VK_FORMAT_UNDEFINED,
{ DXGI_FORMAT_R24G8_TYPELESS,
VK_FORMAT_UNDEFINED,
VK_FORMAT_D32_SFLOAT_S8_UINT,
VK_FORMAT_UNDEFINED,
0, VK_IMAGE_ASPECT_STENCIL_BIT },
// DXGI_FORMAT_R8G8_TYPELESS
{ VK_FORMAT_R8G8_UINT,
{ DXGI_FORMAT_R8G8_TYPELESS,
VK_FORMAT_R8G8_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8G8_UINT },
// DXGI_FORMAT_R8G8_UNORM
{ VK_FORMAT_R8G8_UNORM,
{ DXGI_FORMAT_R8G8_TYPELESS,
VK_FORMAT_R8G8_UNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8G8_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R8G8_UINT
{ VK_FORMAT_R8G8_UINT,
{ DXGI_FORMAT_R8G8_TYPELESS,
VK_FORMAT_R8G8_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8G8_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R8G8_SNORM
{ VK_FORMAT_R8G8_SNORM,
{ DXGI_FORMAT_R8G8_TYPELESS,
VK_FORMAT_R8G8_SNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8G8_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R8G8_SINT
{ VK_FORMAT_R8G8_SINT,
{ DXGI_FORMAT_R8G8_TYPELESS,
VK_FORMAT_R8G8_SINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8G8_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R16_TYPELESS
{ VK_FORMAT_R16_UINT,
{ DXGI_FORMAT_R16_TYPELESS,
VK_FORMAT_R16_UINT,
VK_FORMAT_D16_UNORM,
VK_FORMAT_R16_UINT },
// DXGI_FORMAT_R16_FLOAT
{ VK_FORMAT_R16_SFLOAT,
{ DXGI_FORMAT_R16_TYPELESS,
VK_FORMAT_R16_SFLOAT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_D16_UNORM
{ VK_FORMAT_UNDEFINED,
{ DXGI_FORMAT_R16_TYPELESS,
VK_FORMAT_UNDEFINED,
VK_FORMAT_D16_UNORM,
VK_FORMAT_UNDEFINED,
0, VK_IMAGE_ASPECT_DEPTH_BIT },
// DXGI_FORMAT_R16_UNORM
{ VK_FORMAT_R16_UNORM,
{ DXGI_FORMAT_R16_TYPELESS,
VK_FORMAT_R16_UNORM,
VK_FORMAT_D16_UNORM,
VK_FORMAT_R16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_ASPECT_DEPTH_BIT },
// DXGI_FORMAT_R16_UINT
{ VK_FORMAT_R16_UINT,
{ DXGI_FORMAT_R16_TYPELESS,
VK_FORMAT_R16_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R16_SNORM
{ VK_FORMAT_R16_SNORM,
{ DXGI_FORMAT_R16_TYPELESS,
VK_FORMAT_R16_SNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R16_SINT
{ VK_FORMAT_R16_SINT,
{ DXGI_FORMAT_R16_TYPELESS,
VK_FORMAT_R16_SINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R16_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R8_TYPELESS
{ VK_FORMAT_R8_UINT,
{ DXGI_FORMAT_R8_TYPELESS,
VK_FORMAT_R8_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8_UINT },
// DXGI_FORMAT_R8_UNORM
{ VK_FORMAT_R8_UNORM,
{ DXGI_FORMAT_R8_TYPELESS,
VK_FORMAT_R8_UNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R8_UINT
{ VK_FORMAT_R8_UINT,
{ DXGI_FORMAT_R8_TYPELESS,
VK_FORMAT_R8_UINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R8_SNORM
{ VK_FORMAT_R8_SNORM,
{ DXGI_FORMAT_R8_TYPELESS,
VK_FORMAT_R8_SNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R8_SINT
{ VK_FORMAT_R8_SINT,
{ DXGI_FORMAT_R8_TYPELESS,
VK_FORMAT_R8_SINT,
VK_FORMAT_UNDEFINED,
VK_FORMAT_R8_UINT,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_A8_UNORM
{ VK_FORMAT_R8_UNORM,
{ DXGI_FORMAT_R8_TYPELESS,
VK_FORMAT_R8_UNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT, 0,
@ -326,111 +391,133 @@ namespace dxvk {
// DXGI_FORMAT_R1_UNORM
{ }, // Unsupported
// DXGI_FORMAT_R9G9B9E5_SHAREDEXP
{ VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,
{ DXGI_FORMAT_UNKNOWN,
VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_R8G8_B8G8_UNORM
{ VK_FORMAT_B8G8R8G8_422_UNORM_KHR,
{ DXGI_FORMAT_UNKNOWN,
VK_FORMAT_B8G8R8G8_422_UNORM_KHR,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT, 0,
{ VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_G,
VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_ONE }},
// DXGI_FORMAT_G8R8_G8B8_UNORM
{ VK_FORMAT_G8B8G8R8_422_UNORM_KHR,
{ DXGI_FORMAT_UNKNOWN,
VK_FORMAT_G8B8G8R8_422_UNORM_KHR,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT, 0,
{ VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_G,
VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_ONE }},
// DXGI_FORMAT_BC1_TYPELESS
{ VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
{ DXGI_FORMAT_BC1_TYPELESS,
VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED },
// DXGI_FORMAT_BC1_UNORM
{ VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
{ DXGI_FORMAT_BC1_TYPELESS,
VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_BC1_UNORM_SRGB
{ VK_FORMAT_BC1_RGBA_SRGB_BLOCK,
{ DXGI_FORMAT_BC1_TYPELESS,
VK_FORMAT_BC1_RGBA_SRGB_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_BC2_TYPELESS
{ VK_FORMAT_BC2_UNORM_BLOCK,
{ DXGI_FORMAT_BC2_TYPELESS,
VK_FORMAT_BC2_UNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED },
// DXGI_FORMAT_BC2_UNORM
{ VK_FORMAT_BC2_UNORM_BLOCK,
{ DXGI_FORMAT_BC2_TYPELESS,
VK_FORMAT_BC2_UNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_BC2_UNORM_SRGB
{ VK_FORMAT_BC2_SRGB_BLOCK,
{ DXGI_FORMAT_BC2_TYPELESS,
VK_FORMAT_BC2_SRGB_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_BC3_TYPELESS
{ VK_FORMAT_BC3_UNORM_BLOCK,
{ DXGI_FORMAT_BC3_TYPELESS,
VK_FORMAT_BC3_UNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED },
// DXGI_FORMAT_BC3_UNORM
{ VK_FORMAT_BC3_UNORM_BLOCK,
{ DXGI_FORMAT_BC3_TYPELESS,
VK_FORMAT_BC3_UNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_BC3_UNORM_SRGB
{ VK_FORMAT_BC3_SRGB_BLOCK,
{ DXGI_FORMAT_BC3_TYPELESS,
VK_FORMAT_BC3_SRGB_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_BC4_TYPELESS
{ VK_FORMAT_BC4_UNORM_BLOCK,
{ DXGI_FORMAT_BC4_TYPELESS,
VK_FORMAT_BC4_UNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED },
// DXGI_FORMAT_BC4_UNORM
{ VK_FORMAT_BC4_UNORM_BLOCK,
{ DXGI_FORMAT_BC4_TYPELESS,
VK_FORMAT_BC4_UNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_BC4_SNORM
{ VK_FORMAT_BC4_SNORM_BLOCK,
{ DXGI_FORMAT_BC4_TYPELESS,
VK_FORMAT_BC4_SNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_BC5_TYPELESS
{ VK_FORMAT_BC5_UNORM_BLOCK,
{ DXGI_FORMAT_BC5_TYPELESS,
VK_FORMAT_BC5_UNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED },
// DXGI_FORMAT_BC5_UNORM
{ VK_FORMAT_BC5_UNORM_BLOCK,
{ DXGI_FORMAT_BC5_TYPELESS,
VK_FORMAT_BC5_UNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_BC5_SNORM
{ VK_FORMAT_BC5_SNORM_BLOCK,
{ DXGI_FORMAT_BC5_TYPELESS,
VK_FORMAT_BC5_SNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_B5G6R5_UNORM
{ VK_FORMAT_R5G6B5_UNORM_PACK16,
{ DXGI_FORMAT_UNKNOWN,
VK_FORMAT_R5G6B5_UNORM_PACK16,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_B5G5R5A1_UNORM
{ VK_FORMAT_A1R5G5B5_UNORM_PACK16,
{ DXGI_FORMAT_UNKNOWN,
VK_FORMAT_A1R5G5B5_UNORM_PACK16,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_B8G8R8A8_UNORM
{ VK_FORMAT_B8G8R8A8_UNORM,
{ DXGI_FORMAT_B8G8R8A8_TYPELESS,
VK_FORMAT_B8G8R8A8_UNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_B8G8R8X8_UNORM
{ VK_FORMAT_B8G8R8A8_UNORM,
{ DXGI_FORMAT_B8G8R8X8_TYPELESS,
VK_FORMAT_B8G8R8A8_UNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT, 0,
@ -439,51 +526,61 @@ namespace dxvk {
// DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM
{ }, // Unsupported
// DXGI_FORMAT_B8G8R8A8_TYPELESS
{ VK_FORMAT_B8G8R8A8_UNORM,
{ DXGI_FORMAT_B8G8R8A8_TYPELESS,
VK_FORMAT_B8G8R8A8_UNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED },
// DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
{ VK_FORMAT_B8G8R8A8_SRGB,
{ DXGI_FORMAT_B8G8R8A8_TYPELESS,
VK_FORMAT_B8G8R8A8_SRGB,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_B8G8R8X8_TYPELESS
{ VK_FORMAT_B8G8R8A8_UNORM,
{ DXGI_FORMAT_B8G8R8X8_TYPELESS,
VK_FORMAT_B8G8R8A8_UNORM,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_B8G8R8X8_UNORM_SRGB
{ VK_FORMAT_B8G8R8A8_SRGB,
{ DXGI_FORMAT_B8G8R8X8_TYPELESS,
VK_FORMAT_B8G8R8A8_SRGB,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT, 0,
{ VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G,
VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_ONE }},
// DXGI_FORMAT_BC6H_TYPELESS
{ VK_FORMAT_BC6H_UFLOAT_BLOCK,
{ DXGI_FORMAT_BC6H_TYPELESS,
VK_FORMAT_BC6H_UFLOAT_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED },
// DXGI_FORMAT_BC6H_UF16
{ VK_FORMAT_BC6H_UFLOAT_BLOCK,
{ DXGI_FORMAT_BC6H_TYPELESS,
VK_FORMAT_BC6H_UFLOAT_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_BC6H_SF16
{ VK_FORMAT_BC6H_SFLOAT_BLOCK,
{ DXGI_FORMAT_BC6H_TYPELESS,
VK_FORMAT_BC6H_SFLOAT_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_BC7_TYPELESS
{ VK_FORMAT_BC7_UNORM_BLOCK,
{ DXGI_FORMAT_BC7_TYPELESS,
VK_FORMAT_BC7_UNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED },
// DXGI_FORMAT_BC7_UNORM
{ VK_FORMAT_BC7_UNORM_BLOCK,
{ DXGI_FORMAT_BC7_TYPELESS,
VK_FORMAT_BC7_UNORM_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
// DXGI_FORMAT_BC7_UNORM_SRGB
{ VK_FORMAT_BC7_SRGB_BLOCK,
{ DXGI_FORMAT_BC7_TYPELESS,
VK_FORMAT_BC7_SRGB_BLOCK,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT },
@ -518,7 +615,8 @@ namespace dxvk {
// DXGI_FORMAT_A8P8
{ }, // Unsupported
// DXGI_FORMAT_B4G4R4A4_UNORM
{ VK_FORMAT_B4G4R4A4_UNORM_PACK16,
{ DXGI_FORMAT_UNKNOWN,
VK_FORMAT_B4G4R4A4_UNORM_PACK16,
VK_FORMAT_UNDEFINED,
VK_FORMAT_UNDEFINED,
VK_IMAGE_ASPECT_COLOR_BIT, 0,
@ -533,34 +631,40 @@ namespace dxvk {
}};
const DXGI_VK_FORMAT_MAPPING* GetDXGIFormatMapping(
DXGI_FORMAT Format) {
const size_t formatId = size_t(Format);
return formatId < g_dxgiFormats.size()
? &g_dxgiFormats[formatId]
: &g_dxgiFormats[0];
}
DXGI_VK_FORMAT_INFO GetDXGIFormatInfo(
DXGI_FORMAT Format,
DXGI_VK_FORMAT_MODE Mode) {
const size_t formatId = size_t(Format);
const DXGI_VK_FORMAT_MAPPING& mapping
= formatId < g_dxgiFormats.size()
? g_dxgiFormats[formatId]
: g_dxgiFormats[0];
const DXGI_VK_FORMAT_MAPPING* mapping
= GetDXGIFormatMapping(Format);
switch (Mode) {
case DXGI_VK_FORMAT_MODE_ANY:
return mapping.FormatColor != VK_FORMAT_UNDEFINED
? DXGI_VK_FORMAT_INFO { mapping.FormatColor, mapping.AspectColor, mapping.Swizzle }
: DXGI_VK_FORMAT_INFO { mapping.FormatDepth, mapping.AspectDepth };
return mapping->FormatColor != VK_FORMAT_UNDEFINED
? DXGI_VK_FORMAT_INFO { mapping->FormatColor, mapping->AspectColor, mapping->Swizzle }
: DXGI_VK_FORMAT_INFO { mapping->FormatDepth, mapping->AspectDepth };
case DXGI_VK_FORMAT_MODE_COLOR:
return { mapping.FormatColor, mapping.AspectColor, mapping.Swizzle };
return { mapping->FormatColor, mapping->AspectColor, mapping->Swizzle };
case DXGI_VK_FORMAT_MODE_DEPTH:
return { mapping.FormatDepth, mapping.AspectDepth };
return { mapping->FormatDepth, mapping->AspectDepth };
case DXGI_VK_FORMAT_MODE_RAW:
return { mapping.FormatRaw, mapping.AspectColor };
return { mapping->FormatRaw, mapping->AspectColor };
}
Logger::err("DXGI: GetDXGIFormatInfo: Internal error");
return DXGI_VK_FORMAT_INFO();
}
};
}

View File

@ -12,12 +12,13 @@ namespace dxvk {
* Maps a DXGI format to a set of Vulkan formats.
*/
struct DXGI_VK_FORMAT_MAPPING {
VkFormat FormatColor = VK_FORMAT_UNDEFINED; ///< Corresponding color format
VkFormat FormatDepth = VK_FORMAT_UNDEFINED; ///< Corresponding depth format
VkFormat FormatRaw = VK_FORMAT_UNDEFINED; ///< Bit-compatible integer format
VkImageAspectFlags AspectColor = 0; ///< Defined aspects for the color format
VkImageAspectFlags AspectDepth = 0; ///< Defined aspects for the depth format
VkComponentMapping Swizzle = { ///< Color component swizzle
DXGI_FORMAT FormatFamily = DXGI_FORMAT_UNKNOWN; ///< Typeless format family
VkFormat FormatColor = VK_FORMAT_UNDEFINED; ///< Corresponding color format
VkFormat FormatDepth = VK_FORMAT_UNDEFINED; ///< Corresponding depth format
VkFormat FormatRaw = VK_FORMAT_UNDEFINED; ///< Bit-compatible integer format
VkImageAspectFlags AspectColor = 0; ///< Defined aspects for the color format
VkImageAspectFlags AspectDepth = 0; ///< Defined aspects for the depth format
VkComponentMapping Swizzle = { ///< Color component swizzle
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY };
};
@ -53,6 +54,15 @@ namespace dxvk {
DXGI_VK_FORMAT_MODE_RAW = 3, ///< Unsigned integer format
};
/**
* \brief Retrieves a format mapping entry
*
* \param [in] Format The format to look up
* \returns Pointer to the map entry
*/
const DXGI_VK_FORMAT_MAPPING* GetDXGIFormatMapping(
DXGI_FORMAT Format);
/**
* \brief Retrieves info for a given DXGI format
*

View File

@ -58,6 +58,19 @@ IDXGIVkAdapter : public IDXGIAdapter1 {
const VkPhysicalDeviceFeatures* pFeatures,
IDXGIVkDevice** ppDevice) = 0;
/**
* \brief Retrieves a format mapping entry for a DXGI format
*
* Returns the raw format mapping entry, which contains
* the corresponding Vulkan formats for color images,
* depth images, and raw image operations, as well as
* some generic info about the format.
* \param [in] Format The DXGI format
* \returns The format mapping entry
*/
virtual dxvk::DXGI_VK_FORMAT_MAPPING STDMETHODCALLTYPE GetFormatMapping(
DXGI_FORMAT Format) = 0;
/**
* \brief Maps a DXGI format to a compatible Vulkan format
*