Kohi Game Engine
vulkan_utils.h File Reference

A collection of Vulkan-specific utility functions. More...

#include "vulkan_types.h"

Go to the source code of this file.

Macros

#define VK_CHECK_DETAILED(expr)
 
#define VK_SET_DEBUG_OBJECT_NAME(context, object_type, object_handle, object_name)
 
#define VK_SET_DEBUG_OBJECT_TAG(context, object_type, object_handle, tag_size, tag_data)
 
#define VK_BEGIN_DEBUG_LABEL(context, command_buffer, label_name, colour)
 
#define VK_END_DEBUG_LABEL(context, command_buffer)
 

Functions

const char * vulkan_result_string (VkResult result, b8 get_extended)
 Returns the string representation of result. More...
 
b8 vulkan_result_is_success (VkResult result)
 Inticates if the passed result is a success or an error as defined by the Vulkan spec. More...
 
i32 vulkan_find_memory_index (vulkan_context *context, u32 type_filter, u32 property_flags)
 
void vulkan_get_vktopology_type_and_pipeline_index (primitive_topology_type type, VkPrimitiveTopology *out_type, u8 *out_pipeline_index)
 

Detailed Description

A collection of Vulkan-specific utility functions.

Author
Travis Vroman (travi.nosp@m.s@ko.nosp@m.hieng.nosp@m.ine..nosp@m.com)
Version
1.0
Date
2022-01-11

Macro Definition Documentation

◆ VK_BEGIN_DEBUG_LABEL

#define VK_BEGIN_DEBUG_LABEL (   context,
  command_buffer,
  label_name,
  colour 
)

◆ VK_CHECK_DETAILED

#define VK_CHECK_DETAILED (   expr)
Value:
{ \
VkResult result = expr; \
if (!vulkan_result_is_success(result)) { \
KFATAL("%s:%u - %s Failed with error:'%s'", __FILE__, __LINE__, #expr, vulkan_result_string(result, true)); \
} \
}
const char * vulkan_result_string(VkResult result, b8 get_extended)
Returns the string representation of result.
b8 vulkan_result_is_success(VkResult result)
Inticates if the passed result is a success or an error as defined by the Vulkan spec.

◆ VK_END_DEBUG_LABEL

#define VK_END_DEBUG_LABEL (   context,
  command_buffer 
)

◆ VK_SET_DEBUG_OBJECT_NAME

#define VK_SET_DEBUG_OBJECT_NAME (   context,
  object_type,
  object_handle,
  object_name 
)

◆ VK_SET_DEBUG_OBJECT_TAG

#define VK_SET_DEBUG_OBJECT_TAG (   context,
  object_type,
  object_handle,
  tag_size,
  tag_data 
)

Function Documentation

◆ vulkan_find_memory_index()

i32 vulkan_find_memory_index ( vulkan_context context,
u32  type_filter,
u32  property_flags 
)

◆ vulkan_get_vktopology_type_and_pipeline_index()

void vulkan_get_vktopology_type_and_pipeline_index ( primitive_topology_type  type,
VkPrimitiveTopology *  out_type,
u8 out_pipeline_index 
)

◆ vulkan_result_is_success()

b8 vulkan_result_is_success ( VkResult  result)

Inticates if the passed result is a success or an error as defined by the Vulkan spec.

Returns
True if success; otherwise false. Defaults to true for unknown result types.

◆ vulkan_result_string()

const char* vulkan_result_string ( VkResult  result,
b8  get_extended 
)

Returns the string representation of result.

Parameters
resultThe result to get the string for.
get_extendedIndicates whether to also return an extended result.
Returns
The error code and/or extended error message in string form. Defaults to success for unknown result types.