Kohi Game Engine
vulkan_context Struct Reference

The overall Vulkan context for the backend. Holds and maintains global renderer backend state, Vulkan instance, etc. More...

#include <vulkan_types.h>

Data Fields

u32 api_major
 The instance-level api major version. More...
 
u32 api_minor
 The instance-level api minor version. More...
 
u32 api_patch
 The instance-level api patch version. More...
 
u32 framebuffer_width
 The framebuffer's current width. More...
 
u32 framebuffer_height
 The framebuffer's current height. More...
 
u64 framebuffer_size_generation
 Current generation of framebuffer size. If it does not match framebuffer_size_last_generation, a new one should be generated. More...
 
u64 framebuffer_size_last_generation
 The generation of the framebuffer when it was last created. Set to framebuffer_size_generation when updated. More...
 
vec4 viewport_rect
 The viewport rectangle. More...
 
vec4 scissor_rect
 The scissor rectangle. More...
 
VkInstance instance
 The handle to the internal Vulkan instance. More...
 
VkAllocationCallbacks * allocator
 The internal Vulkan allocator. More...
 
VkSurfaceKHR surface
 The internal Vulkan surface for the window to be drawn to. More...
 
vulkan_device device
 The Vulkan device. More...
 
vulkan_swapchain swapchain
 The swapchain. More...
 
renderbuffer object_vertex_buffer
 The object vertex buffer, used to hold geometry vertices. More...
 
renderbuffer object_index_buffer
 The object index buffer, used to hold geometry indices. More...
 
vulkan_command_buffergraphics_command_buffers
 The graphics command buffers, one per frame. More...
 
VkSemaphore * image_available_semaphores
 The semaphores used to indicate image availability, one per frame. More...
 
VkSemaphore * queue_complete_semaphores
 The semaphores used to indicate queue availability, one per frame. More...
 
u32 in_flight_fence_count
 The current number of in-flight fences. More...
 
VkFence in_flight_fences [2]
 The in-flight fences, used to indicate to the application when a frame is busy/ready. More...
 
u32 image_index
 The current image index. More...
 
u32 current_frame
 The current frame. More...
 
b8 recreating_swapchain
 Indicates if the swapchain is currently being recreated. More...
 
b8 render_flag_changed
 
vulkan_geometry_data geometries [VULKAN_MAX_GEOMETRY_COUNT]
 The A collection of loaded geometries. More...
 
render_target world_render_targets [3]
 Render targets used for world rendering. More...
 
b8 multithreading_enabled
 Indicates if multi-threading is supported by this device. More...
 
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. More...
 
PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT
 
PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT
 
struct shaderbound_shader
 A pointer to the currently bound shader. More...
 
renderbuffer staging
 A resusable staging buffer to transfer data from a resource to a GPU-only buffer. More...
 
struct shaderc_compiler * shader_compiler
 

Detailed Description

The overall Vulkan context for the backend. Holds and maintains global renderer backend state, Vulkan instance, etc.

Field Documentation

◆ allocator

VkAllocationCallbacks* allocator

The internal Vulkan allocator.

◆ api_major

u32 api_major

The instance-level api major version.

◆ api_minor

u32 api_minor

The instance-level api minor version.

◆ api_patch

u32 api_patch

The instance-level api patch version.

◆ bound_shader

struct shader* bound_shader

A pointer to the currently bound shader.

◆ current_frame

u32 current_frame

The current frame.

◆ device

vulkan_device device

The Vulkan device.

◆ find_memory_index

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.

Parameters
contextA pointer to the renderer context.
type_filterThe types of memory to search for.
property_flagsThe required properties which must be present.
Returns
The index of the found memory type. Returns -1 if not found.

◆ framebuffer_height

u32 framebuffer_height

The framebuffer's current height.

◆ framebuffer_size_generation

u64 framebuffer_size_generation

Current generation of framebuffer size. If it does not match framebuffer_size_last_generation, a new one should be generated.

◆ framebuffer_size_last_generation

u64 framebuffer_size_last_generation

The generation of the framebuffer when it was last created. Set to framebuffer_size_generation when updated.

◆ framebuffer_width

u32 framebuffer_width

The framebuffer's current width.

◆ geometries

The A collection of loaded geometries.

Todo:
TODO: make dynamic

◆ graphics_command_buffers

vulkan_command_buffer* graphics_command_buffers

The graphics command buffers, one per frame.

Note
: darray

◆ image_available_semaphores

VkSemaphore* image_available_semaphores

The semaphores used to indicate image availability, one per frame.

Note
: darray

◆ image_index

u32 image_index

The current image index.

◆ in_flight_fence_count

u32 in_flight_fence_count

The current number of in-flight fences.

◆ in_flight_fences

VkFence in_flight_fences[2]

The in-flight fences, used to indicate to the application when a frame is busy/ready.

◆ instance

VkInstance instance

The handle to the internal Vulkan instance.

◆ multithreading_enabled

b8 multithreading_enabled

Indicates if multi-threading is supported by this device.

◆ object_index_buffer

renderbuffer object_index_buffer

The object index buffer, used to hold geometry indices.

◆ object_vertex_buffer

renderbuffer object_vertex_buffer

The object vertex buffer, used to hold geometry vertices.

◆ queue_complete_semaphores

VkSemaphore* queue_complete_semaphores

The semaphores used to indicate queue availability, one per frame.

Note
: darray

◆ recreating_swapchain

b8 recreating_swapchain

Indicates if the swapchain is currently being recreated.

◆ render_flag_changed

b8 render_flag_changed

◆ scissor_rect

vec4 scissor_rect

The scissor rectangle.

◆ shader_compiler

struct shaderc_compiler* shader_compiler

Used for dynamic compilation of vulkan shaders (using the shaderc lib.)

◆ staging

renderbuffer staging

A resusable staging buffer to transfer data from a resource to a GPU-only buffer.

◆ surface

VkSurfaceKHR surface

The internal Vulkan surface for the window to be drawn to.

◆ swapchain

vulkan_swapchain swapchain

The swapchain.

◆ viewport_rect

vec4 viewport_rect

The viewport rectangle.

◆ vkCmdSetFrontFaceEXT

PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT

◆ vkCmdSetPrimitiveTopologyEXT

PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT

◆ world_render_targets

render_target world_render_targets[3]

Render targets used for world rendering.

Note
One per frame.

The documentation for this struct was generated from the following file: