Kohi Game Engine
rendergraph.h
Go to the documentation of this file.
1 #ifndef _RENDERGRAPH_H_
2 #define _RENDERGRAPH_H_
3 
4 #include "core/frame_data.h"
5 #include "defines.h"
8 
9 struct application;
10 
15 
21 
22 typedef struct rendergraph_source {
23  char* name;
26  // Array of texture pointers.
29 
30 typedef struct rendergraph_sink {
31  char* name;
34 
35 typedef struct rendergraph_pass_data {
37  struct viewport* vp;
40  vec3 view_position; // TODO: might not need this?
41  void* ext_data;
43 
44 typedef struct rendergraph_pass {
45  char* name;
46 
48 
49  // darray
51  // darray
53 
56 
58 
59  b8 (*initialize)(struct rendergraph_pass* self);
60  b8 (*execute)(struct rendergraph_pass* self, struct frame_data* p_frame_data);
61  void (*destroy)(struct rendergraph_pass* self);
63 
64 typedef struct rendergraph {
65  char* name;
66  struct application* app;
67 
68  // darray
70 
71  // darray of pointers to passes.
73 
76 
77 KAPI b8 rendergraph_create(const char* name, struct application* app, rendergraph* out_graph);
79 
81 
82 // pass functions
83 KAPI b8 rendergraph_pass_create(rendergraph* graph, const char* name, b8 (*create_pfn)(struct rendergraph_pass* self), rendergraph_pass* out_pass);
84 KAPI b8 rendergraph_pass_source_add(rendergraph* graph, const char* pass_name, const char* source_name, rendergraph_source_type type, rendergraph_source_origin origin);
85 KAPI b8 rendergraph_pass_sink_add(rendergraph* graph, const char* pass_name, const char* sink_name);
86 
87 KAPI b8 rendergraph_pass_set_sink_linkage(rendergraph* graph, const char* pass_name, const char* sink_name, const char* source_pass_name, const char* source_name);
88 
90 
92 
94 
95 #endif
This file contains global type definitions which are used throughout the entire engine and applicatio...
#define KAPI
Import/export qualifier.
Definition: defines.h:177
_Bool b8
8-bit boolean type
Definition: defines.h:58
unsigned short u16
Unsigned 16-bit integer.
Definition: defines.h:22
struct rendergraph_source rendergraph_source
struct rendergraph_pass_data rendergraph_pass_data
KAPI b8 rendergraph_pass_sink_add(rendergraph *graph, const char *pass_name, const char *sink_name)
KAPI b8 rendergraph_on_resize(rendergraph *graph, u16 width, u16 height)
rendergraph_source_origin
Definition: rendergraph.h:16
@ RENDERGRAPH_SOURCE_ORIGIN_OTHER
Definition: rendergraph.h:18
@ RENDERGRAPH_SOURCE_ORIGIN_GLOBAL
Definition: rendergraph.h:17
@ RENDERGRAPH_SOURCE_ORIGIN_SELF
Definition: rendergraph.h:19
KAPI b8 rendergraph_pass_source_add(rendergraph *graph, const char *pass_name, const char *source_name, rendergraph_source_type type, rendergraph_source_origin origin)
rendergraph_source_type
Definition: rendergraph.h:11
@ RENDERGRAPH_SOURCE_TYPE_RENDER_TARGET_COLOUR
Definition: rendergraph.h:12
@ RENDERGRAPH_SOURCE_TYPE_RENDER_TARGET_DEPTH_STENCIL
Definition: rendergraph.h:13
KAPI b8 rendergraph_create(const char *name, struct application *app, rendergraph *out_graph)
struct rendergraph rendergraph
KAPI b8 rendergraph_execute_frame(rendergraph *graph, frame_data *p_frame_data)
struct rendergraph_sink rendergraph_sink
KAPI b8 rendergraph_finalize(rendergraph *graph)
KAPI b8 rendergraph_pass_create(rendergraph *graph, const char *name, b8(*create_pfn)(struct rendergraph_pass *self), rendergraph_pass *out_pass)
KAPI b8 rendergraph_pass_set_sink_linkage(rendergraph *graph, const char *pass_name, const char *sink_name, const char *source_pass_name, const char *source_name)
struct rendergraph_pass rendergraph_pass
KAPI b8 rendergraph_global_source_add(rendergraph *graph, const char *name, rendergraph_source_type type, rendergraph_source_origin origin)
KAPI void rendergraph_destroy(rendergraph *graph)
This file contains the types for common resources the engine uses.
Represents the basic application state in a application. Called for creation by the application.
Definition: application_types.h:42
Engine-level current frame-specific data.
Definition: frame_data.h:16
Definition: rendergraph.h:35
vec3 view_position
Definition: rendergraph.h:40
b8 do_execute
Definition: rendergraph.h:36
void * ext_data
Definition: rendergraph.h:41
mat4 view_matrix
Definition: rendergraph.h:38
mat4 projection_matrix
Definition: rendergraph.h:39
struct viewport * vp
Definition: rendergraph.h:37
Definition: rendergraph.h:44
b8(* execute)(struct rendergraph_pass *self, struct frame_data *p_frame_data)
Definition: rendergraph.h:60
rendergraph_pass_data pass_data
Definition: rendergraph.h:47
b8(* initialize)(struct rendergraph_pass *self)
Definition: rendergraph.h:59
char * name
Definition: rendergraph.h:45
void(* destroy)(struct rendergraph_pass *self)
Definition: rendergraph.h:61
renderpass pass
Definition: rendergraph.h:54
rendergraph_source * sources
Definition: rendergraph.h:50
void * internal_data
Definition: rendergraph.h:55
b8 presents_after
Definition: rendergraph.h:57
rendergraph_sink * sinks
Definition: rendergraph.h:52
Definition: rendergraph.h:30
char * name
Definition: rendergraph.h:31
rendergraph_source * bound_source
Definition: rendergraph.h:32
Definition: rendergraph.h:22
char * name
Definition: rendergraph.h:23
rendergraph_source_type type
Definition: rendergraph.h:24
texture ** textures
Definition: rendergraph.h:27
rendergraph_source_origin origin
Definition: rendergraph.h:25
Definition: rendergraph.h:64
struct application * app
Definition: rendergraph.h:66
rendergraph_source * global_sources
Definition: rendergraph.h:69
char * name
Definition: rendergraph.h:65
rendergraph_pass ** passes
Definition: rendergraph.h:72
rendergraph_sink backbuffer_global_sink
Definition: rendergraph.h:74
Represents a generic renderpass.
Definition: renderer_types.h:127
Represents a texture.
Definition: resource_types.h:165
Definition: viewport.h:6
a 4x4 matrix, typically used to represent object transformations.
Definition: math_types.h:147
A 3-element vector.
Definition: math_types.h:49