MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
GraphicsUtils.hpp
Go to the documentation of this file.
1#pragma once
2
3namespace MayaFlux::Core {
4class Window;
5class VKImage;
6}
7
9
10//============================================================================
11// Primitive Topology
12//============================================================================
13
14/**
15 * @enum PrimitiveTopology
16 * @brief Vertex assembly primitive topology
17 *
18 * Used to configure how vertices are assembled into primitives
19 * before rasterization.
20 */
29
30//============================================================================
31// Rasterization
32//============================================================================
33
34/**
35 * @enum PolygonMode
36 * @brief Rasterization polygon mode
37 */
38enum class PolygonMode : uint8_t {
39 FILL,
40 LINE,
41 POINT
42};
43
44/**
45 * @enum CullMode
46 * @brief Face culling mode
47 */
48enum class CullMode : uint8_t {
49 NONE,
50 FRONT,
51 BACK,
53};
54
55//============================================================================
56// Depth/Stencil
57//============================================================================
58
59/**
60 * @enum CompareOp
61 * @brief Depth/stencil comparison operation
62 */
63enum class CompareOp : uint8_t {
64 NEVER,
65 LESS,
66 EQUAL,
68 GREATER,
71 ALWAYS
72};
73
74//============================================================================
75// Blending
76//============================================================================
77
78/**
79 * @enum BlendFactor
80 * @brief Blending factor
81 */
94
95/**
96 * @enum BlendOp
97 * @brief Blending operation
98 */
99enum class BlendOp : uint8_t {
100 ADD,
101 SUBTRACT,
103 MIN,
104 MAX
105};
106
107//============================================================================
108// Shader Types
109//============================================================================
110
111/**
112 * @enum ShaderStage
113 * @brief User-friendly shader stage enum
114 *
115 * Abstracts vk::ShaderStageFlagBits for Portal API convenience.
116 * Maps directly to Vulkan stages internally.
117 */
118enum class ShaderStage : uint8_t {
119 COMPUTE,
120 VERTEX,
121 FRAGMENT,
122 GEOMETRY,
125 MESH,
126 TASK
127};
128
129//============================================================================
130// Image Helpers
131//============================================================================
132
133/**
134 * @enum ImageFormat
135 * @brief User-friendly image format enum
136 *
137 * Abstracts Vulkan formats for Portal API convenience.
138 * Maps to vk::Format internally.
139 */
140enum class ImageFormat : uint8_t {
141 // Normalized formats
142 R8, ///< Single channel 8-bit
143 RG8, ///< Two channel 8-bit
144 RGB8, ///< Three channel 8-bit
145 RGBA8, ///< Four channel 8-bit
146 RGBA8_SRGB, ///< Four channel 8-bit sRGB
147
148 // Floating point formats
149 R16F, ///< Single channel 16-bit float
150 RG16F, ///< Two channel 16-bit float
151 RGBA16F, ///< Four channel 16-bit float
152 R32F, ///< Single channel 32-bit float
153 RG32F, ///< Two channel 32-bit float
154 RGBA32F, ///< Four channel 32-bit float
155
156 // Depth/stencil formats
157 DEPTH16, ///< 16-bit depth
158 DEPTH24, ///< 24-bit depth
159 DEPTH32F, ///< 32-bit float depth
160 DEPTH24_STENCIL8 ///< 24-bit depth + 8-bit stencil
161};
162
163/**
164 * @enum FilterMode
165 * @brief Texture filtering mode
166 */
167enum class FilterMode : uint8_t {
168 NEAREST, ///< Nearest neighbor (pixelated)
169 LINEAR, ///< Bilinear filtering (smooth)
170 CUBIC ///< Bicubic filtering (high quality, slower)
171};
172
173/**
174 * @enum AddressMode
175 * @brief Texture addressing mode (wrapping)
176 */
177enum class AddressMode : uint8_t {
178 REPEAT, ///< Repeat texture
179 MIRRORED_REPEAT, ///< Mirror and repeat
180 CLAMP_TO_EDGE, ///< Clamp to edge color
181 CLAMP_TO_BORDER ///< Clamp to border color
182};
183
184/**
185 * @struct RenderConfig
186 * @brief Unified rendering configuration for graphics buffers
187 *
188 * This is the persistent state that processors query and react to.
189 * All rendering parameters in one place, independent of buffer type.
190 * Child buffer classes populate it with context-specific defaults
191 * during construction, then expose it to their processors.
192 *
193 * Design:
194 * - Owned by VKBuffer as persistent state
195 * - Processors query and react to changes
196 * - Child classes have their own convenience RenderConfig with defaults
197 * that bridge to this Portal-level config
198 */
200 std::shared_ptr<Core::Window> target_window;
201 std::string vertex_shader;
202 std::string fragment_shader;
203 std::string geometry_shader;
208
209 std::vector<std::pair<std::string, std::shared_ptr<Core::VKImage>>> additional_textures;
210
211 ///< For child-specific fields
212 std::unordered_map<std::string, std::string> extra_string_params;
213
214 bool operator==(const RenderConfig& other) const = default;
215};
216
217}
PolygonMode
Rasterization polygon mode.
AddressMode
Texture addressing mode (wrapping)
@ CLAMP_TO_BORDER
Clamp to border color.
ShaderStage
User-friendly shader stage enum.
FilterMode
Texture filtering mode.
@ LINEAR
Bilinear filtering (smooth)
@ NEAREST
Nearest neighbor (pixelated)
@ CUBIC
Bicubic filtering (high quality, slower)
BlendOp
Blending operation.
ImageFormat
User-friendly image format enum.
@ DEPTH24_STENCIL8
24-bit depth + 8-bit stencil
@ RGBA32F
Four channel 32-bit float.
@ R16F
Single channel 16-bit float.
@ RGBA16F
Four channel 16-bit float.
@ RG32F
Two channel 32-bit float.
@ R32F
Single channel 32-bit float.
@ RG16F
Two channel 16-bit float.
@ RGBA8_SRGB
Four channel 8-bit sRGB.
PrimitiveTopology
Vertex assembly primitive topology.
CompareOp
Depth/stencil comparison operation.
std::shared_ptr< Core::Window > target_window
std::unordered_map< std::string, std::string > extra_string_params
std::vector< std::pair< std::string, std::shared_ptr< Core::VKImage > > > additional_textures
For child-specific fields.
bool operator==(const RenderConfig &other) const =default
Unified rendering configuration for graphics buffers.