Skip to content

Commit

Permalink
vulkan: Disable exceptions for getImageFormatProperties and account f…
Browse files Browse the repository at this point in the history
…or errors. (#906)
  • Loading branch information
squidbus authored Sep 14, 2024
1 parent 1ea6db6 commit e30255e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/video_core/texture_cache/image.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#define VULKAN_HPP_NO_EXCEPTIONS
#include "common/assert.h"
#include "video_core/renderer_vulkan/liverpool_to_vk.h"
#include "video_core/renderer_vulkan/vk_instance.h"
Expand Down Expand Up @@ -150,6 +151,9 @@ Image::Image(const Vulkan::Instance& instance_, Vulkan::Scheduler& scheduler_,
const auto supported_format = instance->GetSupportedFormat(info.pixel_format);
const auto properties = instance->GetPhysicalDevice().getImageFormatProperties(
supported_format, info.type, tiling, usage, flags);
const auto supported_samples = properties.result == vk::Result::eSuccess
? properties.value.sampleCounts
: vk::SampleCountFlagBits::e1;

const vk::ImageCreateInfo image_ci = {
.flags = flags,
Expand All @@ -162,7 +166,7 @@ Image::Image(const Vulkan::Instance& instance_, Vulkan::Scheduler& scheduler_,
},
.mipLevels = static_cast<u32>(info.resources.levels),
.arrayLayers = static_cast<u32>(info.resources.layers),
.samples = LiverpoolToVK::NumSamples(info.num_samples, properties.sampleCounts),
.samples = LiverpoolToVK::NumSamples(info.num_samples, supported_samples),
.tiling = tiling,
.usage = usage,
.initialLayout = vk::ImageLayout::eUndefined,
Expand Down

0 comments on commit e30255e

Please sign in to comment.