vulkan not working

This commit is contained in:
Jorijn van der Graaf 2025-04-19 15:46:26 +02:00
commit c45afab0dd
21 changed files with 1319 additions and 438 deletions

View file

@ -0,0 +1,45 @@
module;
#include <cstdint>
#include <string>
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_wayland.h>
#include <vector>
#include <thread>
export module Crafter.Graphics:WindowWaylandVulkan;
import Crafter.Event;
import :WindowWayland;
import Crafter.Component;
namespace Crafter {
struct SwapchainElement
{
VkCommandBuffer commandBuffer;
VkImage image;
VkImageView imageView;
VkFramebuffer framebuffer;
VkSemaphore startSemaphore;
VkSemaphore endSemaphore;
VkFence fence;
VkFence lastFence;
};
export class WindowWaylandVulkan : public WindowWayland {
public:
WindowWaylandVulkan(std::string name, std::uint32_t width, std::uint32_t height);
void Start();
inline static VkRenderPass renderPass = VK_NULL_HANDLE;
private:
void CreateSwapchain();
void DestroySwapchain();
VkSurfaceKHR vulkanSurface = VK_NULL_HANDLE;
VkSwapchainKHR swapchain = VK_NULL_HANDLE;
std::vector<SwapchainElement> swapchainElements;
std::uint32_t imageCount;
std::uint32_t currentFrame = 0;
std::uint32_t imageIndex = 0;
VkFormat format = VK_FORMAT_UNDEFINED;
std::thread thread;
};
}