class new in Git master
#include <Magnum/Vk/Sampler.h>
Sampler Sampler.
Wraps a VkSampler, which describes how shaders perform texturing.
Sampler creation
The default-constructed SamplerCreateInfo uses a conservative setup with nearest neighbor filtering and will produce valid results with no need to set up anything else:
#include <Magnum/Vk/SamplerCreateInfo.h> … Vk::Sampler sampler{device, Vk::SamplerCreateInfo{}};
Usually, however, you'll want to set up filtering and mip level selection at least, along with other properties:
Vk::Sampler sampler{device, Vk::SamplerCreateInfo{} .setMinificationFilter(SamplerFilter::Linear, SamplerMipmap::Linear) .setMagnificationFilter(SamplerFilter::Linear) .setWrapping(SamplerWrapping::ClampToEdge) };
Public static functions
- static auto wrap(Device& device, VkSampler handle, HandleFlags flags = {}) -> Sampler
- Wrap existing Vulkan handle.
Constructors, destructors, conversion operators
Public functions
- auto operator=(const Sampler&) -> Sampler& deleted
- Copying is not allowed.
- auto operator=(Sampler&& other) -> Sampler& noexcept
- Move assignment.
- auto handle() -> VkSampler
- Underlying VkSampler handle.
- auto handleFlags() const -> HandleFlags
- Handle flags.
- auto release() -> VkSampler
- Release the underlying Vulkan sampler.
Function documentation
static Sampler Magnum:: Vk:: Sampler:: wrap(Device& device,
VkSampler handle,
HandleFlags flags = {})
Wrap existing Vulkan handle.
Parameters | |
---|---|
device | Vulkan device the sampler is created on |
handle | The VkSampler handle |
flags | Handle flags |
The handle
is expected to be originating from device
. Unlike a sampler created using a constructor, the Vulkan sampler is by default not deleted on destruction, use flags
for different behavior.
Magnum:: Vk:: Sampler:: Sampler(Device& device,
const SamplerCreateInfo& info) explicit
Constructor.
Parameters | |
---|---|
device | Vulkan device to create the sampler on |
info | Sampler creation info |
Magnum:: Vk:: Sampler:: ~Sampler()
Destructor.
Destroys associated VkSampler handle, unless the instance was created using wrap() without HandleFlag::
Magnum:: Vk:: Sampler:: operator VkSampler()
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
VkSampler Magnum:: Vk:: Sampler:: release()
Release the underlying Vulkan sampler.
Releases ownership of the Vulkan sampler and returns its handle so vkDestroySampler() is not called on destruction. The internal state is then equivalent to moved-from state.