Add check for 10 bit GPU image support
This commit is contained in:
@@ -328,6 +328,37 @@ std::array<encoder_settings, 3> get_encoder_settings(wivrn_vk_bundle & bundle, c
|
|||||||
if (std::ranges::contains(res, video_codec::h264, &encoder_settings::codec) or
|
if (std::ranges::contains(res, video_codec::h264, &encoder_settings::codec) or
|
||||||
std::ranges::contains(res, video_codec::raw, &encoder_settings::codec))
|
std::ranges::contains(res, video_codec::raw, &encoder_settings::codec))
|
||||||
bit_depth = 8;
|
bit_depth = 8;
|
||||||
|
else
|
||||||
|
bit_depth = 10;
|
||||||
|
|
||||||
|
auto check_format = [&](vk::Format format) {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
auto props = bundle.physical_device.getImageFormatProperties(
|
||||||
|
format,
|
||||||
|
vk::ImageType::e2D,
|
||||||
|
vk::ImageTiling::eOptimal,
|
||||||
|
vk::ImageUsageFlagBits::eStorage | vk::ImageUsageFlagBits::eTransferSrc);
|
||||||
|
return props.maxArrayLayers >= 3 and
|
||||||
|
props.maxExtent.depth >= 1 and
|
||||||
|
props.maxExtent.width >= width and
|
||||||
|
props.maxExtent.height >= height;
|
||||||
|
}
|
||||||
|
catch (vk::FormatNotSupportedError &)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (bit_depth == 10 and not check_format(vk::Format::eR10X6UnormPack16))
|
||||||
|
{
|
||||||
|
U_LOG_W("GPU does not have sufficient support for 10-bit images, reverting to 8");
|
||||||
|
bit_depth = 8;
|
||||||
|
}
|
||||||
|
if (bit_depth == 8 and not check_format(vk::Format::eR8Unorm))
|
||||||
|
{
|
||||||
|
U_LOG_W("GPU does not have sufficient support for 8-bit images");
|
||||||
|
}
|
||||||
|
|
||||||
for (auto & i: res)
|
for (auto & i: res)
|
||||||
i.bit_depth = bit_depth.value_or(10);
|
i.bit_depth = bit_depth.value_or(10);
|
||||||
|
|||||||
Reference in New Issue
Block a user