Class VulkanShader#
Defined in File VulkanShader.h
Inheritance Relationships#
Base Type#
public TRAP::Graphics::Shader
(Class Shader)
Class Documentation#
-
class VulkanShader : public TRAP::Graphics::Shader#
Public Functions
-
VulkanShader(RendererAPI::ShaderType shaderType, std::string name, const std::filesystem::path &filepath, const RendererAPI::BinaryShaderDesc &desc, const std::vector<Macro> &userMacros = {})#
Constructor.
- Parameters:
shaderType – Type of the shader.
name – Name for the shader.
filepath – Filepath of the shader.
desc – Binary shader description.
userMacros – Optional user defined macros. Default: nullptr.
-
VulkanShader(RendererAPI::ShaderType shaderType, std::string name, const RendererAPI::BinaryShaderDesc &desc, const std::vector<Macro> &userMacros = {})#
Constructor.
- Parameters:
shaderType – Type of the shader.
name – Name for the shader.
desc – Binary shader description.
userMacros – Optional user defined macros. Default: nullptr.
-
VulkanShader(RendererAPI::ShaderType shaderType, std::string name, const std::filesystem::path &filepath, const std::vector<Macro> &userMacros = {})#
Constructor. Creates an invalid placeholder shader.
Note
Used for invalid shaders, this doesn’t create a usable shader.
-
~VulkanShader() override#
Destructor.
-
consteval VulkanShader(const VulkanShader&) noexcept = delete#
Copy constructor.
-
consteval VulkanShader &operator=(const VulkanShader&) noexcept = delete#
Copy assignment operator.
-
VulkanShader(VulkanShader&&) noexcept = default#
Move constructor.
-
VulkanShader &operator=(VulkanShader&&) noexcept = default#
Move assignment operator.
-
constexpr std::span<const VkShaderModule> GetVkShaderModules() const noexcept#
Retrieve the Vulkan shader module handles of each contained shader stage.
- Returns:
Vulkan shader module handles.
-
TRAP::Ref<ShaderReflection::PipelineReflection> GetReflection() const noexcept#
Retrieve the reflection data of each contained shader stage.
- Returns:
Shader reflection data.
-
virtual constexpr usize GetID() const noexcept override#
Retrieve the unique identifier of the shader.
Note
The ID of the shader changes when reloaded.
-
virtual void Use(const Window &window) override#
Use shader for rendering on the given window.
Remark
Headless mode: This function is not available in headless mode.
- Parameters:
window – Window to use the shader for.
-
virtual void UseTexture(u32 set, u32 binding, const TRAP::Graphics::Texture &texture, const Window &window) const override#
Use texture with this shader on the given window.
Remark
Headless mode: This function is not available in headless mode.
-
virtual void UseTextures(u32 set, u32 binding, const std::vector<const TRAP::Graphics::Texture*> &textures, const Window &window) const override#
Use multiple textures with this shader on the given window.
Remark
Headless mode: This function is not available in headless mode.
- Parameters:
set – Descriptor set to use the textures with.
binding – Binding point of the textures.
textures – Textures to use.
window – Window to use the shader for.
-
virtual void UseSampler(u32 set, u32 binding, const TRAP::Graphics::Sampler &sampler, const Window &window) const override#
Use sampler with this shader on the given window.
Remark
Headless mode: This function is not available in headless mode.
-
virtual void UseSamplers(u32 set, u32 binding, const std::vector<const TRAP::Graphics::Sampler*> &samplers, const Window &window) const override#
Use multiple samplers with this shader on the given window.
Remark
Headless mode: This function is not available in headless mode.
- Parameters:
set – Descriptor set to use the samplers with.
binding – Binding point of the samplers.
samplers – Samplers to use.
window – Window to use the shader for.
-
virtual void UseUBO(u32 set, u32 binding, const TRAP::Graphics::UniformBuffer &uniformBuffer, u64 size, u64 offset, const Window &window) const override#
Use uniform buffer object with this shader on the given window.
Remark
Headless mode: This function is not available in headless mode.
- Parameters:
set – Descriptor set to use the UBO with.
binding – Binding point of the UBO.
uniformBuffer – Uniform buffer to use.
size – Size of the UBO.
offset – Offset of the UBO.
window – Window to use the shader for.
-
virtual void UseSSBO(u32 set, u32 binding, const TRAP::Graphics::StorageBuffer &storageBuffer, u64 size, const Window &window) const override#
Use shader storage buffer object with this shader on the given window.
Remark
Headless mode: This function is not available in headless mode.
- Parameters:
set – Descriptor set to use the SSBO with.
binding – Binding point of the SSBO.
storageBuffer – Storage buffer to use.
size – Size of the SSBO.
window – Window to use the shader for.
-
VulkanShader(RendererAPI::ShaderType shaderType, std::string name, const std::filesystem::path &filepath, const RendererAPI::BinaryShaderDesc &desc, const std::vector<Macro> &userMacros = {})#