Implement vulkan backend

This commit is contained in:
2026-07-05 22:11:05 +01:00
parent a073dec6a0
commit 5a26bf54c8
5 changed files with 2045 additions and 2 deletions
+21 -2
View File
@@ -3,9 +3,28 @@
default: build default: build
# Build the project CC := "clang"
CXX := "clang++"
VK_FLAGS := "-DVK_NO_PROTOTYPES -I$VULKAN_SDK/include -I$VULKAN_SDK/include/vma"
BUILDDIR := "build"
# Build the project (object files only — no entry point yet)
build: build:
@echo "TODO: implement build" mkdir -p {{BUILDDIR}}
{{CXX}} -g -c -Wno-nullability-completeness {{VK_FLAGS}} \
src/prism/rhi/vulkan/profiles/vulkan_profiles.cpp \
-o {{BUILDDIR}}/vulkan_profiles.o
{{CXX}} -g -c -Wno-nullability-completeness {{VK_FLAGS}} \
src/prism/rhi/vulkan/pr_rhi_vk_vma.cpp \
-o {{BUILDDIR}}/pr_rhi_vk_vma.o
{{CC}} -g -c {{VK_FLAGS}} $VULKAN_SDK/include/volk/volk.c -o {{BUILDDIR}}/volk.o
{{CC}} -g -c {{VK_FLAGS}} src/prism/rhi/vulkan/pr_rhi_vk.c -o {{BUILDDIR}}/pr_rhi_vk.o
{{CC}} -g -c src/wapp/wapp.c -o {{BUILDDIR}}/wapp.o
@echo "--- build done (objects in {{BUILDDIR}}/) ---"
# Clean object files
clean:
rm -rf {{BUILDDIR}}
# Run linter / typecheck # Run linter / typecheck
lint: lint:
File diff suppressed because it is too large Load Diff
+7
View File
@@ -27,6 +27,8 @@ struct PrRhiDevice {
void *handle; // VkDevice void *handle; // VkDevice
void *queue; // VkQueue void *queue; // VkQueue
u32 queue_family_index; u32 queue_family_index;
u32 present_mode; // VkPresentModeKHR
void *physical_device; // VkPhysicalDevice
void *allocator; // VmaAllocator void *allocator; // VmaAllocator
}; };
@@ -37,12 +39,14 @@ struct PrRhiSurface {
struct PrRhiSwapchain { struct PrRhiSwapchain {
PrRhiDevice *device; PrRhiDevice *device;
void *handle; // VkSwapchainKHR void *handle; // VkSwapchainKHR
void *surface; // PrRhiSurface *
u32 image_count; u32 image_count;
PrRhiTexture **images; PrRhiTexture **images;
PrRhiTexture *depth; PrRhiTexture *depth;
u32 format; // VkFormat u32 format; // VkFormat
u32 width; u32 width;
u32 height; u32 height;
u32 current_image_index;
}; };
struct PrRhiBuffer { struct PrRhiBuffer {
@@ -57,6 +61,9 @@ struct PrRhiTexture {
void *image; // VkImage void *image; // VkImage
void *view; // VkImageView void *view; // VkImageView
void *allocation; // VmaAllocation void *allocation; // VmaAllocation
u32 width;
u32 height;
u32 format; // VkFormat
}; };
struct PrRhiSampler { struct PrRhiSampler {
+1
View File
@@ -12,6 +12,7 @@
#define prRhiGetPhysicalDeviceDriverInfo prRhiGetPhysicalDeviceDriverInfoVk #define prRhiGetPhysicalDeviceDriverInfo prRhiGetPhysicalDeviceDriverInfoVk
#define prRhiCreateSurface prRhiCreateSurfaceVk #define prRhiCreateSurface prRhiCreateSurfaceVk
#define prRhiDestroySurface prRhiDestroySurfaceVk #define prRhiDestroySurface prRhiDestroySurfaceVk
#define prRhiGetSurfaceCapabilities prRhiGetSurfaceCapabilitiesVk
#define prRhiCreateDevice prRhiCreateDeviceVk #define prRhiCreateDevice prRhiCreateDeviceVk
#define prRhiDestroyDevice prRhiDestroyDeviceVk #define prRhiDestroyDevice prRhiDestroyDeviceVk
#define prRhiDeviceWaitIdle prRhiDeviceWaitIdleVk #define prRhiDeviceWaitIdle prRhiDeviceWaitIdleVk
+2
View File
@@ -0,0 +1,2 @@
#define VMA_IMPLEMENTATION
#include <vk_mem_alloc.h>