![]() |
Raven Engine v0.1
|
Represents a Vulkan shader, managing modules, reflection data, and descriptor sets. More...
#include <VulkanShader.h>
Classes | |
| struct | ReflectionData |
| Reflection data extracted from the shader code. More... | |
Public Member Functions | |
| VulkanShader (const std::string &filepath, bool forceCompile, bool disableOptimizations) | |
| Loads and creates a VulkanShader from a file. | |
| ~VulkanShader () | |
| Cleans up Vulkan resources on destruction. | |
| std::unordered_map< ShaderStage, Ref< ShaderModuleHandle > > | GetShaderModules () const override |
| Returns the Vulkan shader modules mapped by shader stage. | |
| const std::string & | GetName () const override |
| Gets the shader's human-readable name. | |
| const std::string & | GetFilePath () const override |
| Gets the file path from which the shader was loaded. | |
| const std::unordered_map< std::string, ShaderBuffer > & | GetShaderBuffers () const |
| Retrieves constant buffers declared in the shader. | |
| const std::unordered_map< std::string, ShaderResourceDeclaration > & | GetResources () const |
| Retrieves shader resource declarations. | |
| const std::vector< ShaderResource::PushConstantRange > & | GetPushConstantRanges () const |
| Gets the push constant ranges defined in the shader. | |
| const std::vector< ShaderResource::ShaderDescriptorSet > & | GetShaderDescriptorSets () const |
| Retrieves all descriptor sets used by the shader. | |
| VkWriteDescriptorSet & | GetWriteDescriptor (u32 set, const std::string &name) |
| Accesses a VkWriteDescriptorSet for a given descriptor set index and resource name. | |
| VkDescriptorSetLayout | GetDescriptorSetLayout (u32 set) |
| Gets the Vulkan descriptor set layout for a given set index. | |
| std::vector< VkDescriptorSet > | GetDescriptorSets () const |
| Retrieves all allocated Vulkan descriptor sets. | |
| VkDescriptorSet | GetDescriptorSet (u32 set) const |
| Gets the Vulkan descriptor set for a given index. | |
| const std::vector< VkDescriptorSetLayout > & | GetAllDescriptorLayouts () |
| Returns all descriptor set layouts. | |
| ShaderResource::UniformBuffer & | GetUniformBuffer (const u32 binding=0, const u32 set=0) |
| Gets a reference to a uniform buffer by binding and set indices. | |
| u32 | GetUniformBufferCount (u32 set=0) |
| Returns the number of uniform buffers in a descriptor set. | |
| Expected< std::pair< u32, u32 > > | FindUniformBinding (const std::string &name) const |
| Finds the descriptor set and binding index of a uniform buffer by name. | |
| Expected< std::pair< u32, u32 > > | FindImageBinding (const std::string &name) const |
| Finds the descriptor set and binding index of an image resource by name. | |
| Expected< std::pair< u32, u32 > > | FindSamplerBinding (const std::string &name) const |
| Finds the descriptor set and binding index of a sampler resource by name. | |
| bool | HasBinding (u32 setIndex, const std::string &name) const |
| Checks if a binding with the specified name exists in a set. | |
| Public Member Functions inherited from Raven::Shader | |
| virtual | ~Shader ()=default |
Friends | |
| class | VulkanShaderCompiler |
Additional Inherited Members | |
| Static Public Member Functions inherited from Raven::Shader | |
| static Ref< Shader > | Create (const std::string &filepath, bool forceCompile=false, bool disableOptimizations=false) |
| Factory method to create a shader from a file. | |
Represents a Vulkan shader, managing modules, reflection data, and descriptor sets.
Loads and compiles Vulkan shaders from file, holds SPIR-V binaries, reflection data (uniforms, resources), descriptor set layouts, and Vulkan descriptor sets.
| Raven::VulkanShader::VulkanShader | ( | const std::string & | filepath, |
| bool | forceCompile, | ||
| bool | disableOptimizations ) |
Loads and creates a VulkanShader from a file.
| filepath | Path to the shader source or SPIR-V file. |
| forceCompile | Forces shader recompilation (if supported). |
| disableOptimizations | Disables compiler optimizations during compilation. |
| Raven::VulkanShader::~VulkanShader | ( | ) |
Cleans up Vulkan resources on destruction.
| Expected< std::pair< u32, u32 > > Raven::VulkanShader::FindImageBinding | ( | const std::string & | name | ) | const |
Finds the descriptor set and binding index of an image resource by name.
| name | The image resource name. |
| Expected< std::pair< u32, u32 > > Raven::VulkanShader::FindSamplerBinding | ( | const std::string & | name | ) | const |
Finds the descriptor set and binding index of a sampler resource by name.
| name | The sampler resource name. |
| Expected< std::pair< u32, u32 > > Raven::VulkanShader::FindUniformBinding | ( | const std::string & | name | ) | const |
Finds the descriptor set and binding index of a uniform buffer by name.
| name | The uniform buffer name. |
|
inline |
Returns all descriptor set layouts.
|
inline |
Gets the Vulkan descriptor set for a given index.
| set | The descriptor set index. |
|
inline |
Gets the Vulkan descriptor set layout for a given set index.
| set | The descriptor set index. |
|
inline |
Retrieves all allocated Vulkan descriptor sets.
|
inlineoverridevirtual |
Gets the file path from which the shader was loaded.
Implements Raven::Shader.
|
overridevirtual |
|
inline |
Gets the push constant ranges defined in the shader.
|
inline |
Retrieves shader resource declarations.
|
inline |
Retrieves constant buffers declared in the shader.
|
inline |
Retrieves all descriptor sets used by the shader.
|
inlineoverridevirtual |
Returns the Vulkan shader modules mapped by shader stage.
Implements Raven::Shader.
| ShaderResource::UniformBuffer & Raven::VulkanShader::GetUniformBuffer | ( | const u32 | binding = 0, |
| const u32 | set = 0 ) |
Gets a reference to a uniform buffer by binding and set indices.
| binding | The binding index within the descriptor set. |
| set | The descriptor set index. |
Returns the number of uniform buffers in a descriptor set.
| set | The descriptor set index. |
|
inline |
Accesses a VkWriteDescriptorSet for a given descriptor set index and resource name.
| set | The descriptor set index. |
| name | The resource name within the descriptor set. |
| bool Raven::VulkanShader::HasBinding | ( | u32 | setIndex, |
| const std::string & | name ) const |
Checks if a binding with the specified name exists in a set.
| setIndex | set to look at |
| name | The name of the Uniform in the set |
|
friend |