Kohi Game Engine
renderer_types.h File Reference

Go to the source code of this file.

Data Structures

struct  renderbuffer_data
 
struct  geometry_render_data
 
struct  renderbuffer_queued_deletion
 Represents a queued renderbuffer deletion. More...
 
struct  renderbuffer
 
struct  renderer_backend_config
 The generic configuration for a renderer backend. More...
 
struct  kwindow_renderer_state
 The internal state of a window for the renderer frontend. More...
 
struct  renderer_backend_interface
 A generic "interface" for the renderer backend. The renderer backend is what is responsible for making calls to the graphics API such as Vulkan, OpenGL or DirectX. Each of these should implement this interface. The frontend only interacts via this structure and has no knowledge of the way things actually work on the backend. More...
 

Macros

#define RENDERER_MAX_FRAME_COUNT   3
 

Typedefs

typedef struct renderbuffer_data renderbuffer_data
 
typedef struct geometry_render_data geometry_render_data
 
typedef enum renderer_debug_view_mode renderer_debug_view_mode
 
typedef enum renderer_projection_matrix_type renderer_projection_matrix_type
 
typedef enum renderer_stencil_op renderer_stencil_op
 
typedef enum renderer_compare_op renderer_compare_op
 
typedef enum renderer_attachment_type_flag_bits renderer_attachment_type_flag_bits
 
typedef u32 renderer_attachment_type_flags
 
typedef enum renderer_attachment_load_operation renderer_attachment_load_operation
 
typedef enum renderer_attachment_store_operation renderer_attachment_store_operation
 
typedef enum renderer_attachment_use renderer_attachment_use
 
typedef enum renderbuffer_type renderbuffer_type
 
typedef enum renderbuffer_track_type renderbuffer_track_type
 
typedef struct renderbuffer_queued_deletion renderbuffer_queued_deletion
 Represents a queued renderbuffer deletion. More...
 
typedef struct renderbuffer renderbuffer
 
typedef enum renderer_config_flag_bits renderer_config_flag_bits
 
typedef u32 renderer_config_flags
 
typedef struct renderer_backend_config renderer_backend_config
 The generic configuration for a renderer backend. More...
 
typedef enum renderer_winding renderer_winding
 The winding order of vertices, used to determine what is the front-face of a triangle. More...
 
typedef enum renderer_cull_mode renderer_cull_mode
 The face cull mode. More...
 
typedef struct kwindow_renderer_state kwindow_renderer_state
 The internal state of a window for the renderer frontend. More...
 
typedef struct renderer_backend_interface renderer_backend_interface
 A generic "interface" for the renderer backend. The renderer backend is what is responsible for making calls to the graphics API such as Vulkan, OpenGL or DirectX. Each of these should implement this interface. The frontend only interacts via this structure and has no knowledge of the way things actually work on the backend. More...
 

Enumerations

enum  renderer_debug_view_mode {
  RENDERER_VIEW_MODE_DEFAULT = 0 , RENDERER_VIEW_MODE_LIGHTING = 1 , RENDERER_VIEW_MODE_NORMALS = 2 , RENDERER_VIEW_MODE_CASCADES = 3 ,
  RENDERER_VIEW_MODE_WIREFRAME = 4
}
 
enum  renderer_projection_matrix_type { RENDERER_PROJECTION_MATRIX_TYPE_PERSPECTIVE = 0x0 , RENDERER_PROJECTION_MATRIX_TYPE_ORTHOGRAPHIC = 0x1 , RENDERER_PROJECTION_MATRIX_TYPE_ORTHOGRAPHIC_CENTERED = 0x2 }
 
enum  renderer_stencil_op {
  RENDERER_STENCIL_OP_KEEP = 0 , RENDERER_STENCIL_OP_ZERO = 1 , RENDERER_STENCIL_OP_REPLACE = 2 , RENDERER_STENCIL_OP_INCREMENT_AND_CLAMP = 3 ,
  RENDERER_STENCIL_OP_DECREMENT_AND_CLAMP = 4 , RENDERER_STENCIL_OP_INVERT = 5 , RENDERER_STENCIL_OP_INCREMENT_AND_WRAP = 6 , RENDERER_STENCIL_OP_DECREMENT_AND_WRAP = 7
}
 
