MayaFlux 0.4.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 BGRA8, ///< 8-bit BGRA unsigned normalized
149 BGRA8_SRGB, ///< 8-bit BGRA sRGB
150
151 // Floating point formats
152 R16F, ///< Single channel 16-bit float
153 RG16F, ///< Two channel 16-bit float
154 RGBA16F, ///< Four channel 16-bit float
155 R32F, ///< Single channel 32-bit float
156 RG32F, ///< Two channel 32-bit float
157 RGBA32F, ///< Four channel 32-bit float
158
159 R16, ///< Single channel 16-bit unsigned integer
160 RG16, ///< Two channel 16-bit unsigned integer
161 RGBA16, ///< Four channel 16-bit unsigned integer
162
163 // Depth/stencil formats
164 DEPTH16, ///< 16-bit depth
165 DEPTH24, ///< 24-bit depth
166 DEPTH32F, ///< 32-bit float depth
167 DEPTH24_STENCIL8 ///< 24-bit depth + 8-bit stencil
168};
169
170/**
171 * @enum FilterMode
172 * @brief Texture filtering mode
173 */
174enum class FilterMode : uint8_t {
175 NEAREST, ///< Nearest neighbor (pixelated)
176 LINEAR, ///< Bilinear filtering (smooth)
177 CUBIC ///< Bicubic filtering (high quality, slower)
178};
179
180/**
181 * @enum AddressMode
182 * @brief Texture addressing mode (wrapping)
183 */
184enum class AddressMode : uint8_t {
185 REPEAT, ///< Repeat texture
186 MIRRORED_REPEAT, ///< Mirror and repeat
187 CLAMP_TO_EDGE, ///< Clamp to edge color
188 CLAMP_TO_BORDER ///< Clamp to border color
189};
190
191/**
192 * @struct SamplerConfig
193 * @brief Sampler configuration
194 */
204
205/**
206 * @struct RenderConfig
207 * @brief Unified rendering configuration for graphics buffers
208 *
209 * This is the persistent state that processors query and react to.
210 * All rendering parameters in one place, independent of buffer type.
211 * Child buffer classes populate it with context-specific defaults
212 * during construction, then expose it to their processors.
213 *
214 * Design:
215 * - Owned by VKBuffer as persistent state
216 * - Processors query and react to changes
217 * - Child classes have their own convenience RenderConfig with defaults
218 * that bridge to this Portal-level config
219 */
221 std::shared_ptr<Core::Window> target_window;
222 std::string vertex_shader;
223 std::string fragment_shader;
224 std::string geometry_shader;
229
230 std::vector<std::pair<std::string, std::shared_ptr<Core::VKImage>>> additional_textures;
231
232 ///< For child-specific fields
233 std::unordered_map<std::string, std::string> extra_string_params;
234
235 bool operator==(const RenderConfig& other) const = default;
236};
237
238}
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
@ RG16
Two channel 16-bit unsigned integer.
@ BGRA8
8-bit BGRA unsigned normalized
@ RGBA16
Four channel 16-bit unsigned integer.
@ RGBA32F
Four channel 32-bit float.
@ R16F
Single channel 16-bit float.
@ R16
Single channel 16-bit unsigned integer.
@ 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.