vulkan_gpu.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #include <assert.h>
  5. #include <vulkan/vulkan.h>
  6. #include <vulkan/vulkan_core.h>
  7. typedef struct gpu_pipeline_impl {
  8. VkPipeline pipeline;
  9. VkPipelineLayout pipeline_layout;
  10. } gpu_pipeline_impl_t;
  11. typedef struct {
  12. char *source;
  13. int length;
  14. } gpu_shader_impl_t;
  15. typedef struct {
  16. VkImage image;
  17. VkDeviceMemory mem;
  18. VkImageView view;
  19. bool has_storage_bit;
  20. } gpu_texture_impl_t;
  21. typedef struct {
  22. VkBuffer buf;
  23. VkDeviceMemory mem;
  24. } gpu_buffer_impl_t;
  25. typedef struct {
  26. VkPipeline pipeline;
  27. VkPipelineLayout pipeline_layout;
  28. VkDescriptorSet descriptor_set;
  29. VkDescriptorSetLayout descriptor_set_layout;
  30. VkBuffer raygen_shader_binding_table;
  31. VkBuffer miss_shader_binding_table;
  32. VkBuffer hit_shader_binding_table;
  33. } gpu_raytrace_pipeline_impl_t;
  34. typedef struct {
  35. VkAccelerationStructureKHR top_level_acceleration_structure;
  36. VkAccelerationStructureKHR bottom_level_acceleration_structure[16];
  37. uint64_t top_level_acceleration_structure_handle;
  38. uint64_t bottom_level_acceleration_structure_handle[16];
  39. VkBuffer bottom_level_buffer[16];
  40. VkDeviceMemory bottom_level_mem[16];
  41. VkBuffer top_level_buffer;
  42. VkDeviceMemory top_level_mem;
  43. VkBuffer instances_buffer;
  44. VkDeviceMemory instances_mem;
  45. } gpu_raytrace_acceleration_structure_impl_t;