Kore
Loading...
Searching...
No Matches
pipeline.h
Go to the documentation of this file.
1#pragma once
2
3#include <kinc/global.h>
4
5#include <kinc/backend/graphics5/pipeline.h>
6
8
9#include "constantlocation.h"
10#include "graphics.h"
11
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20struct kinc_g5_shader;
21
22// identical to kinc_g4_blending_factor_t
23typedef enum {
24 KINC_G5_BLEND_ONE,
25 KINC_G5_BLEND_ZERO,
26 KINC_G5_BLEND_SOURCE_ALPHA,
27 KINC_G5_BLEND_DEST_ALPHA,
28 KINC_G5_BLEND_INV_SOURCE_ALPHA,
29 KINC_G5_BLEND_INV_DEST_ALPHA,
30 KINC_G5_BLEND_SOURCE_COLOR,
31 KINC_G5_BLEND_DEST_COLOR,
32 KINC_G5_BLEND_INV_SOURCE_COLOR,
33 KINC_G5_BLEND_INV_DEST_COLOR,
34 KINC_G5_BLEND_CONSTANT,
35 KINC_G5_BLEND_INV_CONSTANT
36} kinc_g5_blending_factor_t;
37
38// identical to kinc_g4_blending_operation_t
39typedef enum {
40 KINC_G5_BLENDOP_ADD,
41 KINC_G5_BLENDOP_SUBTRACT,
42 KINC_G5_BLENDOP_REVERSE_SUBTRACT,
43 KINC_G5_BLENDOP_MIN,
44 KINC_G5_BLENDOP_MAX
45} kinc_g5_blending_operation_t;
46
47typedef enum kinc_g5_cull_mode { KINC_G5_CULL_MODE_CLOCKWISE, KINC_G5_CULL_MODE_COUNTERCLOCKWISE, KINC_G5_CULL_MODE_NEVER } kinc_g5_cull_mode_t;
48
49typedef enum kinc_g5_compare_mode {
50 KINC_G5_COMPARE_MODE_ALWAYS,
51 KINC_G5_COMPARE_MODE_NEVER,
52 KINC_G5_COMPARE_MODE_EQUAL,
53 KINC_G5_COMPARE_MODE_NOT_EQUAL,
54 KINC_G5_COMPARE_MODE_LESS,
55 KINC_G5_COMPARE_MODE_LESS_EQUAL,
56 KINC_G5_COMPARE_MODE_GREATER,
57 KINC_G5_COMPARE_MODE_GREATER_EQUAL
58} kinc_g5_compare_mode_t;
59
60typedef enum kinc_g5_stencil_action {
61 KINC_G5_STENCIL_ACTION_KEEP,
62 KINC_G5_STENCIL_ACTION_ZERO,
63 KINC_G5_STENCIL_ACTION_REPLACE,
64 KINC_G5_STENCIL_ACTION_INCREMENT,
65 KINC_G5_STENCIL_ACTION_INCREMENT_WRAP,
66 KINC_G5_STENCIL_ACTION_DECREMENT,
67 KINC_G5_STENCIL_ACTION_DECREMENT_WRAP,
68 KINC_G5_STENCIL_ACTION_INVERT
69} kinc_g5_stencil_action_t;
70
71typedef struct kinc_g5_pipeline {
72 kinc_g5_vertex_structure_t *inputLayout[16];
73 struct kinc_g5_shader *vertexShader;
74 struct kinc_g5_shader *fragmentShader;
75 struct kinc_g5_shader *geometryShader;
76 struct kinc_g5_shader *tessellationControlShader;
77 struct kinc_g5_shader *tessellationEvaluationShader;
78
79 kinc_g5_cull_mode_t cullMode;
80
81 bool depthWrite;
82 kinc_g5_compare_mode_t depthMode;
83
84 kinc_g5_compare_mode_t stencilMode;
85 kinc_g5_stencil_action_t stencilBothPass;
86 kinc_g5_stencil_action_t stencilDepthFail;
87 kinc_g5_stencil_action_t stencilFail;
88 int stencilReferenceValue;
89 int stencilReadMask;
90 int stencilWriteMask;
91
92 // One, Zero deactivates blending
93 kinc_g5_blending_factor_t blend_source;
94 kinc_g5_blending_factor_t blend_destination;
95 kinc_g5_blending_operation_t blend_operation;
96 kinc_g5_blending_factor_t alpha_blend_source;
97 kinc_g5_blending_factor_t alpha_blend_destination;
98 kinc_g5_blending_operation_t alpha_blend_operation;
99
100 bool colorWriteMaskRed[8]; // Per render target
101 bool colorWriteMaskGreen[8];
102 bool colorWriteMaskBlue[8];
103 bool colorWriteMaskAlpha[8];
104
105 int colorAttachmentCount;
106 kinc_g5_render_target_format_t colorAttachment[8];
107
108 int depthAttachmentBits;
109 int stencilAttachmentBits;
110
111 bool conservativeRasterization;
112
113 PipelineState5Impl impl;
114} kinc_g5_pipeline_t;
115
120KINC_FUNC void kinc_g5_pipeline_init(kinc_g5_pipeline_t *pipeline);
121
122void kinc_g5_internal_pipeline_init(kinc_g5_pipeline_t *pipeline);
123
128KINC_FUNC void kinc_g5_pipeline_destroy(kinc_g5_pipeline_t *pipeline);
129
134KINC_FUNC void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipeline);
135
142KINC_FUNC kinc_g5_constant_location_t kinc_g5_pipeline_get_constant_location(kinc_g5_pipeline_t *pipeline, const char *name);
143
150KINC_FUNC kinc_g5_texture_unit_t kinc_g5_pipeline_get_texture_unit(kinc_g5_pipeline_t *pipeline, const char *name);
151
152#ifdef __cplusplus
153}
154#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.
Contains the base G5-functionality.
KINC_FUNC kinc_g5_constant_location_t kinc_g5_pipeline_get_constant_location(kinc_g5_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 void kinc_g5_pipeline_init(kinc_g5_pipeline_t *pipeline)
Initializes a pipeline.
KINC_FUNC void kinc_g5_pipeline_destroy(kinc_g5_pipeline_t *pipeline)
Destroys a pipeline.
KINC_FUNC kinc_g5_texture_unit_t kinc_g5_pipeline_get_texture_unit(kinc_g5_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_g5_pipeline_compile(kinc_g5_pipeline_t *pipeline)
Compiles a pipeline. After a pipeline has been compiled it is finalized. It cannot be compiled again ...
Provides types for setting up the structure of vertices in a vertex-buffer.
Definition pipeline.h:71
Definition shader.h:28