Kohi Game Engine
rendergraph.h File Reference
#include "defines.h"
#include "renderer/renderer_types.h"

Go to the source code of this file.

Data Structures

struct  rendergraph_source
 Represents some source of data/resource, to be plugged into a sink. More...
 
struct  rendergraph_sink
 Represents a sortof "socket" which accepts data of a specfic type (i.e. a texture or number), which is provided by a source. More...
 
struct  rendergraph_node
 Represents a single node in a rendergraph. A node is responsible for acquiring and maintaining its required resources, and generally has some sort of input (typically sinks) and some form of output (typically sources) to potentially other nodes. More...
 
struct  rendergraph
 
struct  rendergraph_node_sink_config
 
struct  rendergraph_node_config
 The configuration for a rendergraph node. More...
 
struct  rendergraph_node_factory
 

Macros

#define RG_CHECK(expr)
 

Typedefs

typedef enum rendergraph_resource_type rendergraph_resource_type
 Represents a resource type to be used with rendergraph sources and sinks. More...
 
typedef struct rendergraph_source rendergraph_source
 Represents some source of data/resource, to be plugged into a sink. More...
 
typedef struct rendergraph_sink rendergraph_sink
 Represents a sortof "socket" which accepts data of a specfic type (i.e. a texture or number), which is provided by a source. More...
 
typedef struct rendergraph_node rendergraph_node
 Represents a single node in a rendergraph. A node is responsible for acquiring and maintaining its required resources, and generally has some sort of input (typically sinks) and some form of output (typically sources) to potentially other nodes. More...
 
typedef struct rendergraph rendergraph
 
typedef struct rendergraph_node_sink_config rendergraph_node_sink_config
 
typedef struct rendergraph_node_config rendergraph_node_config
 The configuration for a rendergraph node. More...
 
typedef struct rendergraph_node_factory rendergraph_node_factory
 

Enumerations

enum  rendergraph_resource_type { RENDERGRAPH_RESOURCE_TYPE_UNDEFINED , RENDERGRAPH_RESOURCE_TYPE_TEXTURE , RENDERGRAPH_RESOURCE_TYPE_NUMBER , RENDERGRAPH_RESOURCE_TYPE_MAX }
 Represents a resource type to be used with rendergraph sources and sinks. More...
 

Functions

KAPI b8 rendergraph_create (const char *config_str, ktexture global_colourbuffer, ktexture global_depthbuffer, rendergraph *out_graph)
 
KAPI void rendergraph_destroy (rendergraph *graph)
 
KAPI b8 rendergraph_finalize (rendergraph *graph)
 
KAPI b8 rendergraph_initialize (rendergraph *graph)
 
KAPI b8 rendergraph_load_resources (rendergraph *graph)
 
KAPI b8 rendergraph_execute_frame (rendergraph *graph, struct frame_data *p_frame_data)
 
KAPI rendergraph_resource_type string_to_resource_type (const char *str)
 
b8 rendergraph_system_initialize (u64 *memory_requirement, struct rendergraph_system_state *state)
 
void rendergraph_system_shutdown (struct rendergraph_system_state *state)
 Shuts this system down. More...
 
KAPI b8 rendergraph_system_node_factory_register (struct rendergraph_system_state *state, const rendergraph_node_factory *new_factory)
 Registers the provided factory with the rendergraph system. Note that passing a factory with a duplicate/already existing type will update/overwrite the existing factory of that type. More...
 

Macro Definition Documentation

◆ RG_CHECK

#define RG_CHECK (   expr)
Value:
if (!expr) { \
KERROR("Failed to execute: '%s'.", #expr); \
return false; \
}

Typedef Documentation

◆ rendergraph

typedef struct rendergraph rendergraph

◆ rendergraph_node

Represents a single node in a rendergraph. A node is responsible for acquiring and maintaining its required resources, and generally has some sort of input (typically sinks) and some form of output (typically sources) to potentially other nodes.

◆ rendergraph_node_config

The configuration for a rendergraph node.

◆ rendergraph_node_factory

◆ rendergraph_node_sink_config

Configuration structure for a node sink

◆ rendergraph_resource_type

Represents a resource type to be used with rendergraph sources and sinks.

◆ rendergraph_sink

Represents a sortof "socket" which accepts data of a specfic type (i.e. a texture or number), which is provided by a source.

◆ rendergraph_source

Represents some source of data/resource, to be plugged into a sink.

Enumeration Type Documentation

◆ rendergraph_resource_type

Represents a resource type to be used with rendergraph sources and sinks.

Enumerator
RENDERGRAPH_RESOURCE_TYPE_UNDEFINED 
RENDERGRAPH_RESOURCE_TYPE_TEXTURE 
RENDERGRAPH_RESOURCE_TYPE_NUMBER 
RENDERGRAPH_RESOURCE_TYPE_MAX 

Function Documentation

◆ rendergraph_create()

KAPI b8 rendergraph_create ( const char *  config_str,
ktexture  global_colourbuffer,
ktexture  global_depthbuffer,
rendergraph out_graph 
)

◆ rendergraph_destroy()

KAPI void rendergraph_destroy ( rendergraph graph)

◆ rendergraph_execute_frame()

KAPI b8 rendergraph_execute_frame ( rendergraph graph,
struct frame_data p_frame_data 
)

◆ rendergraph_finalize()

KAPI b8 rendergraph_finalize ( rendergraph graph)

◆ rendergraph_initialize()

KAPI b8 rendergraph_initialize ( rendergraph graph)

◆ rendergraph_load_resources()

KAPI b8 rendergraph_load_resources ( rendergraph graph)

◆ rendergraph_system_initialize()

b8 rendergraph_system_initialize ( u64 memory_requirement,
struct rendergraph_system_state *  state 
)

Initializes the rendergraph system. Should be called twice, once with to obtain the memory requirement (pass 0 to state) and a second time with allocated memory for state.

Parameters
memory_requirementA pointer to hold the memory requirement for this system.
stateA pointer to the system state.
Returns
True on success; otherwise false.

◆ rendergraph_system_node_factory_register()

KAPI b8 rendergraph_system_node_factory_register ( struct rendergraph_system_state *  state,
const rendergraph_node_factory new_factory 
)

Registers the provided factory with the rendergraph system. Note that passing a factory with a duplicate/already existing type will update/overwrite the existing factory of that type.

Parameters
stateA pointer to the rendergraph system state.
new_factoryA constant pointer to the factory to be registered. Note that a copy of this is taken.
Returns
True on success; otherwise false.

◆ rendergraph_system_shutdown()

void rendergraph_system_shutdown ( struct rendergraph_system_state *  state)

Shuts this system down.

Parameters
stateA pointer to the system state.

◆ string_to_resource_type()

KAPI rendergraph_resource_type string_to_resource_type ( const char *  str)