enum  renderer_compare_op {
  RENDERER_COMPARE_OP_NEVER = 0 , RENDERER_COMPARE_OP_LESS = 1 , RENDERER_COMPARE_OP_EQUAL = 2 , RENDERER_COMPARE_OP_LESS_OR_EQUAL = 3 ,
  RENDERER_COMPARE_OP_GREATER = 4 , RENDERER_COMPARE_OP_NOT_EQUAL = 5 , RENDERER_COMPARE_OP_GREATER_OR_EQUAL = 6 , RENDERER_COMPARE_OP_ALWAYS = 7
}
 
enum  renderer_attachment_type_flag_bits { RENDERER_ATTACHMENT_TYPE_FLAG_COLOUR_BIT = 0x1 , RENDERER_ATTACHMENT_TYPE_FLAG_DEPTH_BIT = 0x2 , RENDERER_ATTACHMENT_TYPE_FLAG_STENCIL_BIT = 0x4 }
 
enum  renderer_attachment_load_operation { RENDERER_ATTACHMENT_LOAD_OPERATION_DONT_CARE = 0x0 , RENDERER_ATTACHMENT_LOAD_OPERATION_LOAD = 0x1 }
 
enum  renderer_attachment_store_operation { RENDERER_ATTACHMENT_STORE_OPERATION_DONT_CARE = 0x0 , RENDERER_ATTACHMENT_STORE_OPERATION_STORE = 0x1 }
 
enum  renderer_attachment_use {
  RENDERER_ATTACHMENT_USE_DONT_CARE , RENDERER_ATTACHMENT_USE_COLOUR_ATTACHMENT , RENDERER_ATTACHMENT_USE_COLOUR_PRESENT , RENDERER_ATTACHMENT_USE_COLOUR_SHADER_READ ,
  RENDERER_ATTACHMENT_USE_COLOUR_SHADER_WRITE , RENDERER_ATTACHMENT_USE_DEPTH_STENCIL_ATTACHMENT , RENDERER_ATTACHMENT_USE_DEPTH_STENCIL_SHADER_READ , RENDERER_ATTACHMENT_USE_DEPTH_STENCIL_SHADER_WRITE
}
 
enum  renderbuffer_type {
  RENDERBUFFER_TYPE_UNKNOWN , RENDERBUFFER_TYPE_VERTEX , RENDERBUFFER_TYPE_INDEX , RENDERBUFFER_TYPE_UNIFORM ,
  RENDERBUFFER_TYPE_STAGING , RENDERBUFFER_TYPE_READ , RENDERBUFFER_TYPE_STORAGE
}
 
enum  renderbuffer_track_type { RENDERBUFFER_TRACK_TYPE_NONE = 0 , RENDERBUFFER_TRACK_TYPE_FREELIST = 1 , RENDERBUFFER_TRACK_TYPE_LINEAR = 2 }
 
enum  renderer_config_flag_bits { RENDERER_CONFIG_FLAG_VSYNC_ENABLED_BIT = 0x1 , RENDERER_CONFIG_FLAG_POWER_SAVING_BIT = 0x2 , RENDERER_CONFIG_FLAG_ENABLE_VALIDATION = 0x4 }
 
enum  renderer_winding { RENDERER_WINDING_COUNTER_CLOCKWISE = 0 , RENDERER_WINDING_CLOCKWISE = 1 }
 The winding order of vertices, used to determine what is the front-face of a triangle. More...
 
enum  renderer_cull_mode { RENDERER_CULL_MODE_NONE = 0 , RENDERER_CULL_MODE_FRONT = 1 , RENDERER_CULL_MODE_BACK = 2 , RENDERER_CULL_MODE_FRONT_AND_BACK = 3 }
 The face cull mode. More...
 

