Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vulkan: Disable exceptions for getImageFormatProperties and account for errors. #906

Merged
merged 1 commit into from
Sep 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading