MCPcopy Create free account
hub / github.com/DragonJoker/RenderGraph / createSampler

Method createSampler

source/RenderGraph/ResourceHandler.cpp:381–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379 }
380
381 VkSampler ResourceHandler::createSampler( GraphContext & context
382 , std::string const & suffix
383 , SamplerDesc const & samplerDesc )
384 {
385 VkSampler result{};
386
387 if ( context.vkCreateSampler )
388 {
389 lock_type lock( m_samplersMutex );
390 VkSamplerCreateInfo createInfo{ VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
391 , nullptr
392 , 0u
393 , convert( samplerDesc.magFilter )
394 , convert( samplerDesc.minFilter )
395 , convert( samplerDesc.mipmapMode )
396 , convert( samplerDesc.addressModeU )
397 , convert( samplerDesc.addressModeV )
398 , convert( samplerDesc.addressModeW )
399 , samplerDesc.mipLodBias // mipLodBias
400 , VK_FALSE // anisotropyEnable
401 , 0.0f // maxAnisotropy
402 , VK_FALSE // compareEnable
403 , VK_COMPARE_OP_ALWAYS // compareOp
404 , samplerDesc.minLod
405 , samplerDesc.maxLod
406 , VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK
407 , VK_FALSE };
408 auto res = context.vkCreateSampler( context.device
409 , &createInfo
410 , context.allocator
411 , &result );
412 auto & sampler = m_samplers.try_emplace( result, Sampler{ result, {} } ).first->second;
413 checkVkResult( res, "Sampler creation" );
414 sampler.name = "Sampler_" + suffix;
415 crgRegisterObject( context, sampler.name, result );
416 }
417
418 return result;
419 }
420
421 VertexBuffer const * ResourceHandler::createQuadTriVertexBuffer( GraphContext & context
422 , std::string const & suffix

Callers

nothing calls this directly

Calls 3

checkVkResultFunction · 0.85
convertFunction · 0.70
makeHashFunction · 0.70

Tested by

no test coverage detected