Skip to content

Commit

Permalink
Update vulkan headers to 1.4+ (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishan09811 authored Dec 23, 2024
1 parent 544a0e2 commit 3ff78af
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: CI

on:
workflow_dispatch:
push:
pull_request:
types: [opened, synchronize, reopened, labeled]
Expand Down
2 changes: 1 addition & 1 deletion app/libraries/vkhpp
Submodule vkhpp updated 348 files
2 changes: 1 addition & 1 deletion app/src/main/cpp/skyline/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ namespace skyline::gpu {
static vk::raii::DebugReportCallbackEXT CreateDebugReportCallback(GPU *gpu, const vk::raii::Instance &instance) {
return vk::raii::DebugReportCallbackEXT(instance, vk::DebugReportCallbackCreateInfoEXT{
.flags = vk::DebugReportFlagBitsEXT::eError | vk::DebugReportFlagBitsEXT::eWarning | vk::DebugReportFlagBitsEXT::ePerformanceWarning | vk::DebugReportFlagBitsEXT::eInformation | vk::DebugReportFlagBitsEXT::eDebug,
.pfnCallback = reinterpret_cast<PFN_vkDebugReportCallbackEXT>(&DebugCallback),
.pfnCallback = reinterpret_cast<vk::PFN_DebugReportCallbackEXT>(&DebugCallback),
.pUserData = gpu,
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/skyline/gpu/command_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace skyline::gpu {

auto result{(*gpu.vkDevice).allocateCommandBuffers(&commandBufferAllocateInfo, &commandBuffer, *gpu.vkDevice.getDispatcher())};
if (result != vk::Result::eSuccess)
vk::throwResultException(result, __builtin_FUNCTION());
vk::detail::throwResultException(result, __builtin_FUNCTION());
return {pool->buffers.emplace_back(gpu.vkDevice, commandBuffer, pool->vkCommandPool)};
}

Expand Down
10 changes: 5 additions & 5 deletions app/src/main/cpp/skyline/gpu/descriptor_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ namespace skyline::gpu {
if (pool->freeSetCount > 0)
pool->freeSetCount--;

return vk::createResultValue(result, descriptorSet, __builtin_FUNCTION(), {
vk::Result::eSuccess,
vk::Result::eErrorOutOfPoolMemory,
vk::Result::eErrorFragmentedPool
});
if (result == vk::Result::eSuccess) {
return vk::ResultValue<vk::DescriptorSet>(vk::Result::eSuccess, descriptorSet);
} else {
return vk::ResultValue<vk::DescriptorSet>(result, vk::DescriptorSet{});
}
}

DescriptorAllocator::ActiveDescriptorSet::ActiveDescriptorSet(std::shared_ptr<DescriptorPool> pPool, DescriptorSetSlot *slot) : pool{std::move(pPool)}, slot{slot} {}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/cpp/skyline/gpu/descriptor_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <vulkan/vulkan_raii.hpp>
#include <common/spin_lock.h>
#include "vk_descriptor_set_layout_hash.hpp"
#include <common.h>

namespace skyline::gpu {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/skyline/gpu/memory_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace skyline::gpu::memory {
*/
void ThrowOnFail(VkResult result, const char *function = __builtin_FUNCTION()) {
if (result != VK_SUCCESS)
vk::throwResultException(vk::Result(result), function);
vk::detail::throwResultException(vk::Result(result), function);
}

Buffer::~Buffer() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/cpp/skyline/gpu/memory_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace skyline::gpu::memory {

Buffer(const Buffer &) = delete;

constexpr Buffer(Buffer &&other)
Buffer(Buffer &&other)
: vmaAllocator(std::exchange(other.vmaAllocator, nullptr)),
vmaAllocation(std::exchange(other.vmaAllocation, nullptr)),
vkBuffer(std::exchange(other.vkBuffer, {})),
Expand Down Expand Up @@ -94,7 +94,7 @@ namespace skyline::gpu::memory {

Image(const Image &) = delete;

constexpr Image(Image &&other)
Image(Image &&other)
: pointer(std::exchange(other.pointer, nullptr)),
vmaAllocator(std::exchange(other.vmaAllocator, nullptr)),
vmaAllocation(std::exchange(other.vmaAllocation, nullptr)),
Expand Down
1 change: 1 addition & 0 deletions app/src/main/cpp/skyline/gpu/texture/texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "common/trap_manager.h"
#include <gpu/tag_allocator.h>
#include <gpu/memory_manager.h>
#include <vulkan/vulkan_format_traits.hpp>
#include <gpu/usage_tracker.h>

namespace skyline::gpu {
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/cpp/skyline/gpu/vk_descriptor_set_layout_hash.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef VK_DESCRIPTOR_SET_LAYOUT_HASH_HPP
#define VK_DESCRIPTOR_SET_LAYOUT_HASH_HPP

#include <vulkan/vulkan.hpp>
#include <unordered_map>

// Specialization of std::hash for vk::DescriptorSetLayout
namespace std {
template <>
struct hash<vk::DescriptorSetLayout> {
std::size_t operator()(const vk::DescriptorSetLayout &layout) const noexcept {
// Use the raw Vulkan handle for hashing
return std::hash<VkDescriptorSetLayout>()(static_cast<VkDescriptorSetLayout>(layout));
}
};
}

#endif // VK_DESCRIPTOR_SET_LAYOUT_HASH_HPP

0 comments on commit 3ff78af

Please sign in to comment.