Kore
Loading...
Searching...
No Matches
pipeline.h
Go to the documentation of this file.
1#pragma once
2
3#include <kinc/global.h>
4
8
9#include <kinc/backend/graphics4/pipeline.h>
10
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
20struct kinc_g4_shader;
21
22typedef enum {
23 KINC_G4_BLEND_ONE,
24 KINC_G4_BLEND_ZERO,
25 KINC_G4_BLEND_SOURCE_ALPHA,
26 KINC_G4_BLEND_DEST_ALPHA,
27 KINC_G4_BLEND_INV_SOURCE_ALPHA,
28 KINC_G4_BLEND_INV_DEST_ALPHA,
29 KINC_G4_BLEND_SOURCE_COLOR,
30 KINC_G4_BLEND_DEST_COLOR,
31 KINC_G4_BLEND_INV_SOURCE_COLOR,
32 KINC_G4_BLEND_INV_DEST_COLOR,
33 KINC_G4_BLEND_CONSTANT,
34 KINC_G4_BLEND_INV_CONSTANT
35} kinc_g4_blending_factor_t;
36
37typedef enum {
38 KINC_G4_BLENDOP_ADD,
39 KINC_G4_BLENDOP_SUBTRACT,
40 KINC_G4_BLENDOP_REVERSE_SUBTRACT,
41 KINC_G4_BLENDOP_MIN,
42 KINC_G4_BLENDOP_MAX
43} kinc_g4_blending_operation_t;
44
45typedef enum {
46 KINC_G4_COMPARE_ALWAYS,
47 KINC_G4_COMPARE_NEVER,
48 KINC_G4_COMPARE_EQUAL,
49 KINC_G4_COMPARE_NOT_EQUAL,
50 KINC_G4_COMPARE_LESS,
51 KINC_G4_COMPARE_LESS_EQUAL,
52 KINC_G4_COMPARE_GREATER,
53 KINC_G4_COMPARE_GREATER_EQUAL
54} kinc_g4_compare_mode_t;
55
56typedef enum { KINC_G4_CULL_CLOCKWISE, KINC_G4_CULL_COUNTER_CLOCKWISE, KINC_G4_CULL_NOTHING } kinc_g4_cull_mode_t;
57
58typedef enum {
59 KINC_G4_STENCIL_KEEP,
60 KINC_G4_STENCIL_ZERO,
61 KINC_G4_STENCIL_REPLACE,
62 KINC_G4_STENCIL_INCREMENT,
63 KINC_G4_STENCIL_INCREMENT_WRAP,
64 KINC_G4_STENCIL_DECREMENT,
65 KINC_G4_STENCIL_DECREMENT_WRAP,
66 KINC_G4_STENCIL_INVERT
67} kinc_g4_stencil_action_t;
68
69typedef struct kinc_g4_pipeline {
70 struct kinc_g4_vertex_structure *input_layout[16];
71 struct kinc_g4_shader *vertex_shader;
72 struct kinc_g4_shader *fragment_shader;
73 struct kinc_g4_shader *geometry_shader;
74 struct kinc_g4_shader *tessellation_control_shader;
75 struct kinc_g4_shader *tessellation_evaluation_shader;
76
77 kinc_g4_cull_mode_t cull_mode;
78
79 bool depth_write;
80 kinc_g4_compare_mode_t depth_mode;
81
82 kinc_g4_compare_mode_t stencil_front_mode;
83 kinc_g4_stencil_action_t stencil_front_both_pass;
84 kinc_g4_stencil_action_t stencil_front_depth_fail;
85 kinc_g4_stencil_action_t stencil_front_fail;
86
87 kinc_g4_compare_mode_t stencil_back_mode;
88 kinc_g4_stencil_action_t stencil_back_both_pass;
89 kinc_g4_stencil_action_t stencil_back_depth_fail;
90 kinc_g4_stencil_action_t stencil_back_fail;
91
92 int stencil_reference_value;
93 int stencil_read_mask;
94 int stencil_write_mask;
95
96 // One, Zero deactivates blending
97 kinc_g4_blending_factor_t blend_source;
98 kinc_g4_blending_factor_t blend_destination;
99 kinc_g4_blending_operation_t blend_operation;
100 kinc_g4_blending_factor_t alpha_blend_source;
101 kinc_g4_blending_factor_t alpha_blend_destination;
102 kinc_g4_blending_operation_t alpha_blend_operation;
103
104 bool color_write_mask_red[8]; // Per render target
105 bool color_write_mask_green[8];
106 bool color_write_mask_blue[8];
107 bool color_write_mask_alpha[8];
108
109 int color_attachment_count;
110 kinc_g4_render_target_format_t color_attachment[8];
111
112 int depth_attachment_bits;
113 int stencil_attachment_bits;
114
115 bool conservative_rasterization;
116
117 kinc_g4_pipeline_impl_t impl;
118} kinc_g4_pipeline_t;
119
124KINC_FUNC void kinc_g4_pipeline_init(kinc_g4_pipeline_t *pipeline);
125
130KINC_FUNC void kinc_g4_pipeline_destroy(kinc_g4_pipeline_t *pipeline);
131
136KINC_FUNC void kinc_g4_pipeline_compile(kinc_g4_pipeline_t *pipeline);
137
144KINC_FUNC kinc_g4_constant_location_t kinc_g4_pipeline_get_constant_location(kinc_g4_pipeline_t *pipeline, const char *name);
145
152KINC_FUNC kinc_g4_texture_unit_t kinc_g4_pipeline_get_texture_unit(kinc_g4_pipeline_t *pipeline, const char *name);
153
154void kinc_g4_internal_set_pipeline(kinc_g4_pipeline_t *pipeline);
155void kinc_g4_internal_pipeline_set_defaults(kinc_g4_pipeline_t *pipeline);
156
157#ifdef __cplusplus
158}
159#endif
Provides basic functionality that's used all over the place. There's usually no need to manually incl...
Provides the constant_location-struct which is used for setting constants/uniforms in a shader.
KINC_FUNC void kinc_g4_pipeline_compile(kinc_g4_pipeline_t *pipeline)
Compiles a pipeline. After a pipeline has been compiled it is finalized. It cannot be compiled again ...
KINC_FUNC void kinc_g4_pipeline_destroy(kinc_g4_pipeline_t *pipeline)
Destroys a pipeline.
KINC_FUNC kinc_g4_constant_location_t kinc_g4_pipeline_get_constant_location(kinc_g4_pipeline_t *pipeline, const char *name)
Searches for a constant/uniform and returns a constant-location which can be used to change the const...
KINC_FUNC kinc_g4_texture_unit_t kinc_g4_pipeline_get_texture_unit(kinc_g4_pipeline_t *pipeline, const char *name)
Searches for a texture-declaration and returns a texture-unit which can be used to assign a texture.
KINC_FUNC void kinc_g4_pipeline_init(kinc_g4_pipeline_t *pipeline)
Initializes a pipeline.
Provides functions for handling render-targets.
Provides a texture-unit-struct which is used for setting textures in a shader.
Definition pipeline.h:69
Definition shader.h:26
Definition vertexstructure.h:133