Macro Definition Documentation

◆ RENDERER_MAX_FRAME_COUNT

#define RENDERER_MAX_FRAME_COUNT   3

Typedef Documentation

◆ geometry_render_data

◆ kwindow_renderer_state

The internal state of a window for the renderer frontend.

◆ renderbuffer

typedef struct renderbuffer renderbuffer

◆ renderbuffer_data

◆ renderbuffer_queued_deletion

Represents a queued renderbuffer deletion.

◆ renderbuffer_track_type

◆ renderbuffer_type

◆ renderer_attachment_load_operation

◆ renderer_attachment_store_operation

◆ renderer_attachment_type_flag_bits

◆ renderer_attachment_type_flags

◆ renderer_attachment_use

◆ renderer_backend_config

The generic configuration for a renderer backend.

◆ renderer_backend_interface

A generic "interface" for the renderer backend. The renderer backend is what is responsible for making calls to the graphics API such as Vulkan, OpenGL or DirectX. Each of these should implement this interface. The frontend only interacts via this structure and has no knowledge of the way things actually work on the backend.

◆ renderer_compare_op

◆ renderer_config_flag_bits

◆ renderer_config_flags

◆ renderer_cull_mode

The face cull mode.

◆ renderer_debug_view_mode

◆ renderer_projection_matrix_type

◆ renderer_stencil_op

◆ renderer_winding

The winding order of vertices, used to determine what is the front-face of a triangle.

Enumeration Type Documentation

◆ renderbuffer_track_type

Enumerator
RENDERBUFFER_TRACK_TYPE_NONE 
RENDERBUFFER_TRACK_TYPE_FREELIST 
RENDERBUFFER_TRACK_TYPE_LINEAR 

◆ renderbuffer_type

Enumerator
RENDERBUFFER_TYPE_UNKNOWN 

Buffer is use is unknown. Default, but usually invalid.

RENDERBUFFER_TYPE_VERTEX 

Buffer is used for vertex data.

RENDERBUFFER_TYPE_INDEX 

Buffer is used for index data.

RENDERBUFFER_TYPE_UNIFORM 

Buffer is used for uniform data.

RENDERBUFFER_TYPE_STAGING 

Buffer is used for staging purposes (i.e. from host-visible to device-local memory)

RENDERBUFFER_TYPE_READ 

Buffer is used for reading purposes (i.e copy to from device local, then read)

RENDERBUFFER_TYPE_STORAGE 

Buffer is used for data storage.

◆ renderer_attachment_load_operation

Enumerator
RENDERER_ATTACHMENT_LOAD_OPERATION_DONT_CARE 
RENDERER_ATTACHMENT_LOAD_OPERATION_LOAD 

◆ renderer_attachment_store_operation

Enumerator
RENDERER_ATTACHMENT_STORE_OPERATION_DONT_CARE 
RENDERER_ATTACHMENT_STORE_OPERATION_STORE 

◆ renderer_attachment_type_flag_bits

Enumerator
RENDERER_ATTACHMENT_TYPE_FLAG_COLOUR_BIT 
RENDERER_ATTACHMENT_TYPE_FLAG_DEPTH_BIT 
RENDERER_ATTACHMENT_TYPE_FLAG_STENCIL_BIT 

◆ renderer_attachment_use

Enumerator
RENDERER_ATTACHMENT_USE_DONT_CARE 
RENDERER_ATTACHMENT_USE_COLOUR_ATTACHMENT 
RENDERER_ATTACHMENT_USE_COLOUR_PRESENT 
RENDERER_ATTACHMENT_USE_COLOUR_SHADER_READ 
RENDERER_ATTACHMENT_USE_COLOUR_SHADER_WRITE 
RENDERER_ATTACHMENT_USE_DEPTH_STENCIL_ATTACHMENT 
RENDERER_ATTACHMENT_USE_DEPTH_STENCIL_SHADER_READ 
RENDERER_ATTACHMENT_USE_DEPTH_STENCIL_SHADER_WRITE 

