1#ifndef VULKAN_TEXTURESAMPLER
2#define VULKAN_TEXTURESAMPLER
4#include <vulkan/vulkan.h>
11namespace Vulkan {
class TextureSampler; }
20 VkSamplerCreateInfo samplerInfo{};
21 samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
22 samplerInfo.magFilter = VK_FILTER_LINEAR;
23 samplerInfo.minFilter = VK_FILTER_LINEAR;
24 samplerInfo.addressModeU = VK_SAMPLER_ADDRESS_MODE_REPEAT;
25 samplerInfo.addressModeV = VK_SAMPLER_ADDRESS_MODE_REPEAT;
26 samplerInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_REPEAT;
27 samplerInfo.anisotropyEnable = VK_TRUE;
28 samplerInfo.maxAnisotropy = realGpu.
getProperties().limits.maxSamplerAnisotropy;
29 samplerInfo.borderColor = VK_BORDER_COLOR_INT_OPAQUE_BLACK;
30 samplerInfo.unnormalizedCoordinates = VK_FALSE;
31 samplerInfo.compareEnable = VK_FALSE;
32 samplerInfo.compareOp = VK_COMPARE_OP_ALWAYS;
33 samplerInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR;
34 samplerInfo.mipLodBias = 0.0f;
35 samplerInfo.minLod = 0.0f;
36 samplerInfo.maxLod = 0.0f;
38 if (VkResult result = vkCreateSampler(+virtualGpu, &samplerInfo,
nullptr, &textureSampler); result != VK_SUCCESS) {
51 vkDestroySampler(+*virtualGpu, textureSampler,
nullptr);
56 return textureSampler;
61 VkSampler textureSampler;
A logical device is an abstraction of the physical GPU which we can mainly use to send commands.
Definition: LogicalDevice.h:15
Represents the GPU (or any other device) that will be used with Vulkan to perform computer graphics.
Definition: PhysicalDevice.h:17
VkPhysicalDeviceProperties getProperties() const
Definition: PhysicalDevice.h:43
A TextureSampler is an object which is used to apply filters (anisotropic, interpolation,...
Definition: TextureSampler.h:16
TextureSampler(TextureSampler &&)=delete
TextureSampler(const TextureSampler &)=delete
TextureSampler(const LogicalDevice &virtualGpu, const PhysicalDevice &realGpu)
Definition: TextureSampler.h:19
const VkSampler & operator+() const
Definition: TextureSampler.h:55
~TextureSampler()
Definition: TextureSampler.h:50
TextureSampler & operator=(TextureSampler &&)=delete
TextureSampler & operator=(const TextureSampler &)=delete
Generic runtime exception thrown by Vulkan-related functions.
Definition: VulkanException.h:13
Types of queue families.
Definition: Animations.h:17