MCPcopy Create free account
hub / github.com/SFML/SFML / setupTextureSampler

Method setupTextureSampler

examples/vulkan/Vulkan.cpp:2101–2128  ·  view source on GitHub ↗

Create a sampler for our texture

Source from the content-addressed store, hash-verified

2099
2100 // Create a sampler for our texture
2101 void setupTextureSampler()
2102 {
2103 // Sampler parameters: linear min/mag filtering, 4x anisotropic
2104 VkSamplerCreateInfo samplerCreateInfo = VkSamplerCreateInfo();
2105 samplerCreateInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
2106 samplerCreateInfo.magFilter = VK_FILTER_LINEAR;
2107 samplerCreateInfo.minFilter = VK_FILTER_LINEAR;
2108 samplerCreateInfo.addressModeU = VK_SAMPLER_ADDRESS_MODE_REPEAT;
2109 samplerCreateInfo.addressModeV = VK_SAMPLER_ADDRESS_MODE_REPEAT;
2110 samplerCreateInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_REPEAT;
2111 samplerCreateInfo.anisotropyEnable = VK_TRUE;
2112 samplerCreateInfo.maxAnisotropy = 4;
2113 samplerCreateInfo.borderColor = VK_BORDER_COLOR_INT_OPAQUE_BLACK;
2114 samplerCreateInfo.unnormalizedCoordinates = VK_FALSE;
2115 samplerCreateInfo.compareEnable = VK_FALSE;
2116 samplerCreateInfo.compareOp = VK_COMPARE_OP_ALWAYS;
2117 samplerCreateInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR;
2118 samplerCreateInfo.mipLodBias = 0.0f;
2119 samplerCreateInfo.minLod = 0.0f;
2120 samplerCreateInfo.maxLod = 0.0f;
2121
2122 // Create our sampler
2123 if (vkCreateSampler(device, &samplerCreateInfo, nullptr, &textureSampler) != VK_SUCCESS)
2124 {
2125 vulkanAvailable = false;
2126 return;
2127 }
2128 }
2129
2130 // Set up our descriptor pool
2131 void setupDescriptorPool()

Callers

nothing calls this directly

Calls 1

VkSamplerCreateInfoClass · 0.70

Tested by

no test coverage detected