本文整理汇总了C++中AssetManager::find方法的典型用法代码示例。如果您正苦于以下问题:C++ AssetManager::find方法的具体用法?C++ AssetManager::find怎么用?C++ AssetManager::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssetManager
的用法示例。
在下文中一共展示了AssetManager::find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepare_spotmap_context
///////////////////////// prepare_spotmap_context ///////////////////////////
bool prepare_spotmap_context(DatumPlatform::PlatformInterface &platform, SpotMapContext &context, RenderContext &rendercontext, AssetManager &assets)
{
if (context.ready)
return true;
assert(context.vulkan);
if (!rendercontext.ready)
return false;
context.pipelinelayout = rendercontext.pipelinelayout;
context.scenedescriptor = rendercontext.scenedescriptor;
context.materialsetlayout = rendercontext.materialsetlayout;
context.modelsetlayout = rendercontext.modelsetlayout;
if (context.descriptorpool == 0)
{
// DescriptorPool
VkDescriptorPoolSize typecounts[2] = {};
typecounts[0].type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC;
typecounts[0].descriptorCount = 16;
typecounts[1].type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
typecounts[1].descriptorCount = 48;
VkDescriptorPoolCreateInfo descriptorpoolinfo = {};
descriptorpoolinfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
descriptorpoolinfo.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
descriptorpoolinfo.maxSets = accumulate(begin(typecounts), end(typecounts), 0, [](int i, auto &k) { return i + k.descriptorCount; });
descriptorpoolinfo.poolSizeCount = extentof(typecounts);
descriptorpoolinfo.pPoolSizes = typecounts;
context.descriptorpool = create_descriptorpool(context.vulkan, descriptorpoolinfo);
}
if (context.pipelinecache == 0)
{
// PipelineCache
VkPipelineCacheCreateInfo pipelinecacheinfo = {};
pipelinecacheinfo.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO;
context.pipelinecache = create_pipelinecache(context.vulkan, pipelinecacheinfo);
}
if (context.renderpass == 0)
{
//
// Render Pass
//
VkAttachmentDescription attachments[1] = {};
attachments[0].format = VK_FORMAT_D32_SFLOAT;
attachments[0].samples = VK_SAMPLE_COUNT_1_BIT;
attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
attachments[0].initialLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
attachments[0].finalLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
VkAttachmentReference depthreference = {};
depthreference.attachment = 0;
depthreference.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
VkSubpassDescription subpasses[1] = {};
subpasses[0].pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
subpasses[0].pDepthStencilAttachment = &depthreference;
VkRenderPassCreateInfo renderpassinfo = {};
renderpassinfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
renderpassinfo.attachmentCount = extentof(attachments);
renderpassinfo.pAttachments = attachments;
renderpassinfo.subpassCount = extentof(subpasses);
renderpassinfo.pSubpasses = subpasses;
context.renderpass = create_renderpass(context.vulkan, renderpassinfo);
}
if (context.srcblitpipeline == 0)
{
//
// Source Blit Pipeline
//
auto vs = assets.find(CoreAsset::spotmap_src_vert);
auto fs = assets.find(CoreAsset::spotmap_src_frag);
if (!vs || !fs)
return false;
asset_guard lock(assets);
auto vssrc = assets.request(platform, vs);
auto fssrc = assets.request(platform, fs);
if (!vssrc || !fssrc)
return false;
auto vsmodule = create_shadermodule(context.vulkan, vssrc, vs->length);
auto fsmodule = create_shadermodule(context.vulkan, fssrc, fs->length);
//.........这里部分代码省略.........