2025-02-26 13:24:16 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
#include <vulkan/vulkan_core.h>
|
|
|
|
|
|
2025-03-16 19:49:13 +01:00
|
|
|
typedef struct gpu_pipeline_impl {
|
2025-06-11 11:36:22 +02:00
|
|
|
VkPipeline pipeline;
|
2025-02-26 13:24:16 +01:00
|
|
|
VkPipelineLayout pipeline_layout;
|
2025-03-16 19:49:13 +01:00
|
|
|
} gpu_pipeline_impl_t;
|
2025-02-26 13:24:16 +01:00
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
char *source;
|
|
|
|
|
int length;
|
2025-03-16 19:49:13 +01:00
|
|
|
} gpu_shader_impl_t;
|
2025-02-26 13:24:16 +01:00
|
|
|
|
|
|
|
|
typedef struct {
|
2025-03-04 11:05:01 +01:00
|
|
|
VkImage image;
|
|
|
|
|
VkDeviceMemory mem;
|
|
|
|
|
VkImageView view;
|
2025-03-16 19:49:13 +01:00
|
|
|
} gpu_texture_impl_t;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
VkBuffer buf;
|
|
|
|
|
VkDeviceMemory mem;
|
2025-03-18 10:39:23 +01:00
|
|
|
VkMemoryAllocateInfo mem_alloc;
|
|
|
|
|
} gpu_buffer_impl_t;
|
2025-02-26 13:24:16 +01:00
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
VkPipeline pipeline;
|
|
|
|
|
VkPipelineLayout pipeline_layout;
|
|
|
|
|
VkDescriptorSet descriptor_set;
|
|
|
|
|
VkDescriptorSetLayout descriptor_set_layout;
|
|
|
|
|
VkBuffer raygen_shader_binding_table;
|
|
|
|
|
VkBuffer miss_shader_binding_table;
|
|
|
|
|
VkBuffer hit_shader_binding_table;
|
2025-03-16 19:49:13 +01:00
|
|
|
} gpu_raytrace_pipeline_impl_t;
|
2025-02-26 13:24:16 +01:00
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
VkAccelerationStructureKHR top_level_acceleration_structure;
|
|
|
|
|
VkAccelerationStructureKHR bottom_level_acceleration_structure[16];
|
|
|
|
|
uint64_t top_level_acceleration_structure_handle;
|
|
|
|
|
uint64_t bottom_level_acceleration_structure_handle[16];
|
|
|
|
|
|
|
|
|
|
VkBuffer bottom_level_buffer[16];
|
|
|
|
|
VkDeviceMemory bottom_level_mem[16];
|
|
|
|
|
VkBuffer top_level_buffer;
|
|
|
|
|
VkDeviceMemory top_level_mem;
|
|
|
|
|
VkBuffer instances_buffer;
|
|
|
|
|
VkDeviceMemory instances_mem;
|
2025-03-16 19:49:13 +01:00
|
|
|
} gpu_raytrace_acceleration_structure_impl_t;
|