Magnum::Vk::Sampler class new in Git master

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

Sampler(Device& device, const SamplerCreateInfo& info) explicit
Constructor.
Sampler(NoCreateT) explicit
Construct without creating the sampler.
Sampler(const Sampler&) deleted
Copying is not allowed.
Sampler(Sampler&& other) noexcept
Move constructor.
~Sampler()
Destructor.
operator VkSampler()

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(NoCreateT) explicit

Construct without creating the sampler.

The constructed instance is equivalent to moved-from state. Useful in cases where you will overwrite the instance later anyway. Move another object over it to make it useful.

Magnum::Vk::Sampler::~Sampler()

Destructor.

Destroys associated VkSampler handle, unless the instance was created using wrap() without HandleFlag::DestroyOnDestruction specified.

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.