Kohi Game Engine
vulkan_types.h
Go to the documentation of this file.
1 
13 #pragma once
14 
15 #include <vulkan/vulkan.h>
16 
17 #include "containers/freelist.h"
18 #include "containers/hashtable.h"
19 #include "core/asserts.h"
20 #include "defines.h"
22 
27 #define VK_CHECK(expr) \
28  { \
29  KASSERT(expr == VK_SUCCESS); \
30  }
31 
32 struct vulkan_context;
33 
38 typedef struct vulkan_buffer {
40  VkBuffer handle;
42  VkBufferUsageFlagBits usage;
46  VkDeviceMemory memory;
48  VkMemoryRequirements memory_requirements;
54 
58  VkSurfaceCapabilitiesKHR capabilities;
62  VkSurfaceFormatKHR* formats;
66  VkPresentModeKHR* present_modes;
68 
71 
74 
83 
86 
92 typedef struct vulkan_device {
95 
98 
101 
103  VkPhysicalDevice physical_device;
105  VkDevice logical_device;
108 
117 
119  VkQueue graphics_queue;
121  VkQueue present_queue;
123  VkQueue transfer_queue;
124 
126  VkCommandPool graphics_command_pool;
127 
129  VkPhysicalDeviceProperties properties;
131  VkPhysicalDeviceFeatures features;
133  VkPhysicalDeviceMemoryProperties memory;
134 
136  VkFormat depth_format;
139 
143 
149 typedef struct vulkan_image {
151  VkImage handle;
153  VkDeviceMemory memory;
155  VkImageView view;
157  VkMemoryRequirements memory_requirements;
159  VkMemoryPropertyFlags memory_flags;
161  VkFormat format;
167  char* name;
171 
187 
191 typedef struct vulkan_renderpass {
193  VkRenderPass handle;
200 
204 
208 typedef struct vulkan_swapchain {
210  VkSurfaceFormatKHR image_format;
216 
219 
221  VkSwapchainKHR handle;
226 
229 
236 
255 
261 typedef struct vulkan_command_buffer {
263  VkCommandBuffer handle;
264 
268 
272 typedef struct vulkan_shader_stage {
274  VkShaderModuleCreateInfo create_info;
276  VkShaderModule handle;
278  VkPipelineShaderStageCreateInfo shader_stage_create_info;
280 
281 typedef enum vulkan_topology_class {
287 
291 typedef struct vulkan_pipeline_config {
293  char* name;
301  VkVertexInputAttributeDescription* attributes;
305  VkDescriptorSetLayout* descriptor_set_layouts;
309  VkPipelineShaderStageCreateInfo* stages;
311  VkViewport viewport;
313  VkRect2D scissor;
327 
331 typedef struct vulkan_pipeline {
333  VkPipeline handle;
335  VkPipelineLayout pipeline_layout;
339 
344 #define VULKAN_MAX_MATERIAL_COUNT 1024
345 
350 #define VULKAN_MAX_GEOMETRY_COUNT 4096
351 
356 typedef struct vulkan_geometry_data {
361 
364 
368 
373 #define VULKAN_MAX_UI_COUNT 1024
374 
382 #define VULKAN_SHADER_MAX_STAGES 8
384 #define VULKAN_SHADER_MAX_GLOBAL_TEXTURES 31
386 #define VULKAN_SHADER_MAX_INSTANCE_TEXTURES 31
388 #define VULKAN_SHADER_MAX_ATTRIBUTES 16
394 #define VULKAN_SHADER_MAX_UNIFORMS 128
395 
397 #define VULKAN_SHADER_MAX_BINDINGS 2
399 #define VULKAN_SHADER_MAX_PUSH_CONST_RANGES 32
400 
406  VkShaderStageFlagBits stage;
408  char file_name[255];
409 
411 
419  VkDescriptorSetLayoutBinding bindings[VULKAN_SHADER_MAX_BINDINGS];
423 
425 typedef struct vulkan_shader_config {
431  VkDescriptorPoolSize pool_sizes[2];
437 
445 
447  VkVertexInputAttributeDescription attributes[VULKAN_SHADER_MAX_ATTRIBUTES];
448 
451 
453 
459 typedef struct vulkan_descriptor_state {
463  u32 ids[3];
465 
473  VkDescriptorSet descriptor_sets[3];
474 
478 
487 
490 
497 
503 typedef struct vulkan_shader {
506 
509 
512 
515 
518 
520  VkDescriptorPool descriptor_pool;
521 
523  VkDescriptorSetLayout descriptor_set_layouts[2];
525  VkDescriptorSet global_descriptor_sets[3];
528 
531 
534 
538  VkPrimitiveTopology current_topology;
539 
543 
554 
556 
557 // Forward declare shaderc compiler.
558 struct shaderc_compiler;
559 
564 typedef struct vulkan_context {
567 
570 
573 
576 
579 
582 
585 
588 
591 
593  VkInstance instance;
595  VkAllocationCallbacks* allocator;
597  VkSurfaceKHR surface;
598 
599 #if defined(_DEBUG)
601  VkDebugUtilsMessengerEXT debug_messenger;
602 
604  PFN_vkSetDebugUtilsObjectNameEXT pfnSetDebugUtilsObjectNameEXT;
605 
607  PFN_vkSetDebugUtilsObjectTagEXT pfnSetDebugUtilsObjectTagEXT;
608 
609  PFN_vkCmdBeginDebugUtilsLabelEXT pfnCmdBeginDebugUtilsLabelEXT;
610  PFN_vkCmdEndDebugUtilsLabelEXT pfnCmdEndDebugUtilsLabelEXT;
611 #endif
612 
615 
618 
623 
626 
629 
632 
636  VkFence in_flight_fences[2];
637 
640 
643 
646 
648 
651 
654 
657 
665  i32 (*find_memory_index)(struct vulkan_context* context, u32 type_filter, u32 property_flags);
666 
667  PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT;
668  PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT;
669 
672 
675 
679  struct shaderc_compiler* shader_compiler;
This file contains assertion functions to be used throughout the codebase.
This file contains global type definitions which are used throughout the entire engine and applicatio...
unsigned int u32
Unsigned 32-bit integer.
Definition: defines.h:25
_Bool b8
8-bit boolean type
Definition: defines.h:58
float f32
32-bit floating point number
Definition: defines.h:47
signed int i32
Signed 32-bit integer.
Definition: defines.h:39
unsigned short u16
Unsigned 16-bit integer.
Definition: defines.h:22
unsigned long long u64
Unsigned 64-bit integer.
Definition: defines.h:28
unsigned char u8
Unsigned 8-bit integer.
Definition: defines.h:19
This file contains a free list, used for custom memory allocation tracking.
This file contains the hashtable implementation.
u32 renderer_config_flags
Definition: renderer_types.h:200
renderer_winding
The winding order of vertices, used to determine what is the front-face of a triangle.
Definition: renderer_types.h:211
face_cull_mode
Determines face culling mode during rendering.
Definition: resource_types.h:108
A range, typically of memory.
Definition: defines.h:61
Represents a render target, which is used for rendering to a texture or set of textures.
Definition: renderer_types.h:80
Definition: renderer_types.h:172
Represents a shader on the frontend.
Definition: shader_system.h:91
A structure which maps a texture, use and other properties.
Definition: resource_types.h:208
Represents a texture.
Definition: resource_types.h:165
Represents a Vulkan-specific buffer. Used to load data onto the GPU.
Definition: vulkan_types.h:38
VkMemoryRequirements memory_requirements
The memory requirements for this buffer.
Definition: vulkan_types.h:48
VkBufferUsageFlagBits usage
The usage flags.
Definition: vulkan_types.h:42
VkBuffer handle
The handle to the internal buffer.
Definition: vulkan_types.h:40
b8 is_locked
Indicates if the buffer's memory is currently locked.
Definition: vulkan_types.h:44
i32 memory_index
The index of the memory used by the buffer.
Definition: vulkan_types.h:50
VkDeviceMemory memory
The memory used by the buffer.
Definition: vulkan_types.h:46
u32 memory_property_flags
The property flags for the memory used by the buffer.
Definition: vulkan_types.h:52
Represents a Vulkan-specific command buffer, which holds a list of commands and is submitted to a que...
Definition: vulkan_types.h:261
VkCommandBuffer handle
The internal command buffer handle.
Definition: vulkan_types.h:263
vulkan_command_buffer_state state
Command buffer state.
Definition: vulkan_types.h:266
The overall Vulkan context for the backend. Holds and maintains global renderer backend state,...
Definition: vulkan_types.h:564
VkSemaphore * queue_complete_semaphores
The semaphores used to indicate queue availability, one per frame.
Definition: vulkan_types.h:631
u32 image_index
The current image index.
Definition: vulkan_types.h:639
struct shaderc_compiler * shader_compiler
Definition: vulkan_types.h:679
u32 api_major
The instance-level api major version.
Definition: vulkan_types.h:566
u32 api_minor
The instance-level api minor version.
Definition: vulkan_types.h:569
u32 framebuffer_width
The framebuffer's current width.
Definition: vulkan_types.h:575
vec4 viewport_rect
The viewport rectangle.
Definition: vulkan_types.h:587
b8 recreating_swapchain
Indicates if the swapchain is currently being recreated.
Definition: vulkan_types.h:645
i32(* find_memory_index)(struct vulkan_context *context, u32 type_filter, u32 property_flags)
A function pointer to find a memory index of the given type and with the given properties.
Definition: vulkan_types.h:665
VkSemaphore * image_available_semaphores
The semaphores used to indicate image availability, one per frame.
Definition: vulkan_types.h:628
u64 framebuffer_size_generation
Current generation of framebuffer size. If it does not match framebuffer_size_last_generation,...
Definition: vulkan_types.h:581
u32 current_frame
The current frame.
Definition: vulkan_types.h:642
u32 framebuffer_height
The framebuffer's current height.
Definition: vulkan_types.h:578
render_target world_render_targets[3]
Render targets used for world rendering.
Definition: vulkan_types.h:653
u32 api_patch
The instance-level api patch version.
Definition: vulkan_types.h:572
PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT
Definition: vulkan_types.h:667
renderbuffer object_vertex_buffer
The object vertex buffer, used to hold geometry vertices.
Definition: vulkan_types.h:620
renderbuffer object_index_buffer
The object index buffer, used to hold geometry indices.
Definition: vulkan_types.h:622
vec4 scissor_rect
The scissor rectangle.
Definition: vulkan_types.h:590
struct shader * bound_shader
A pointer to the currently bound shader.
Definition: vulkan_types.h:671
VkAllocationCallbacks * allocator
The internal Vulkan allocator.
Definition: vulkan_types.h:595
b8 multithreading_enabled
Indicates if multi-threading is supported by this device.
Definition: vulkan_types.h:656
u64 framebuffer_size_last_generation
The generation of the framebuffer when it was last created. Set to framebuffer_size_generation when u...
Definition: vulkan_types.h:584
b8 render_flag_changed
Definition: vulkan_types.h:647
vulkan_swapchain swapchain
The swapchain.
Definition: vulkan_types.h:617
PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT
Definition: vulkan_types.h:668
vulkan_command_buffer * graphics_command_buffers
The graphics command buffers, one per frame.
Definition: vulkan_types.h:625
VkInstance instance
The handle to the internal Vulkan instance.
Definition: vulkan_types.h:593
VkFence in_flight_fences[2]
The in-flight fences, used to indicate to the application when a frame is busy/ready.
Definition: vulkan_types.h:636
vulkan_device device
The Vulkan device.
Definition: vulkan_types.h:614
renderbuffer staging
A resusable staging buffer to transfer data from a resource to a GPU-only buffer.
Definition: vulkan_types.h:674
u32 in_flight_fence_count
The current number of in-flight fences.
Definition: vulkan_types.h:634
VkSurfaceKHR surface
The internal Vulkan surface for the window to be drawn to.
Definition: vulkan_types.h:597
vulkan_geometry_data geometries[VULKAN_MAX_GEOMETRY_COUNT]
The A collection of loaded geometries.
Definition: vulkan_types.h:650
The configuration for a descriptor set.
Definition: vulkan_types.h:415
VkDescriptorSetLayoutBinding bindings[VULKAN_SHADER_MAX_BINDINGS]
An array of binding layouts for this set.
Definition: vulkan_types.h:419
u8 binding_count
The number of bindings in this set.
Definition: vulkan_types.h:417
u8 sampler_binding_index
The index of the sampler binding.
Definition: vulkan_types.h:421
Represents a state for a given descriptor. This is used to determine when a descriptor needs updating...
Definition: vulkan_types.h:459
u8 generations[3]
The descriptor generation, per frame.
Definition: vulkan_types.h:461
u32 ids[3]
The identifier, per frame. Typically used for texture ids.
Definition: vulkan_types.h:463
A representation of both the physical and logical Vulkan devices. Also contains handles to queues,...
Definition: vulkan_types.h:92
VkDevice logical_device
The logical device. This is the application's view of the device, used for most Vulkan operations.
Definition: vulkan_types.h:105
VkPhysicalDeviceProperties properties
The physical device properties.
Definition: vulkan_types.h:129
u32 api_major
The supported device-level api major version.
Definition: vulkan_types.h:94
u32 api_minor
The supported device-level api minor version.
Definition: vulkan_types.h:97
VkQueue graphics_queue
A handle to a graphics queue.
Definition: vulkan_types.h:119
i32 transfer_queue_index
The index of the transfer queue.
Definition: vulkan_types.h:114
VkQueue present_queue
A handle to a present queue.
Definition: vulkan_types.h:121
u32 api_patch
The supported device-level api patch version.
Definition: vulkan_types.h:100
VkPhysicalDeviceMemoryProperties memory
The physical device memory properties.
Definition: vulkan_types.h:133
VkPhysicalDeviceFeatures features
The physical device features.
Definition: vulkan_types.h:131
VkFormat depth_format
The chosen supported depth format.
Definition: vulkan_types.h:136
VkPhysicalDevice physical_device
The physical device. This is a representation of the GPU itself.
Definition: vulkan_types.h:103
b8 supports_device_local_host_visible
Indicates if the device supports a memory type that is both host visible and device local.
Definition: vulkan_types.h:116
i32 present_queue_index
The index of the present queue.
Definition: vulkan_types.h:112
u8 depth_channel_count
The chosen depth format's number of channels.
Definition: vulkan_types.h:138
VkQueue transfer_queue
A handle to a transfer queue.
Definition: vulkan_types.h:123
VkCommandPool graphics_command_pool
A handle to a command pool for graphics operations.
Definition: vulkan_types.h:126
vulkan_device_support_flags support_flags
Indicates support for various features.
Definition: vulkan_types.h:141
i32 graphics_queue_index
The index of the graphics queue.
Definition: vulkan_types.h:110
vulkan_swapchain_support_info swapchain_support
The swapchain support info.
Definition: vulkan_types.h:107
Internal buffer data for geometry. This data gets loaded directly into a buffer.
Definition: vulkan_types.h:356
u32 generation
The geometry generation. Incremented every time the geometry data changes.
Definition: vulkan_types.h:360
u32 id
The unique geometry identifier.
Definition: vulkan_types.h:358
u64 vertex_buffer_offset
The offset in bytes in the vertex buffer.
Definition: vulkan_types.h:363
u64 index_buffer_offset
The offset in bytes in the index buffer.
Definition: vulkan_types.h:366
A representation of a Vulkan image. This can be thought of as a texture. Also contains the view and m...
Definition: vulkan_types.h:149
u32 mip_levels
Definition: vulkan_types.h:169
VkImage handle
The handle to the internal image object.
Definition: vulkan_types.h:151
VkMemoryRequirements memory_requirements
The GPU memory requirements for this image.
Definition: vulkan_types.h:157
char * name
The name of the image.
Definition: vulkan_types.h:167
VkMemoryPropertyFlags memory_flags
Memory property flags.
Definition: vulkan_types.h:159
u32 width
The image width.
Definition: vulkan_types.h:163
VkImageView view
The view for the image, which is used to access the image.
Definition: vulkan_types.h:155
VkFormat format
The format of the image.
Definition: vulkan_types.h:161
VkDeviceMemory memory
The memory used by the image.
Definition: vulkan_types.h:153
u32 height
The image height.
Definition: vulkan_types.h:165
A configuration structure for Vulkan pipelines.
Definition: vulkan_types.h:291
u32 topology_types
Collection of topology types to be supported on this pipeline.
Definition: vulkan_types.h:323
renderer_winding winding
The vertex winding order used to determine the front face of triangles.
Definition: vulkan_types.h:325
VkRect2D scissor
The initial scissor configuration.
Definition: vulkan_types.h:313
u32 attribute_count
The number of attributes.
Definition: vulkan_types.h:299
VkViewport viewport
The initial viewport configuration.
Definition: vulkan_types.h:311
VkVertexInputAttributeDescription * attributes
An array of attributes.
Definition: vulkan_types.h:301
u32 push_constant_range_count
The number of push constant data ranges.
Definition: vulkan_types.h:319
VkPipelineShaderStageCreateInfo * stages
An VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BITarray of stages.
Definition: vulkan_types.h:309
char * name
The name of the pipeline. Used primarily for debugging purposes.
Definition: vulkan_types.h:293
range * push_constant_ranges
An array of push constant data ranges.
Definition: vulkan_types.h:321
u32 shader_flags
The shader flags used for creating the pipeline.
Definition: vulkan_types.h:317
VkDescriptorSetLayout * descriptor_set_layouts
An array of descriptor set layouts.
Definition: vulkan_types.h:305
u32 stride
The stride of the vertex data to be used (ex: sizeof(vertex_3d))
Definition: vulkan_types.h:297
u32 descriptor_set_layout_count
The number of descriptor set layouts.
Definition: vulkan_types.h:303
vulkan_renderpass * renderpass
A pointer to the renderpass to associate with the pipeline.
Definition: vulkan_types.h:295
face_cull_mode cull_mode
The face cull mode.
Definition: vulkan_types.h:315
u32 stage_count
The number of stages (vertex, fragment, etc).
Definition: vulkan_types.h:307
Holds a Vulkan pipeline and its layout.
Definition: vulkan_types.h:331
u32 supported_topology_types
Indicates the topology types used by this pipeline. See primitive_topology_type.
Definition: vulkan_types.h:337
VkPipelineLayout pipeline_layout
The pipeline layout.
Definition: vulkan_types.h:335
VkPipeline handle
The internal pipeline handle.
Definition: vulkan_types.h:333
A representation of the Vulkan renderpass.
Definition: vulkan_types.h:191
u32 stencil
The stencil clear value.
Definition: vulkan_types.h:199
VkRenderPass handle
The internal renderpass handle.
Definition: vulkan_types.h:193
f32 depth
The current render area of the renderpass.
Definition: vulkan_types.h:197
vulkan_render_pass_state state
Indicates renderpass state.
Definition: vulkan_types.h:202
Internal shader configuration generated by vulkan_shader_create().
Definition: vulkan_types.h:425
vulkan_descriptor_set_config descriptor_sets[2]
Descriptor sets, max of 2. Index 0=global, 1=instance.
Definition: vulkan_types.h:444
vulkan_shader_stage_config stages[VULKAN_SHADER_MAX_STAGES]
The configuration for every stage of this shader.
Definition: vulkan_types.h:429
u16 max_descriptor_set_count
The max number of descriptor sets that can be allocated from this shader. Should typically be a decen...
Definition: vulkan_types.h:436
VkDescriptorPoolSize pool_sizes[2]
An array of descriptor pool sizes.
Definition: vulkan_types.h:431
face_cull_mode cull_mode
Face culling mode, provided by the front end.
Definition: vulkan_types.h:450
u8 stage_count
The number of shader stages in this shader.
Definition: vulkan_types.h:427
VkVertexInputAttributeDescription attributes[VULKAN_SHADER_MAX_ATTRIBUTES]
An array of attribute descriptions for this shader.
Definition: vulkan_types.h:447
u8 descriptor_set_count
The total number of descriptor sets configured for this shader. Is 1 if only using global uniforms/sa...
Definition: vulkan_types.h:442
Represents the state for a descriptor set. This is used to track generations and updates,...
Definition: vulkan_types.h:471
VkDescriptorSet descriptor_sets[3]
The descriptor sets for this instance, one per frame.
Definition: vulkan_types.h:473
vulkan_descriptor_state descriptor_states[VULKAN_SHADER_MAX_BINDINGS]
A descriptor state per descriptor, which in turn handles frames. Count is managed in shader config.
Definition: vulkan_types.h:476
The instance-level state for a shader.
Definition: vulkan_types.h:482
vulkan_shader_descriptor_set_state descriptor_set_state
A state for the descriptor set.
Definition: vulkan_types.h:489
struct texture_map ** instance_texture_maps
Instance texture map pointers, which are used during rendering. These are set by calls to set_sampler...
Definition: vulkan_types.h:495
u64 offset
The offset in bytes in the instance uniform buffer.
Definition: vulkan_types.h:486
u32 id
The instance id. INVALID_ID if not used.
Definition: vulkan_types.h:484
Configuration for a shader stage, such as vertex or fragment.
Definition: vulkan_types.h:404
VkShaderStageFlagBits stage
The shader stage bit flag.
Definition: vulkan_types.h:406
char file_name[255]
The shader file name.
Definition: vulkan_types.h:408
Represents a single shader stage.
Definition: vulkan_types.h:272
VkShaderModule handle
The internal shader module handle.
Definition: vulkan_types.h:276
VkShaderModuleCreateInfo create_info
The shader module creation info.
Definition: vulkan_types.h:274
VkPipelineShaderStageCreateInfo shader_stage_create_info
The pipeline shader stage creation info.
Definition: vulkan_types.h:278
Represents a generic Vulkan shader. This uses a set of inputs and parameters, as well as the shader p...
Definition: vulkan_types.h:503
u8 instance_uniform_sampler_count
The number of instance sampler uniforms.
Definition: vulkan_types.h:551
vulkan_shader_stage stages[VULKAN_SHADER_MAX_STAGES]
An array of stages (such as vertex and fragment) for this shader. Count is located in config.
Definition: vulkan_types.h:517
renderbuffer uniform_buffer
The uniform buffer used by this shader.
Definition: vulkan_types.h:527
u8 global_uniform_count
The number of global non-sampler uniforms.
Definition: vulkan_types.h:545
vulkan_pipeline ** clockwise_pipelines
An array of pointers to pipelines associated with this shader. Clockwise winding. Only used if native...
Definition: vulkan_types.h:533
void * mapped_uniform_buffer_block
The block of memory mapped to the uniform buffer.
Definition: vulkan_types.h:505
VkDescriptorSetLayout descriptor_set_layouts[2]
Descriptor set layouts, max of 2. Index 0=global, 1=instance.
Definition: vulkan_types.h:523
u8 local_uniform_count
The number of local non-sampler uniforms.
Definition: vulkan_types.h:553
VkPrimitiveTopology current_topology
The currently-selected topology.
Definition: vulkan_types.h:538
u32 id
The shader identifier.
Definition: vulkan_types.h:508
u8 global_uniform_sampler_count
The number of global sampler uniforms.
Definition: vulkan_types.h:547
VkDescriptorSet global_descriptor_sets[3]
Global descriptor sets, one per frame.
Definition: vulkan_types.h:525
u8 instance_uniform_count
The number of instance non-sampler uniforms.
Definition: vulkan_types.h:549
vulkan_shader_instance_state instance_states[VULKAN_MAX_MATERIAL_COUNT]
Definition: vulkan_types.h:542
VkDescriptorPool descriptor_pool
The descriptor pool used for this shader.
Definition: vulkan_types.h:520
vulkan_renderpass * renderpass
A pointer to the renderpass to be used with this shader.
Definition: vulkan_types.h:514
u8 bound_pipeline_index
The currently bound pipeline index.
Definition: vulkan_types.h:536
vulkan_pipeline ** pipelines
An array of pointers to pipelines associated with this shader.
Definition: vulkan_types.h:530
u32 instance_count
The instance states for all instances.
Definition: vulkan_types.h:541
vulkan_shader_config config
The configuration of the shader generated by vulkan_create_shader().
Definition: vulkan_types.h:511
Contains swapchain support information and capabilities.
Definition: vulkan_types.h:56
u32 present_mode_count
The number of available presentation modes.
Definition: vulkan_types.h:64
VkSurfaceCapabilitiesKHR capabilities
The surface capabilities.
Definition: vulkan_types.h:58
VkPresentModeKHR * present_modes
An array of available presentation modes.
Definition: vulkan_types.h:66
u32 format_count
The number of available surface formats.
Definition: vulkan_types.h:60
VkSurfaceFormatKHR * formats
An array of the available surface formats.
Definition: vulkan_types.h:62
Representation of the Vulkan swapchain.
Definition: vulkan_types.h:208
u32 image_count
The number of swapchain images.
Definition: vulkan_types.h:223
VkSurfaceFormatKHR image_format
The swapchain image format.
Definition: vulkan_types.h:210
texture * depth_textures
An array of depth textures, one per frame.
Definition: vulkan_types.h:228
render_target render_targets[3]
Render targets used for on-screen rendering, one per frame. The images contained in these are created...
Definition: vulkan_types.h:234
renderer_config_flags flags
Indicates various flags used for swapchain instantiation.
Definition: vulkan_types.h:218
u8 max_frames_in_flight
The maximum number of "images in flight" (images simultaneously being rendered to)....
Definition: vulkan_types.h:215
texture * render_textures
An array of render targets, which contain swapchain images.
Definition: vulkan_types.h:225
VkSwapchainKHR handle
The swapchain internal handle.
Definition: vulkan_types.h:221
A 4-element vector.
Definition: math_types.h:89
struct vulkan_descriptor_state vulkan_descriptor_state
Represents a state for a given descriptor. This is used to determine when a descriptor needs updating...
#define VULKAN_MAX_GEOMETRY_COUNT
Max number of simultaneously uploaded geometries.
Definition: vulkan_types.h:350
struct vulkan_device vulkan_device
A representation of both the physical and logical Vulkan devices. Also contains handles to queues,...
struct vulkan_context vulkan_context
The overall Vulkan context for the backend. Holds and maintains global renderer backend state,...
#define VULKAN_SHADER_MAX_STAGES
Put some hard limits in place for the count of supported textures, attributes, uniforms,...
Definition: vulkan_types.h:382
struct vulkan_shader_stage_config vulkan_shader_stage_config
Configuration for a shader stage, such as vertex or fragment.
struct vulkan_buffer vulkan_buffer
Represents a Vulkan-specific buffer. Used to load data onto the GPU.
struct vulkan_pipeline vulkan_pipeline
Holds a Vulkan pipeline and its layout.
struct vulkan_pipeline_config vulkan_pipeline_config
A configuration structure for Vulkan pipelines.
struct vulkan_swapchain vulkan_swapchain
Representation of the Vulkan swapchain.
struct vulkan_swapchain_support_info vulkan_swapchain_support_info
Contains swapchain support information and capabilities.
#define VULKAN_SHADER_MAX_BINDINGS
The maximum number of bindings per descriptor set.
Definition: vulkan_types.h:397
struct vulkan_shader_instance_state vulkan_shader_instance_state
The instance-level state for a shader.
vulkan_render_pass_state
Represents the possible states of a renderpass.
Definition: vulkan_types.h:173
@ IN_RENDER_PASS
The renderpass is currently active.
Definition: vulkan_types.h:179
@ SUBMITTED
The renderpass has been submitted to the queue.
Definition: vulkan_types.h:183
@ READY
The renderpass is ready to begin.
Definition: vulkan_types.h:175
@ RECORDING_ENDED
The renderpass is has ended recording.
Definition: vulkan_types.h:181
@ RECORDING
The renderpass is currently being recorded to.
Definition: vulkan_types.h:177
@ NOT_ALLOCATED
The renderpass is not allocated.
Definition: vulkan_types.h:185
struct vulkan_descriptor_set_config vulkan_descriptor_set_config
The configuration for a descriptor set.
vulkan_topology_class
Definition: vulkan_types.h:281
@ VULKAN_TOPOLOGY_CLASS_MAX
Definition: vulkan_types.h:285
@ VULKAN_TOPOLOGY_CLASS_LINE
Definition: vulkan_types.h:283
@ VULKAN_TOPOLOGY_CLASS_POINT
Definition: vulkan_types.h:282
@ VULKAN_TOPOLOGY_CLASS_TRIANGLE
Definition: vulkan_types.h:284
struct vulkan_shader vulkan_shader
Represents a generic Vulkan shader. This uses a set of inputs and parameters, as well as the shader p...
struct vulkan_command_buffer vulkan_command_buffer
Represents a Vulkan-specific command buffer, which holds a list of commands and is submitted to a que...
struct vulkan_renderpass vulkan_renderpass
A representation of the Vulkan renderpass.
vulkan_command_buffer_state
Represents all of the available states that a command buffer can be in.
Definition: vulkan_types.h:241
@ COMMAND_BUFFER_STATE_IN_RENDER_PASS
The command buffer is currently active.
Definition: vulkan_types.h:247
@ COMMAND_BUFFER_STATE_SUBMITTED
The command buffer has been submitted to the queue.
Definition: vulkan_types.h:251
@ COMMAND_BUFFER_STATE_RECORDING_ENDED
The command buffer is has ended recording.
Definition: vulkan_types.h:249
@ COMMAND_BUFFER_STATE_READY
The command buffer is ready to begin.
Definition: vulkan_types.h:243
@ COMMAND_BUFFER_STATE_RECORDING
The command buffer is currently being recorded to.
Definition: vulkan_types.h:245
@ COMMAND_BUFFER_STATE_NOT_ALLOCATED
The command buffer is not allocated.
Definition: vulkan_types.h:253
#define VULKAN_MAX_MATERIAL_COUNT
Max number of material instances.
Definition: vulkan_types.h:344
u32 vulkan_device_support_flags
Bitwise flags for device support.
Definition: vulkan_types.h:85
struct vulkan_image vulkan_image
A representation of a Vulkan image. This can be thought of as a texture. Also contains the view and m...
struct vulkan_shader_descriptor_set_state vulkan_shader_descriptor_set_state
Represents the state for a descriptor set. This is used to track generations and updates,...
struct vulkan_geometry_data vulkan_geometry_data
Internal buffer data for geometry. This data gets loaded directly into a buffer.
#define VULKAN_SHADER_MAX_ATTRIBUTES
The maximum number of vertex input attributes allowed.
Definition: vulkan_types.h:388
struct vulkan_shader_stage vulkan_shader_stage
Represents a single shader stage.
struct vulkan_shader_config vulkan_shader_config
Internal shader configuration generated by vulkan_shader_create().
vulkan_device_support_flag_bits
Definition: vulkan_types.h:69
@ VULKAN_DEVICE_SUPPORT_FLAG_NATIVE_DYNAMIC_TOPOLOGY_BIT
Indicates if the device supports native dynamic topology (i.e. using Vulkan API >= 1....
Definition: vulkan_types.h:73
@ VULKAN_DEVICE_SUPPORT_FLAG_NATIVE_DYNAMIC_FRONT_FACE_BIT
Indicates if the device supports native dynamic front-face swapping (i.e. using Vulkan API >= 1....
Definition: vulkan_types.h:79
@ VULKAN_DEVICE_SUPPORT_FLAG_DYNAMIC_FRONT_FACE_BIT
Indicates if the device supports extension-based dynamic front-face swapping.
Definition: vulkan_types.h:81
@ VULKAN_DEVICE_SUPPORT_FLAG_LINE_SMOOTH_RASTERISATION_BIT
Definition: vulkan_types.h:77
@ VULKAN_DEVICE_SUPPORT_FLAG_NONE_BIT
Definition: vulkan_types.h:70
@ VULKAN_DEVICE_SUPPORT_FLAG_DYNAMIC_TOPOLOGY_BIT
Indicates if this device supports dynamic topology. If not, the renderer will need to generate a sepa...
Definition: vulkan_types.h:76