◆ renderer_compare_op

Enumerator
RENDERER_COMPARE_OP_NEVER 

Specifies that the comparison always evaluates false.

RENDERER_COMPARE_OP_LESS 

Specifies that the comparison evaluates reference < test.

RENDERER_COMPARE_OP_EQUAL 

Specifies that the comparison evaluates reference = test.

RENDERER_COMPARE_OP_LESS_OR_EQUAL 

Specifies that the comparison evaluates reference <= test.

RENDERER_COMPARE_OP_GREATER 

Specifies that the comparison evaluates reference > test.

RENDERER_COMPARE_OP_NOT_EQUAL 

Specifies that the comparison evaluates reference != test.

RENDERER_COMPARE_OP_GREATER_OR_EQUAL 

Specifies that the comparison evaluates reference >= test.

RENDERER_COMPARE_OP_ALWAYS 

Specifies that the comparison is always true.

◆ renderer_config_flag_bits

Enumerator
RENDERER_CONFIG_FLAG_VSYNC_ENABLED_BIT 

Indicates that vsync should be enabled.

RENDERER_CONFIG_FLAG_POWER_SAVING_BIT 

Configures the renderer backend in a way that conserves power where possible.

RENDERER_CONFIG_FLAG_ENABLE_VALIDATION 

Enables advanced validation in the renderer backend, if supported.

◆ renderer_cull_mode

The face cull mode.

Enumerator
RENDERER_CULL_MODE_NONE 

No faces are culled.

RENDERER_CULL_MODE_FRONT 

Only front faces are culled.

RENDERER_CULL_MODE_BACK 

Only back faces are culled.

RENDERER_CULL_MODE_FRONT_AND_BACK 

Both front and back faces are culled.

◆ renderer_debug_view_mode

Enumerator
RENDERER_VIEW_MODE_DEFAULT 
RENDERER_VIEW_MODE_LIGHTING 
RENDERER_VIEW_MODE_NORMALS 
RENDERER_VIEW_MODE_CASCADES 
RENDERER_VIEW_MODE_WIREFRAME 

◆ renderer_projection_matrix_type

Enumerator
RENDERER_PROJECTION_MATRIX_TYPE_PERSPECTIVE 
RENDERER_PROJECTION_MATRIX_TYPE_ORTHOGRAPHIC 

An orthographic matrix that is zero-based on the top left.

RENDERER_PROJECTION_MATRIX_TYPE_ORTHOGRAPHIC_CENTERED 

An orthographic matrix that is centered around width/height instead of zero-based. Uses fov as a "zoom".

◆ renderer_stencil_op

Enumerator
RENDERER_STENCIL_OP_KEEP 

Keeps the current value.

RENDERER_STENCIL_OP_ZERO 

Sets the stencil buffer value to 0.

RENDERER_STENCIL_OP_REPLACE 

Sets the stencil buffer value to ref, as specified in the function.

RENDERER_STENCIL_OP_INCREMENT_AND_CLAMP 

Increments the current stencil buffer value. Clamps to the maximum representable unsigned value.

RENDERER_STENCIL_OP_DECREMENT_AND_CLAMP 

Decrements the current stencil buffer value. Clamps to 0.

RENDERER_STENCIL_OP_INVERT 

Bitwise inverts the current stencil buffer value.

RENDERER_STENCIL_OP_INCREMENT_AND_WRAP 

Increments the current stencil buffer value. Wraps stencil buffer value to zero when incrementing the maximum representable unsigned value.

RENDERER_STENCIL_OP_DECREMENT_AND_WRAP 

Decrements the current stencil buffer value. Wraps stencil buffer value to the maximum representable unsigned value when decrementing a stencil buffer value of zero.

◆ renderer_winding

The winding order of vertices, used to determine what is the front-face of a triangle.

Enumerator
RENDERER_WINDING_COUNTER_CLOCKWISE 

Counter-clockwise vertex winding.

RENDERER_WINDING_CLOCKWISE 

Counter-clockwise vertex winding.