libs/vkd3d: Set VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT only for typeless formats.

This commit is contained in:
Józef Kucia 2017-08-15 13:10:05 +02:00
parent 26edc3c545
commit dc081f6f9e
3 changed files with 37 additions and 2 deletions

View File

@ -116,8 +116,9 @@ static HRESULT vkd3d_create_image(struct d3d12_resource *resource, struct d3d12_
image_info.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
image_info.pNext = NULL;
/* FIXME: Use mutable formats only for typeless formats. */
image_info.flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
image_info.flags = 0;
if (dxgi_format_is_typeless(desc->Format))
image_info.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
if (desc->Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D && desc->Width == desc->Height)
image_info.flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;

View File

@ -86,6 +86,38 @@ VkFormat vkd3d_get_vk_format(DXGI_FORMAT format)
return vkd3d_format->vk_format;
}
bool dxgi_format_is_typeless(DXGI_FORMAT dxgi_format)
{
switch (dxgi_format)
{
case DXGI_FORMAT_R32G32B32A32_TYPELESS:
case DXGI_FORMAT_R32G32B32_TYPELESS:
case DXGI_FORMAT_R16G16B16A16_TYPELESS:
case DXGI_FORMAT_R32G32_TYPELESS:
case DXGI_FORMAT_R32G8X24_TYPELESS:
case DXGI_FORMAT_R10G10B10A2_TYPELESS:
case DXGI_FORMAT_R8G8B8A8_TYPELESS:
case DXGI_FORMAT_R16G16_TYPELESS:
case DXGI_FORMAT_R32_TYPELESS:
case DXGI_FORMAT_R24G8_TYPELESS:
case DXGI_FORMAT_R8G8_TYPELESS:
case DXGI_FORMAT_R16_TYPELESS:
case DXGI_FORMAT_R8_TYPELESS:
case DXGI_FORMAT_BC1_TYPELESS:
case DXGI_FORMAT_BC2_TYPELESS:
case DXGI_FORMAT_BC3_TYPELESS:
case DXGI_FORMAT_BC4_TYPELESS:
case DXGI_FORMAT_BC5_TYPELESS:
case DXGI_FORMAT_B8G8R8A8_TYPELESS:
case DXGI_FORMAT_B8G8R8X8_TYPELESS:
case DXGI_FORMAT_BC6H_TYPELESS:
case DXGI_FORMAT_BC7_TYPELESS:
return true;
default:
return false;
}
}
bool is_valid_feature_level(D3D_FEATURE_LEVEL feature_level)
{
static const D3D_FEATURE_LEVEL valid_feature_levels[] =

View File

@ -545,6 +545,8 @@ static inline bool vkd3d_format_is_compressed(const struct vkd3d_format *format)
const struct vkd3d_format *vkd3d_get_format(DXGI_FORMAT dxgi_format) DECLSPEC_HIDDEN;
bool dxgi_format_is_typeless(DXGI_FORMAT dxgi_format) DECLSPEC_HIDDEN;
enum VkCompareOp vk_compare_op_from_d3d12(D3D12_COMPARISON_FUNC op) DECLSPEC_HIDDEN;
bool is_valid_feature_level(D3D_FEATURE_LEVEL feature_level) DECLSPEC_HIDDEN;