2026-01-27 22:34:24 +01:00
|
|
|
/*
|
|
|
|
|
Crafter®.Graphics
|
|
|
|
|
Copyright (C) 2026 Catcrafts®
|
|
|
|
|
catcrafts.net
|
|
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
License version 3.0 as published by the Free Software Foundation;
|
|
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
module;
|
|
|
|
|
#ifdef CRAFTER_GRAPHICS_VULKAN
|
|
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
#include <vulkan/vulkan_wayland.h>
|
|
|
|
|
#endif
|
|
|
|
|
export module Crafter.Graphics:VulkanDevice;
|
|
|
|
|
#ifdef CRAFTER_GRAPHICS_VULKAN
|
|
|
|
|
import std;
|
|
|
|
|
|
|
|
|
|
export namespace Crafter {
|
|
|
|
|
class VulkanDevice {
|
|
|
|
|
public:
|
|
|
|
|
inline static VkInstance instance = VK_NULL_HANDLE;
|
|
|
|
|
inline static VkDebugUtilsMessengerEXT debugMessenger = VK_NULL_HANDLE;
|
|
|
|
|
inline static VkPhysicalDevice physDevice = VK_NULL_HANDLE;
|
|
|
|
|
inline static VkDevice device = VK_NULL_HANDLE;
|
|
|
|
|
inline static std::uint32_t queueFamilyIndex = 0;
|
|
|
|
|
inline static VkQueue queue = VK_NULL_HANDLE;
|
|
|
|
|
inline static VkCommandPool commandPool = VK_NULL_HANDLE;
|
|
|
|
|
inline static VkSwapchainKHR swapchain = VK_NULL_HANDLE;
|
|
|
|
|
inline static PFN_vkCmdDrawMeshTasksEXT vkCmdDrawMeshTasksEXTProc;
|
|
|
|
|
inline static PFN_vkCmdBeginRenderingKHR vkCmdBeginRenderingKHRProc;
|
|
|
|
|
inline static PFN_vkCmdEndRenderingKHR vkCmdEndRenderingKHRProc;
|
2026-01-28 01:07:41 +01:00
|
|
|
inline static PFN_vkGetAccelerationStructureBuildSizesKHR vkGetAccelerationStructureBuildSizesKHR;
|
|
|
|
|
inline static PFN_vkCreateAccelerationStructureKHR vkCreateAccelerationStructureKHR;
|
|
|
|
|
inline static PFN_vkCmdBuildAccelerationStructuresKHR vkCmdBuildAccelerationStructuresKHR;
|
2026-01-28 18:51:11 +01:00
|
|
|
inline static PFN_vkGetAccelerationStructureDeviceAddressKHR vkGetAccelerationStructureDeviceAddressKHR;
|
2026-01-29 00:45:02 +01:00
|
|
|
inline static PFN_vkCreateRayTracingPipelinesKHR vkCreateRayTracingPipelinesKHR;
|
2026-01-29 01:31:17 +01:00
|
|
|
inline static PFN_vkGetRayTracingShaderGroupHandlesKHR vkGetRayTracingShaderGroupHandlesKHR;
|
2026-01-29 02:05:18 +01:00
|
|
|
inline static PFN_vkCmdTraceRaysKHR vkCmdTraceRaysKHR;
|
2026-01-27 22:34:24 +01:00
|
|
|
inline static VkPhysicalDeviceMemoryProperties memoryProperties;
|
2026-01-29 01:31:17 +01:00
|
|
|
inline static VkPhysicalDeviceRayTracingPipelinePropertiesKHR rayTracingProperties = {
|
|
|
|
|
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR
|
|
|
|
|
};
|
2026-01-27 22:34:24 +01:00
|
|
|
static void CreateDevice();
|
|
|
|
|
static void CheckVkResult(VkResult result);
|
|
|
|
|
static std::uint32_t GetMemoryType(std::uint32_t typeBits, VkMemoryPropertyFlags properties);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|