MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
ShaderFoundry.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <vulkan/vulkan.hpp>
4
5#include "GraphicsUtils.hpp"
6
7namespace MayaFlux::Core {
8class VulkanBackend;
9class VKShaderModule;
10class VKComputePipeline;
11class VKDescriptorManager;
12}
13
15
16class ComputePress;
17class RenderFlow;
18
19using ShaderID = uint64_t;
20using DescriptorSetID = uint64_t;
21using CommandBufferID = uint64_t;
22using FenceID = uint64_t;
23using SemaphoreID = uint64_t;
24
28constexpr FenceID INVALID_FENCE = 0;
30
31/**
32 * @struct ShaderCompilerConfig
33 * @brief Configuration for shader compilation
34 */
37 bool enable_debug_info = false; ///< Include debug symbols (line numbers, variable names)
38 bool enable_reflection = true; ///< Extract descriptor bindings and metadata
39 bool enable_validation = true; ///< Validate SPIR-V after compilation
40 std::vector<std::string> include_directories; ///< Paths for #include resolution
41 std::unordered_map<std::string, std::string> defines; ///< Preprocessor macros
42
44};
45
46/**
47 * @struct ShaderSource
48 * @brief Shader source descriptor for compilation
49 */
51 std::string content; ///< Shader source code or SPIR-V path
53 std::string entry_point = "main";
54
55 enum class SourceType : uint8_t {
56 GLSL_STRING, ///< In-memory GLSL source
57 GLSL_FILE, ///< Path to .comp/.vert/.frag/etc
58 SPIRV_FILE ///< Path to .spv file
59 } type
61
62 ShaderSource() = default;
63 ShaderSource(std::string content_, ShaderStage stage_, SourceType type_)
64 : content(std::move(content_))
65 , stage(stage_)
66 , type(type_)
67 {
68 }
69};
70
71/**
72 * @struct DescriptorBindingInfo
73 * @brief Extracted descriptor binding information from shader reflection
74 */
76 uint32_t set;
77 uint32_t binding;
78 vk::DescriptorType type;
79 std::string name;
80};
81
82/**
83 * @struct DescriptorBindingConfig
84 * @brief Portal-level descriptor binding configuration
85 */
87 uint32_t set = 0;
88 uint32_t binding = 0;
89 vk::DescriptorType type = vk::DescriptorType::eStorageBuffer;
90
92 DescriptorBindingConfig(uint32_t s, uint32_t b, vk::DescriptorType t = vk::DescriptorType::eStorageBuffer)
93 : set(s)
94 , binding(b)
95 , type(t)
96 {
97 }
98};
99
100/**
101 * @struct PushConstantRangeInfo
102 * @brief Extracted push constant range from shader reflection
103 */
105 uint32_t offset;
106 uint32_t size;
107};
108
109/**
110 * @struct ShaderReflectionInfo
111 * @brief Extracted reflection information from compiled shader
112 */
115 std::string entry_point;
116 std::optional<std::array<uint32_t, 3>> workgroup_size;
117 std::vector<DescriptorBindingInfo> descriptor_bindings;
118 std::vector<PushConstantRangeInfo> push_constant_ranges;
119};
120
121/**
122 * @class ShaderFoundry
123 * @brief Portal-level shader compilation and caching
124 *
125 * ShaderFoundry is a thin glue layer that:
126 * - Wraps Core::VKShaderModule for convenient shader creation
127 * - Provides caching to avoid redundant compilation
128 * - Supports hot-reload workflows (watch files, recompile)
129 * - Returns VKShaderModule directly for use in pipelines
130 *
131 * Design Philosophy:
132 * - Manages compilation, NOT execution (that's Pipeline/Compute)
133 * - Returns VKShaderModule directly (no wrapping)
134 * - Simple, focused API aligned with VKShaderModule capabilities
135 * - Integrates with existing Core shader infrastructure
136 *
137 * Consumers:
138 * - VKBufferProcessor subclasses (compute shaders)
139 * - Future Yantra::ComputePipeline (compute shaders)
140 * - Future Yantra::RenderPipeline (graphics shaders)
141 * - Future DataProcessors (image processing shaders)
142 *
143 * Usage:
144 * auto& compiler = Portal::Graphics::ShaderFoundry::instance();
145 *
146 * // Compile from file
147 * auto shader = compiler.compile_from_file("shaders/my_kernel.comp");
148 *
149 * // Compile from string
150 * auto shader = compiler.compile_from_source(glsl_code, ShaderStage::COMPUTE);
151 *
152 * // Use in pipeline
153 * my_buffer_processor->set_shader(shader);
154 * my_compute_pipeline->set_shader(shader);
155 */
156class MAYAFLUX_API ShaderFoundry {
157public:
158 enum class CommandBufferType : uint8_t {
159 GRAPHICS,
160 COMPUTE,
161 TRANSFER
162 };
163
164private:
166 vk::DescriptorSet descriptor_set;
167 };
168
170 vk::CommandBuffer cmd;
173 vk::QueryPool timestamp_pool;
174 std::unordered_map<std::string, uint32_t> timestamp_queries;
175 };
176
177 struct FenceState {
178 vk::Fence fence;
180 };
181
183 vk::Semaphore semaphore;
184 };
185
186 struct ShaderState {
187 std::shared_ptr<Core::VKShaderModule> module;
188 std::string filepath;
190 std::string entry_point;
191 };
192
193public:
195 {
196 static ShaderFoundry compiler;
197 return compiler;
198 }
199
200 ShaderFoundry(const ShaderFoundry&) = delete;
202 ShaderFoundry(ShaderFoundry&&) noexcept = delete;
203 ShaderFoundry& operator=(ShaderFoundry&&) noexcept = delete;
204
205 /**
206 * @brief Initialize shader compiler
207 * @param backend Shared pointer to VulkanBackend
208 * @param config Compiler configuration
209 * @return True if initialization succeeded
210 *
211 * Must be called before compiling any shaders.
212 */
213 bool initialize(
214 const std::shared_ptr<Core::VulkanBackend>& backend,
215 const ShaderCompilerConfig& config = {});
216
217 /**
218 * @brief Shutdown and cleanup
219 *
220 * Destroys all cached shader modules.
221 * Safe to call multiple times.
222 */
223 void shutdown();
224
225 /**
226 * @brief Check if compiler is initialized
227 */
228 [[nodiscard]] bool is_initialized() const { return m_backend != nullptr; }
229
230 //==========================================================================
231 // Shader Compilation - Primary API
232 //==========================================================================
233
234 /**
235 * @brief Universal shader loader - auto-detects source type
236 * @param content File path, GLSL source string, or SPIR-V path
237 * @param stage Optional stage override (auto-detected if omitted)
238 * @param entry_point Entry point function name (default: "main")
239 * @return ShaderID, or INVALID_SHADER on failure
240 *
241 * Supports:
242 * - GLSL files: .comp, .vert, .frag, .geom, .tesc, .tese
243 * - SPIR-V files: .spv
244 *
245 * Stage auto-detection:
246 * .comp → COMPUTE
247 * .vert → VERTEX
248 * .frag → FRAGMENT
249 * .geom → GEOMETRY
250 * .tesc → TESS_CONTROL
251 * .tese → TESS_EVALUATION
252 *
253 * Examples:
254 * load_shader("shaders/kernel.comp"); // File
255 * load_shader("shaders/kernel.spv", COMPUTE); // SPIR-V
256 * load_shader("#version 450\nvoid main(){}", COMPUTE); // Source
257 */
258 ShaderID load_shader(
259 const std::string& content,
260 std::optional<ShaderStage> stage = std::nullopt,
261 const std::string& entry_point = "main");
262
263 /**
264 * @brief Load shader from explicit ShaderSource descriptor
265 * @param source Complete shader source specification
266 * @return ShaderID, or INVALID_SHADER on failure
267 */
268 ShaderID load_shader(const ShaderSource& source);
269
270 /**
271 * @brief Hot-reload shader (returns new ID)
272 */
273 ShaderID reload_shader(const std::string& filepath);
274
275 /**
276 * @brief Destroy shader (cleanup internal state)
277 */
278 void destroy_shader(ShaderID shader_id);
279
280 /**
281 * @brief Compile shader from ShaderSource descriptor
282 * @param shader_source Shader descriptor (path or source + type + stage)
283 * @return Compiled shader module, or nullptr on failure
284 *
285 * Unified interface that dispatches to appropriate compile method.
286 * Useful for abstracted shader loading pipelines.
287 */
288 std::shared_ptr<Core::VKShaderModule> compile(const ShaderSource& shader_source);
289
290 //==========================================================================
291 // Shader Introspection
292 //==========================================================================
293
294 /**
295 * @brief Get reflection info for compiled shader
296 * @param shader_id ID of compiled shader
297 * @return Reflection information
298 *
299 * Extracted during compilation if enabled in config.
300 * Includes descriptor bindings, push constant ranges, workgroup size, etc.
301 */
302 ShaderReflectionInfo get_shader_reflection(ShaderID shader_id);
303
304 /**
305 * @brief Get shader stage for compiled shader
306 * @param shader_id ID of compiled shader
307 * @return Shader stage (COMPUTE, VERTEX, FRAGMENT, etc.)
308 */
309 ShaderStage get_shader_stage(ShaderID shader_id);
310
311 /**
312 * @brief Get entry point name for compiled shader
313 * @param shader_id ID of compiled shader
314 * @return Entry point function name
315 */
316 std::string get_shader_entry_point(ShaderID shader_id);
317
318 //==========================================================================
319 // Hot-Reload Support
320 //==========================================================================
321
322 /**
323 * @brief Invalidate cache for specific shader
324 * @param cache_key File path or cache key
325 *
326 * Forces next compilation to recompile from source.
327 * Useful for hot-reload workflows.
328 */
329 void invalidate_cache(const std::string& cache_key);
330
331 /**
332 * @brief Invalidate entire shader cache
333 *
334 * Forces all subsequent compilations to recompile.
335 * Does NOT destroy existing shader modules (they remain valid).
336 */
337 void clear_cache();
338
339 /**
340 * @brief Hot-reload a shader from file
341 * @param filepath Path to shader file
342 * @return Recompiled shader module, or nullptr on failure
343 *
344 * Convenience method: invalidate_cache() + compile_from_file().
345 * Returns new shader module; consumers must update references.
346 */
347 std::shared_ptr<Core::VKShaderModule> hot_reload(const std::string& filepath);
348
349 //==========================================================================
350 // Configuration
351 //==========================================================================
352
353 /**
354 * @brief Update compiler configuration
355 * @param config New configuration
356 *
357 * Affects future compilations.
358 * Does NOT recompile existing shaders.
359 */
360 void set_config(const ShaderCompilerConfig& config);
361
362 /**
363 * @brief Get current compiler configuration
364 */
365 [[nodiscard]] const ShaderCompilerConfig& get_config() const { return m_config; }
366
367 /**
368 * @brief Add include directory for shader compilation
369 * @param directory Path to directory containing shader includes
370 *
371 * Used for #include resolution in GLSL files.
372 */
373 void add_include_directory(const std::string& directory);
374
375 /**
376 * @brief Add preprocessor define for shader compilation
377 * @param name Macro name
378 * @param value Macro value (optional)
379 *
380 * Example: define("DEBUG", "1") → #define DEBUG 1
381 */
382 void add_define(const std::string& name, const std::string& value = "");
383
384 //==========================================================================
385 // Introspection
386 //==========================================================================
387
388 /**
389 * @brief Check if shader is cached
390 * @param cache_key File path or cache key
391 */
392 [[nodiscard]] bool is_cached(const std::string& cache_key) const;
393
394 /**
395 * @brief Get all cached shader keys
396 */
397 [[nodiscard]] std::vector<std::string> get_cached_keys() const;
398
399 /**
400 * @brief Get number of cached shaders
401 */
402 [[nodiscard]] size_t get_cache_size() const { return m_shader_cache.size(); }
403
404 //==========================================================================
405 // Descriptor Set Management - ShaderFoundry allocates and tracks
406 //==========================================================================
407
408 /**
409 * @brief Allocate descriptor set for a pipeline
410 * @param pipeline_id Which pipeline this is for
411 * @param set_index Which descriptor set (0, 1, 2...)
412 * @return Descriptor set ID
413 */
414 DescriptorSetID allocate_descriptor_set(vk::DescriptorSetLayout layout);
415
416 /**
417 * @brief Update descriptor set with buffer binding
418 * @param descriptor_set_id ID of descriptor set to update
419 * @param binding Binding index within the descriptor set
420 * @param type Descriptor type (e.g., eStorageBuffer, eUniformBuffer)
421 * @param buffer Vulkan buffer to bind
422 * @param offset Offset within the buffer
423 * @param size Size of the buffer region
424 */
425 void update_descriptor_buffer(
426 DescriptorSetID descriptor_set_id,
427 uint32_t binding,
428 vk::DescriptorType type,
429 vk::Buffer buffer,
430 size_t offset,
431 size_t size);
432
433 /**
434 * @brief Update descriptor set with image binding
435 * @param descriptor_set_id ID of descriptor set to update
436 * @param binding Binding index within the descriptor set
437 * @param image_view Vulkan image view to bind
438 * @param sampler Vulkan sampler to bind
439 * @param layout Image layout (default: eShaderReadOnlyOptimal)
440 */
441 void update_descriptor_image(
442 DescriptorSetID descriptor_set_id,
443 uint32_t binding,
444 vk::ImageView image_view,
445 vk::Sampler sampler,
446 vk::ImageLayout layout = vk::ImageLayout::eShaderReadOnlyOptimal);
447
448 /**
449 * @brief Update descriptor set with storage image binding
450 * @param descriptor_set_id ID of descriptor set to update
451 * @param binding Binding index within the descriptor set
452 * @param image_view Vulkan image view to bind
453 * @param layout Image layout (default: eGeneral)
454 */
455 void update_descriptor_storage_image(
456 DescriptorSetID descriptor_set_id,
457 uint32_t binding,
458 vk::ImageView image_view,
459 vk::ImageLayout layout = vk::ImageLayout::eGeneral);
460
461 /**
462 * @brief Get Vulkan descriptor set handle from DescriptorSetID
463 * @param descriptor_set_id Descriptor set ID
464 * @return Vulkan descriptor set handle
465 */
466 vk::DescriptorSet get_descriptor_set(DescriptorSetID descriptor_set_id);
467
468 //==========================================================================
469 // Command Recording - ShaderFoundry manages command buffers
470 //==========================================================================
471
472 /**
473 * @brief Begin recording command buffer
474 * @param type Command buffer type (GRAPHICS, COMPUTE, TRANSFER)
475 * @return Command buffer ID
476 */
477 CommandBufferID begin_commands(CommandBufferType type);
478
479 /**
480 * @brief Get Vulkan command buffer handle from CommandBufferID
481 * @param cmd_id Command buffer ID
482 */
483 vk::CommandBuffer get_command_buffer(CommandBufferID cmd_id);
484
485 //==========================================================================
486 // Memory Barriers and Synchronization
487 //==========================================================================
488
489 /**
490 * @brief Submit command buffer and wait for completion
491 * @param cmd_id Command buffer ID to submit
492 */
493 void submit_and_wait(CommandBufferID cmd_id);
494
495 /**
496 * @brief Submit command buffer asynchronously, returning a fence
497 * @param cmd_id Command buffer ID to submit
498 * @return Fence ID to wait on later
499 */
500 FenceID submit_async(CommandBufferID cmd_id);
501
502 /**
503 * @brief Submit command buffer asynchronously, returning a semaphore
504 * @param cmd_id Command buffer ID to submit
505 * @return Semaphore ID to wait on later
506 */
507 SemaphoreID submit_with_signal(CommandBufferID cmd_id);
508
509 /**
510 * @brief Wait for fence to be signaled
511 * @param fence_id Fence ID to wait on
512 */
513 void wait_for_fence(FenceID fence_id);
514
515 /**
516 * @brief Wait for multiple fences to be signaled
517 * @param fence_ids Vector of fence IDs to wait on
518 */
519 void wait_for_fences(const std::vector<FenceID>& fence_ids);
520
521 /**
522 * @brief Check if fence is signaled
523 * @param fence_id Fence ID to check
524 * @return True if fence is signaled, false otherwise
525 */
526 bool is_fence_signaled(FenceID fence_id);
527
528 /**
529 * @brief Begin command buffer that waits on a semaphore
530 * @param type Command buffer type (GRAPHICS, COMPUTE, TRANSFER)
531 * @param wait_semaphore Semaphore ID to wait on
532 * @param wait_stage Pipeline stage to wait at
533 * @return Command buffer ID
534 */
535 CommandBufferID begin_commands_with_wait(
536 CommandBufferType type,
537 SemaphoreID wait_semaphore,
538 vk::PipelineStageFlags wait_stage);
539
540 /**
541 * @brief Get Vulkan fence handle from FenceID
542 * @param fence_id Fence ID
543 */
544 vk::Semaphore get_semaphore_handle(SemaphoreID semaphore_id);
545
546 /**
547 * @brief Insert buffer memory barrier
548 */
549 void buffer_barrier(
550 CommandBufferID cmd_id,
551 vk::Buffer buffer,
552 vk::AccessFlags src_access,
553 vk::AccessFlags dst_access,
554 vk::PipelineStageFlags src_stage,
555 vk::PipelineStageFlags dst_stage);
556
557 /**
558 * @brief Insert image memory barrier
559 */
560 void image_barrier(
561 CommandBufferID cmd_id,
562 vk::Image image,
563 vk::ImageLayout old_layout,
564 vk::ImageLayout new_layout,
565 vk::AccessFlags src_access,
566 vk::AccessFlags dst_access,
567 vk::PipelineStageFlags src_stage,
568 vk::PipelineStageFlags dst_stage);
569
570 //==========================================================================
571 // Queue Management
572 //==========================================================================
573
574 /**
575 * @brief Set Vulkan queues for command submission
576 */
577 void set_graphics_queue(vk::Queue queue);
578
579 /**
580 * @brief Set Vulkan queues for command submission
581 */
582 void set_compute_queue(vk::Queue queue);
583
584 /**
585 * @brief Set Vulkan queues for command submission
586 */
587 void set_transfer_queue(vk::Queue queue);
588
589 /**
590 * @brief Get Vulkan graphics queue
591 */
592 [[nodiscard]] vk::Queue get_graphics_queue() const;
593
594 /**
595 * @brief Get Vulkan compute queue
596 */
597 [[nodiscard]] vk::Queue get_compute_queue() const;
598
599 /**
600 * @brief Get Vulkan transfer queue
601 */
602 [[nodiscard]] vk::Queue get_transfer_queue() const;
603
604 //==========================================================================
605 // Profiling
606 //==========================================================================
607
608 void begin_timestamp(CommandBufferID cmd_id, const std::string& label = "");
609 void end_timestamp(CommandBufferID cmd_id, const std::string& label = "");
610
612 std::string label;
613 uint64_t duration_ns;
614 bool valid;
615 };
616
617 TimestampResult get_timestamp_result(CommandBufferID cmd_id, const std::string& label);
618
619 //==========================================================================
620 // Utilities
621 //==========================================================================
622
623 /**
624 * @brief Convert Portal ShaderStage to Vulkan ShaderStageFlagBits
625 */
626 static vk::ShaderStageFlagBits to_vulkan_stage(ShaderStage stage);
627
628 /**
629 * @brief Auto-detect shader stage from file extension
630 * @param filepath Path to shader file
631 * @return Detected stage, or nullopt if unknown
632 *
633 * Delegates to VKShaderModule::detect_stage_from_extension().
634 */
635 static std::optional<ShaderStage> detect_stage_from_extension(const std::string& filepath);
636
637private:
638 /**
639 * @enum DetectedSourceType
640 * @brief Internal enum for source type detection
641 */
642 enum class DetectedSourceType : uint8_t {
643 FILE_GLSL,
644 FILE_SPIRV,
645 SOURCE_STRING,
646 UNKNOWN
647 };
648
649 ShaderFoundry() = default;
651
652 std::shared_ptr<Core::VulkanBackend> m_backend;
654
655 std::unordered_map<std::string, std::shared_ptr<Core::VKShaderModule>> m_shader_cache;
656 std::unordered_map<ShaderID, ShaderState> m_shaders;
657 std::unordered_map<std::string, ShaderID> m_shader_filepath_cache;
658
659 std::shared_ptr<Core::VKDescriptorManager> m_global_descriptor_manager;
660 std::unordered_map<DescriptorSetID, DescriptorSetState> m_descriptor_sets;
661
662 std::unordered_map<CommandBufferID, CommandBufferState> m_command_buffers;
663 std::unordered_map<FenceID, FenceState> m_fences;
664 std::unordered_map<SemaphoreID, SemaphoreState> m_semaphores;
665
669
670 std::atomic<uint64_t> m_next_shader_id { 1 };
671 std::atomic<uint64_t> m_next_descriptor_set_id { 1 };
672 std::atomic<uint64_t> m_next_command_id { 1 };
673 std::atomic<uint64_t> m_next_fence_id { 1 };
674 std::atomic<uint64_t> m_next_semaphore_id { 1 };
675
676 DetectedSourceType detect_source_type(const std::string& content) const;
677 std::optional<std::filesystem::path> resolve_shader_path(const std::string& filepath) const;
678 std::string generate_source_cache_key(const std::string& source, ShaderStage stage) const;
679
680 std::shared_ptr<Core::VKShaderModule> create_shader_module();
681 vk::Device get_device() const;
682
683 //==========================================================================
684 // INTERNAL Shader Compilation Methods
685 //==========================================================================
686
687 std::shared_ptr<Core::VKShaderModule> compile_from_file(
688 const std::string& filepath,
689 std::optional<ShaderStage> stage = std::nullopt,
690 const std::string& entry_point = "main");
691
692 std::shared_ptr<Core::VKShaderModule> compile_from_source(
693 const std::string& source,
694 ShaderStage stage,
695 const std::string& entry_point = "main");
696
697 std::shared_ptr<Core::VKShaderModule> compile_from_source_cached(
698 const std::string& source,
699 ShaderStage stage,
700 const std::string& cache_key,
701 const std::string& entry_point = "main");
702
703 std::shared_ptr<Core::VKShaderModule> compile_from_spirv(
704 const std::string& spirv_path,
705 ShaderStage stage,
706 const std::string& entry_point = "main");
707
708 std::shared_ptr<Core::VKShaderModule> get_vk_shader_module(ShaderID shader_id);
709
710 friend class ComputePress;
711 friend class RenderFlow;
712
713 static bool s_initialized;
714};
715
716/**
717 * @brief Get the global shader compiler instance
718 * @return Reference to singleton shader compiler
719 *
720 * Must call initialize() before first use.
721 * Thread-safe after initialization.
722 */
723inline MAYAFLUX_API ShaderFoundry& get_shader_foundry()
724{
726}
727
728} // namespace MayaFlux::Portal::Graphics
Compute-specific pipeline and dispatch orchestration.
Graphics pipeline and render pass orchestration.
ShaderFoundry(const ShaderFoundry &)=delete
ShaderFoundry & operator=(const ShaderFoundry &)=delete
size_t get_cache_size() const
Get number of cached shaders.
void set_compute_queue(vk::Queue queue)
Set Vulkan queues for command submission.
DetectedSourceType
Internal enum for source type detection.
std::unordered_map< std::string, ShaderID > m_shader_filepath_cache
std::unordered_map< FenceID, FenceState > m_fences
void set_graphics_queue(vk::Queue queue)
Set Vulkan queues for command submission.
void set_transfer_queue(vk::Queue queue)
Set Vulkan queues for command submission.
ShaderFoundry(ShaderFoundry &&) noexcept=delete
std::unordered_map< std::string, std::shared_ptr< Core::VKShaderModule > > m_shader_cache
std::unordered_map< DescriptorSetID, DescriptorSetState > m_descriptor_sets
std::unordered_map< CommandBufferID, CommandBufferState > m_command_buffers
std::shared_ptr< Core::VKDescriptorManager > m_global_descriptor_manager
bool is_initialized() const
Check if compiler is initialized.
std::shared_ptr< Core::VulkanBackend > m_backend
std::unordered_map< SemaphoreID, SemaphoreState > m_semaphores
const ShaderCompilerConfig & get_config() const
Get current compiler configuration.
std::unordered_map< ShaderID, ShaderState > m_shaders
Portal-level shader compilation and caching.
void initialize()
Definition main.cpp:11
void shutdown()
Shutdown Portal::Graphics subsystem.
Definition Graphics.cpp:69
constexpr ShaderID INVALID_SHADER
ShaderStage
User-friendly shader stage enum.
constexpr FenceID INVALID_FENCE
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
constexpr DescriptorSetID INVALID_DESCRIPTOR_SET
constexpr SemaphoreID INVALID_SEMAPHORE
constexpr CommandBufferID INVALID_COMMAND_BUFFER
@ GRAPHICS
Standard real-time graphics processing domain.
Definition Domain.hpp:55
DescriptorBindingConfig(uint32_t s, uint32_t b, vk::DescriptorType t=vk::DescriptorType::eStorageBuffer)
Portal-level descriptor binding configuration.
Extracted descriptor binding information from shader reflection.
Extracted push constant range from shader reflection.
bool enable_reflection
Extract descriptor bindings and metadata.
std::vector< std::string > include_directories
Paths for #include resolution.
bool enable_debug_info
Include debug symbols (line numbers, variable names)
bool enable_validation
Validate SPIR-V after compilation.
std::unordered_map< std::string, std::string > defines
Preprocessor macros.
Configuration for shader compilation.
std::unordered_map< std::string, uint32_t > timestamp_queries
std::shared_ptr< Core::VKShaderModule > std::string filepath
std::optional< std::array< uint32_t, 3 > > workgroup_size
std::vector< PushConstantRangeInfo > push_constant_ranges
std::vector< DescriptorBindingInfo > descriptor_bindings
Extracted reflection information from compiled shader.
std::string content
Shader source code or SPIR-V path.
enum MayaFlux::Portal::Graphics::ShaderSource::SourceType type
ShaderSource(std::string content_, ShaderStage stage_, SourceType type_)
Shader source descriptor for compilation.