Implement vulkan backend
This commit is contained in:
@@ -3,9 +3,28 @@
|
||||
|
||||
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:
|
||||
@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
|
||||
lint:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,8 @@ struct PrRhiDevice {
|
||||
void *handle; // VkDevice
|
||||
void *queue; // VkQueue
|
||||
u32 queue_family_index;
|
||||
u32 present_mode; // VkPresentModeKHR
|
||||
void *physical_device; // VkPhysicalDevice
|
||||
void *allocator; // VmaAllocator
|
||||
};
|
||||
|
||||
@@ -37,12 +39,14 @@ struct PrRhiSurface {
|
||||
struct PrRhiSwapchain {
|
||||
PrRhiDevice *device;
|
||||
void *handle; // VkSwapchainKHR
|
||||
void *surface; // PrRhiSurface *
|
||||
u32 image_count;
|
||||
PrRhiTexture **images;
|
||||
PrRhiTexture *depth;
|
||||
u32 format; // VkFormat
|
||||
u32 width;
|
||||
u32 height;
|
||||
u32 current_image_index;
|
||||
};
|
||||
|
||||
struct PrRhiBuffer {
|
||||
@@ -57,6 +61,9 @@ struct PrRhiTexture {
|
||||
void *image; // VkImage
|
||||
void *view; // VkImageView
|
||||
void *allocation; // VmaAllocation
|
||||
u32 width;
|
||||
u32 height;
|
||||
u32 format; // VkFormat
|
||||
};
|
||||
|
||||
struct PrRhiSampler {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#define prRhiGetPhysicalDeviceDriverInfo prRhiGetPhysicalDeviceDriverInfoVk
|
||||
#define prRhiCreateSurface prRhiCreateSurfaceVk
|
||||
#define prRhiDestroySurface prRhiDestroySurfaceVk
|
||||
#define prRhiGetSurfaceCapabilities prRhiGetSurfaceCapabilitiesVk
|
||||
#define prRhiCreateDevice prRhiCreateDeviceVk
|
||||
#define prRhiDestroyDevice prRhiDestroyDeviceVk
|
||||
#define prRhiDeviceWaitIdle prRhiDeviceWaitIdleVk
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
#define VMA_IMPLEMENTATION
|
||||
#include <vk_mem_alloc.h>
|
||||
Reference in New Issue
Block a user