[vk] Check for BGRA8 linear image to support blitting

This commit is contained in:
Dzmitry Malyshau 2018-09-06 15:39:45 -04:00 committed by kd-11
parent b454dde871
commit 4e09573937
3 changed files with 12 additions and 2 deletions

View File

@ -24,6 +24,10 @@ namespace vk
if (g_cfg.video.force_high_precision_z_buffer && result.d32_sfloat_s8)
result.d24_unorm_s8 = false;
// Checks if BGRA8 images can be used for blitting
vkGetPhysicalDeviceFormatProperties(dev, VK_FORMAT_B8G8R8A8_UNORM, &props);
result.bgra8_linear = !!(props.linearTilingFeatures & VK_FORMAT_FEATURE_BLIT_SRC_BIT);
return result;
}

View File

@ -185,6 +185,7 @@ namespace vk
{
bool d24_unorm_s8;
bool d32_sfloat_s8;
bool bgra8_linear;
};
// Memory Allocator - base class

View File

@ -1043,6 +1043,11 @@ namespace vk
vk::image *upload_image_simple(vk::command_buffer& cmd, u32 address, u32 width, u32 height)
{
if (!m_formats_support.bgra8_linear)
{
return nullptr;
}
// Uploads a linear memory range as a BGRA8 texture
auto image = std::make_unique<vk::image>(*m_device, m_memory_types.host_visible_coherent,
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT,