|
MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
|
Wrapper for Vulkan shader module with lifecycle and reflection. More...
#include <VKShaderModule.hpp>
Collaboration diagram for MayaFlux::Core::VKShaderModule:Public Member Functions | |
| VKShaderModule ()=default | |
| ~VKShaderModule () | |
| VKShaderModule (const VKShaderModule &)=delete | |
| VKShaderModule & | operator= (const VKShaderModule &)=delete |
| VKShaderModule (VKShaderModule &&) noexcept | |
| VKShaderModule & | operator= (VKShaderModule &&) noexcept |
| bool | create_from_spirv (vk::Device device, const std::vector< uint32_t > &spirv_code, vk::ShaderStageFlagBits stage, const std::string &entry_point="main", bool enable_reflection=true) |
| Create shader module from SPIR-V binary. | |
| bool | create_from_spirv_file (vk::Device device, const std::string &spirv_path, vk::ShaderStageFlagBits stage, const std::string &entry_point="main", bool enable_reflection=true) |
| Create shader module from SPIR-V file. | |
| bool | create_from_glsl (vk::Device device, const std::string &glsl_source, vk::ShaderStageFlagBits stage, const std::string &entry_point="main", bool enable_reflection=true, const std::vector< std::string > &include_directories={}, const std::unordered_map< std::string, std::string > &defines={}) |
| Create shader module from GLSL source string. | |
| bool | create_from_glsl_file (vk::Device device, const std::string &glsl_path, std::optional< vk::ShaderStageFlagBits > stage=std::nullopt, const std::string &entry_point="main", bool enable_reflection=true, const std::vector< std::string > &include_directories={}, const std::unordered_map< std::string, std::string > &defines={}) |
| Create shader module from GLSL file. | |
| void | cleanup (vk::Device device) |
| Cleanup shader module. | |
| bool | is_valid () const |
| Check if module is valid. | |
| vk::ShaderModule | get () const |
| Get raw Vulkan shader module handle. | |
| vk::ShaderStageFlagBits | get_stage () const |
| Get shader stage. | |
| const std::string & | get_entry_point () const |
| Get entry point function name. | |
| vk::PipelineShaderStageCreateInfo | get_stage_create_info () const |
| Get pipeline shader stage create info. | |
| const ShaderReflection & | get_reflection () const |
| Get shader reflection metadata. | |
| const std::vector< uint32_t > & | get_spirv () const |
| Get SPIR-V bytecode. | |
| void | set_specialization_constants (const std::unordered_map< uint32_t, uint32_t > &constants) |
| Set specialization constants. | |
| void | set_preserve_spirv (bool preserve) |
| Enable SPIR-V preservation for hot-reload. | |
| Stage | get_stage_type () const |
| Get shader stage type. | |
| const VertexInputInfo & | get_vertex_input () const |
| Get vertex input state (vertex shaders only) | |
| bool | has_vertex_input () const |
| Check if vertex input is available. | |
| const FragmentOutputInfo & | get_fragment_output () const |
| Get fragment output state (fragment shaders only) | |
| const std::vector< PushConstantInfo > & | get_push_constants () const |
| Get detailed push constant info. | |
| std::optional< std::array< uint32_t, 3 > > | get_workgroup_size () const |
| Get compute workgroup size (compute shaders only) | |
Static Public Member Functions | |
| static std::optional< vk::ShaderStageFlagBits > | detect_stage_from_extension (const std::string &filepath) |
| Auto-detect shader stage from file extension. | |
Private Member Functions | |
| bool | reflect_spirv (const std::vector< uint32_t > &spirv_code) |
| Perform reflection on SPIR-V bytecode. | |
| std::vector< uint32_t > | compile_glsl_to_spirv (const std::string &glsl_source, vk::ShaderStageFlagBits stage, const std::vector< std::string > &include_directories, const std::unordered_map< std::string, std::string > &defines) |
| Compile GLSL to SPIR-V using shaderc. | |
| void | update_specialization_info () |
| Update specialization info from current map Called before get_stage_create_info() to ensure fresh data. | |
Static Private Member Functions | |
| static std::vector< uint32_t > | read_spirv_file (const std::string &filepath) |
| Read binary file into vector. | |
| static std::string | read_text_file (const std::string &filepath) |
| Read text file into string. | |
Private Attributes | |
| vk::ShaderModule | m_module = nullptr |
| vk::ShaderStageFlagBits | m_stage = vk::ShaderStageFlagBits::eCompute |
| std::string | m_entry_point = "main" |
| ShaderReflection | m_reflection |
| std::vector< uint32_t > | m_spirv_code |
| Preserved SPIR-V (if enabled) | |
| bool | m_preserve_spirv {} |
| std::unordered_map< uint32_t, uint32_t > | m_specialization_map |
| std::vector< vk::SpecializationMapEntry > | m_specialization_entries |
| std::vector< uint32_t > | m_specialization_data |
| vk::SpecializationInfo | m_specialization_info |
| VertexInputInfo | m_vertex_input |
| FragmentOutputInfo | m_fragment_output |
| std::vector< PushConstantInfo > | m_push_constants |
Wrapper for Vulkan shader module with lifecycle and reflection.
Responsibilities:
Does NOT handle:
Integration points:
Definition at line 130 of file VKShaderModule.hpp.