class new in Git master
#include <Magnum/Vk/Shader.h>
Shader Shader.
Wraps a VkShaderModule, which contains a SPIR-V binary with one or more shader entrypoints.
Shader creation
The ShaderCreateInfo structure takes a single required parameter, which is the SPIR-V binary. Besides accepting a Corrade::
#include <Magnum/Vk/ShaderCreateInfo.h> … Vk::ShaderCreateInfo info{ *CORRADE_INTERNAL_ASSERT_EXPRESSION(Utility::Path::read("shader.spv")) }; … Vk::Shader shader{device, info};
Public static functions
- static auto wrap(Device& device, VkShaderModule handle, HandleFlags flags = {}) -> Shader
- Wrap existing Vulkan handle.
Constructors, destructors, conversion operators
Public functions
- auto operator=(const Shader&) -> Shader& deleted
- Copying is not allowed.
- auto operator=(Shader&& other) -> Shader& noexcept
- Move assignment.
- auto handle() -> VkShaderModule
- Underlying VkBuffer handle.
- auto handleFlags() const -> HandleFlags
- Handle flags.
- auto release() -> VkShaderModule
- Release the underlying Vulkan shader.
Function documentation
static Shader Magnum:: Vk:: Shader:: wrap(Device& device,
VkShaderModule handle,
HandleFlags flags = {})
Wrap existing Vulkan handle.
Parameters | |
---|---|
device | Vulkan device the shader is created on |
handle | The VkShaderModule handle |
flags | Handle flags |
The handle
is expected to be originating from device
. Unlike a shader created using a constructor, the Vulkan shader is by default not deleted on destruction, use flags
for different behavior.
Magnum:: Vk:: Shader:: Shader(Device& device,
const ShaderCreateInfo& info) explicit
Constructor.
Parameters | |
---|---|
device | Vulkan device to create the shader on |
info | Shader creation info |
Magnum:: Vk:: Shader:: ~Shader()
Destructor.
Destroys associated VkShaderModule handle, unless the instance was created using wrap() without HandleFlag::
Magnum:: Vk:: Shader:: operator VkShaderModule()
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
VkShaderModule Magnum:: Vk:: Shader:: release()
Release the underlying Vulkan shader.
Releases ownership of the Vulkan shader and returns its handle so vkDestroyShaderModule() is not called on destruction. The internal state is then equivalent to moved-from state.