a/d3d,a/vk: Add R32_SFLOAT formats

Co-authored-by: Catalin Slobodeanu <cslobodeanu@magicleap.com>
This commit is contained in:
Robbie Bridgewater 2022-09-16 14:27:15 -04:00 committed by Korcan Hussein
parent e4a40a6e4e
commit 3802e737bb
3 changed files with 14 additions and 7 deletions

View file

@ -35,6 +35,7 @@ d3d_vk_format_to_dxgi(int64_t format)
case VK_FORMAT_R16G16B16A16_UNORM: return DXGI_FORMAT_R16G16B16A16_UNORM;
case VK_FORMAT_R8G8B8A8_SRGB: return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
case VK_FORMAT_R8G8B8A8_UNORM: return DXGI_FORMAT_R8G8B8A8_UNORM; // Should not be used, colour precision.
case VK_FORMAT_R32_SFLOAT: return DXGI_FORMAT_R32_FLOAT;
case VK_FORMAT_X8_D24_UNORM_PACK32: /// @todo DXGI_FORMAT_D24_UNORM_S8_UINT ?
return (DXGI_FORMAT)0;
@ -73,6 +74,9 @@ d3d_dxgi_format_to_typeless_dxgi(DXGI_FORMAT format)
case DXGI_FORMAT_R8G8B8A8_UNORM: //
return DXGI_FORMAT_R8G8B8A8_TYPELESS;
case DXGI_FORMAT_R32_FLOAT: //
return DXGI_FORMAT_R32_TYPELESS;
default: return format;
}
}
@ -88,6 +92,7 @@ d3d_dxgi_format_to_vk(DXGI_FORMAT format)
case DXGI_FORMAT_R16G16B16A16_FLOAT: return VK_FORMAT_R16G16B16A16_SFLOAT;
case DXGI_FORMAT_R16G16B16A16_UNORM: return VK_FORMAT_R16G16B16A16_UNORM;
case DXGI_FORMAT_R16G16B16A16_SNORM: return VK_FORMAT_R16G16B16A16_SNORM;
case DXGI_FORMAT_R32_FLOAT: return VK_FORMAT_R32_SFLOAT;
case DXGI_FORMAT_D16_UNORM: return VK_FORMAT_D16_UNORM;
case DXGI_FORMAT_D32_FLOAT: return VK_FORMAT_D32_SFLOAT;
case DXGI_FORMAT_D24_UNORM_S8_UINT: return VK_FORMAT_D24_UNORM_S8_UINT;

View file

@ -1163,6 +1163,7 @@ vk_cb_get_buffer_external_handle_type(struct vk_bundle *vk);
THING_COLOR(R8G8B8_UNORM) /* OGL VK - Uncommon. Bad color precision. */ \
THING_COLOR(B8G8R8_UNORM) /* VK - Uncommon. Bad color precision. */ \
THING_COLOR(R5G6B5_UNORM_PACK16) /* OLG VK - Bad color precision. */ \
THING_COLOR(R32_SFLOAT) /* OGL VK */ \
/* depth formats */ \
THING_D(D32_SFLOAT) /* OGL VK */ \
THING_D(D16_UNORM) /* OGL VK */ \

View file

@ -14,9 +14,9 @@
static constexpr std::initializer_list<DXGI_FORMAT> colorFormats = {
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_R16G16B16A16_FLOAT,
DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R8G8B8A8_UNORM,
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_R16G16B16A16_FLOAT,
DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R32_FLOAT
};
static constexpr std::initializer_list<DXGI_FORMAT> depthStencilFormats = {
@ -26,10 +26,11 @@ static constexpr std::initializer_list<DXGI_FORMAT> depthStencilFormats = {
DXGI_FORMAT_D32_FLOAT,
};
static constexpr std::initializer_list<DXGI_FORMAT> formats = {
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_R16G16B16A16_FLOAT,
DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_D16_UNORM,
DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_D32_FLOAT_S8X24_UINT, DXGI_FORMAT_D32_FLOAT,
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_R16G16B16A16_FLOAT,
DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R32_FLOAT,
DXGI_FORMAT_D16_UNORM, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_D32_FLOAT_S8X24_UINT,
DXGI_FORMAT_D32_FLOAT,
};
static inline bool