vk: fix exception-escape failures (#8656)

And one drive-by fix to VulkanYcbcrConversionCache.h
This commit is contained in:
Powei Feng
2025-04-25 16:03:47 -07:00
committed by GitHub
parent 83967fdb1b
commit 39fabdbc3b
10 changed files with 17 additions and 15 deletions

View File

@@ -197,7 +197,7 @@ Dispatcher VulkanDriver::getDispatcher() const noexcept {
}
VulkanDriver::VulkanDriver(VulkanPlatform* platform, VulkanContext const& context,
Platform::DriverConfig const& driverConfig) noexcept
Platform::DriverConfig const& driverConfig)
: mPlatform(platform),
mResourceManager(driverConfig.handleArenaSize, driverConfig.disableHandleUseAfterFreeCheck,
driverConfig.disableHeapHandleTags),
@@ -250,7 +250,7 @@ VulkanDriver::~VulkanDriver() noexcept = default;
UTILS_NOINLINE
Driver* VulkanDriver::create(VulkanPlatform* platform, VulkanContext const& context,
Platform::DriverConfig const& driverConfig) noexcept {
Platform::DriverConfig const& driverConfig) {
#if 0
// this is useful for development, but too verbose even for debug builds
// For reference on a 64-bits machine in Release mode:

View File

@@ -55,7 +55,7 @@ constexpr uint8_t MAX_RENDERTARGET_ATTACHMENT_TEXTURES =
class VulkanDriver final : public DriverBase {
public:
static Driver* create(VulkanPlatform* platform, VulkanContext const& context,
Platform::DriverConfig const& driverConfig) noexcept;
Platform::DriverConfig const& driverConfig);
#if FVK_ENABLED(FVK_DEBUG_DEBUG_UTILS)
// Encapsulates the VK_EXT_debug_utils extension. In particular, we use
@@ -90,8 +90,8 @@ private:
void debugCommandBegin(CommandStream* cmds, bool synchronous,
const char* methodName) noexcept override;
inline VulkanDriver(VulkanPlatform* platform, VulkanContext const& context,
Platform::DriverConfig const& driverConfig) noexcept;
VulkanDriver(VulkanPlatform* platform, VulkanContext const& context,
Platform::DriverConfig const& driverConfig);
~VulkanDriver() noexcept override;

View File

@@ -160,7 +160,7 @@ VulkanDescriptorSetLayout::Bitmask VulkanDescriptorSetLayout::Bitmask::fromLayou
return fromBackendLayout(layout);
}
PushConstantDescription::PushConstantDescription(backend::Program const& program) noexcept {
PushConstantDescription::PushConstantDescription(backend::Program const& program) {
mRangeCount = 0;
for (auto stage : { ShaderStage::VERTEX, ShaderStage::FRAGMENT, ShaderStage::COMPUTE }) {
auto const& constants = program.getPushConstants(stage);

View File

@@ -165,6 +165,7 @@ public:
mVkSet(vkSet),
mOnRecycleFn(std::move(onRecycleFn)) {}
// NOLINTNEXTLINE(bugprone-exception-escape)
~VulkanDescriptorSet() {
if (mOnRecycleFn) {
mOnRecycleFn(this);
@@ -182,7 +183,7 @@ public:
return mExternalSamplerVkSet;
}
void setExternalSamplerVkSet(VkDescriptorSet vkset, OnRecycle onRecycle) noexcept {
void setExternalSamplerVkSet(VkDescriptorSet vkset, OnRecycle onRecycle) {
mExternalSamplerVkSet = vkset;
if (mOnRecycleExternalSamplerFn) {
mOnRecycleExternalSamplerFn(this);
@@ -218,7 +219,7 @@ using PushConstantNameArray = utils::FixedCapacityVector<char const*>;
using PushConstantNameByStage = std::array<PushConstantNameArray, Program::SHADER_TYPE_COUNT>;
struct PushConstantDescription {
explicit PushConstantDescription(backend::Program const& program) noexcept;
explicit PushConstantDescription(backend::Program const& program);
VkPushConstantRange const* getVkRanges() const noexcept { return mRanges; }
uint32_t getVkRangeCount() const noexcept { return mRangeCount; }

View File

@@ -335,7 +335,7 @@ void VulkanReadPixels::run(fvkmemory::resource_ptr<VulkanRenderTarget> srcTarget
mTaskHandler->post(std::move(waitFenceFunc), std::move(cleanPbdFunc));
}
void VulkanReadPixels::runUntilComplete() noexcept {
void VulkanReadPixels::runUntilComplete() {
if (!mTaskHandler) {
return;
}

View File

@@ -79,7 +79,7 @@ public:
OnReadCompleteFunction const& readCompleteFunc);
// This method will block until all of the in-flight requests are complete.
void runUntilComplete() noexcept;
void runUntilComplete();
private:
VkDevice mDevice = VK_NULL_HANDLE;

View File

@@ -28,7 +28,7 @@ namespace filament::backend {
VulkanSamplerCache::VulkanSamplerCache(VkDevice device)
: mDevice(device) {}
VkSampler VulkanSamplerCache::getSampler(Params params) noexcept {
VkSampler VulkanSamplerCache::getSampler(Params params) {
auto iter = mCache.find(params);
if (UTILS_LIKELY(iter != mCache.end())) {
return iter->second;

View File

@@ -38,7 +38,7 @@ public:
static_assert(sizeof(Params) == 16);
explicit VulkanSamplerCache(VkDevice device);
VkSampler getSampler(Params params) noexcept;
VkSampler getSampler(Params params);
void terminate() noexcept;
private:
VkDevice mDevice;

View File

@@ -33,7 +33,7 @@ VulkanYcbcrConversionCache::VulkanYcbcrConversionCache(VkDevice device)
: mDevice(device) {}
VkSamplerYcbcrConversion VulkanYcbcrConversionCache::getConversion(
VulkanYcbcrConversionCache::Params params) noexcept {
VulkanYcbcrConversionCache::Params params) {
auto iter = mCache.find(params);
if (UTILS_LIKELY(iter != mCache.end())) {
return iter->second;

View File

@@ -37,7 +37,7 @@ public:
static_assert(sizeof(Params) == 16);
explicit VulkanYcbcrConversionCache(VkDevice device);
VkSamplerYcbcrConversion getConversion(Params params) noexcept;
VkSamplerYcbcrConversion getConversion(Params params);
void terminate() noexcept;
private:
@@ -47,7 +47,8 @@ private:
bool operator()(Params lhs, Params rhs) const noexcept {
SamplerYcbcrConversion::EqualTo equal;
return equal(lhs.conversion, rhs.conversion) &&
lhs.externalFormat == rhs.externalFormat;
lhs.externalFormat == rhs.externalFormat &&
lhs.format == rhs.format;
}
};
using ConversionHashFn = utils::hash::MurmurHashFn<Params>;