MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / parse_sampler

Method parse_sampler

framework/gltf_loader.cpp:1499–1525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1497}
1498
1499std::unique_ptr<vkb::scene_graph::components::SamplerC> GLTFLoader::parse_sampler(const tinygltf::Sampler &gltf_sampler) const
1500{
1501 auto name = gltf_sampler.name;
1502
1503 VkFilter min_filter = find_min_filter(gltf_sampler.minFilter);
1504 VkFilter mag_filter = find_mag_filter(gltf_sampler.magFilter);
1505
1506 VkSamplerMipmapMode mipmap_mode = find_mipmap_mode(gltf_sampler.minFilter);
1507
1508 VkSamplerAddressMode address_mode_u = find_wrap_mode(gltf_sampler.wrapS);
1509 VkSamplerAddressMode address_mode_v = find_wrap_mode(gltf_sampler.wrapT);
1510
1511 VkSamplerCreateInfo sampler_info{VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO};
1512
1513 sampler_info.magFilter = mag_filter;
1514 sampler_info.minFilter = min_filter;
1515 sampler_info.mipmapMode = mipmap_mode;
1516 sampler_info.addressModeU = address_mode_u;
1517 sampler_info.addressModeV = address_mode_v;
1518 sampler_info.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
1519 sampler_info.maxLod = std::numeric_limits<float>::max();
1520
1521 core::Sampler vk_sampler{device, sampler_info};
1522 vk_sampler.set_debug_name(gltf_sampler.name);
1523
1524 return std::make_unique<vkb::scene_graph::components::SamplerC>(name, std::move(vk_sampler));
1525}
1526
1527std::unique_ptr<sg::Texture> GLTFLoader::parse_texture(const tinygltf::Texture &gltf_texture) const
1528{

Callers

nothing calls this directly

Calls 5

find_min_filterFunction · 0.85
find_mag_filterFunction · 0.85
find_mipmap_modeFunction · 0.85
find_wrap_modeFunction · 0.85
set_debug_nameMethod · 0.45

Tested by

no test coverage detected