本文整理汇总了C++中ConfigSet::getNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigSet::getNumber方法的具体用法?C++ ConfigSet::getNumber怎么用?C++ ConfigSet::getNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigSet
的用法示例。
在下文中一共展示了ConfigSet::getNumber方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initScratch
Error ShadowMapping::initScratch(const ConfigSet& cfg)
{
// Init the shadowmaps and FBs
{
m_scratchTileCountX = cfg.getNumber("r.shadowMapping.scratchTileCountX");
m_scratchTileCountY = cfg.getNumber("r.shadowMapping.scratchTileCountY");
m_scratchTileResolution = cfg.getNumber("r.shadowMapping.tileResolution");
// RT
m_scratchRtDescr = m_r->create2DRenderTargetDescription(m_scratchTileResolution * m_scratchTileCountX,
m_scratchTileResolution * m_scratchTileCountY,
SHADOW_DEPTH_PIXEL_FORMAT,
"Scratch ShadMap");
m_scratchRtDescr.bake();
// FB
m_scratchFbDescr.m_depthStencilAttachment.m_loadOperation = AttachmentLoadOperation::CLEAR;
m_scratchFbDescr.m_depthStencilAttachment.m_clearValue.m_depthStencil.m_depth = 1.0f;
m_scratchFbDescr.m_depthStencilAttachment.m_aspect = DepthStencilAspectBit::DEPTH;
m_scratchFbDescr.bake();
}
m_scratchTileAlloc.init(getAllocator(), m_scratchTileCountX, m_scratchTileCountY, m_lodCount, false);
return Error::NONE;
}
示例2: initInternal
Error FinalComposite::initInternal(const ConfigSet& config)
{
ANKI_ASSERT("Initializing PPS");
ANKI_CHECK(loadColorGradingTexture("engine_data/DefaultLut.ankitex"));
m_fbDescr.m_colorAttachmentCount = 1;
m_fbDescr.m_colorAttachments[0].m_loadOperation = AttachmentLoadOperation::DONT_CARE;
m_fbDescr.bake();
ANKI_CHECK(getResourceManager().loadResource("engine_data/BlueNoiseLdrRgb64x64.ankitex", m_blueNoise));
// Progs
ANKI_CHECK(getResourceManager().loadResource("shaders/FinalComposite.glslp", m_prog));
ShaderProgramResourceMutationInitList<3> mutations(m_prog);
mutations.add("BLUE_NOISE", 1).add("BLOOM_ENABLED", 1).add("DBG_ENABLED", 0);
ShaderProgramResourceConstantValueInitList<3> consts(m_prog);
consts.add("LUT_SIZE", U32(LUT_SIZE))
.add("FB_SIZE", UVec2(m_r->getWidth(), m_r->getHeight()))
.add("MOTION_BLUR_SAMPLES", U32(config.getNumber("r.final.motionBlurSamples")));
const ShaderProgramResourceVariant* variant;
m_prog->getOrCreateVariant(mutations.get(), consts.get(), variant);
m_grProgs[0] = variant->getProgram();
mutations[2].m_value = 1;
m_prog->getOrCreateVariant(mutations.get(), consts.get(), variant);
m_grProgs[1] = variant->getProgram();
return Error::NONE;
}
示例3: initEsm
Error ShadowMapping::initEsm(const ConfigSet& cfg)
{
// Init RTs and FBs
{
m_esmTileResolution = cfg.getNumber("r.shadowMapping.tileResolution");
m_esmTileCountBothAxis = cfg.getNumber("r.shadowMapping.tileCountPerRowOrColumn");
// RT
TextureInitInfo texinit = m_r->create2DRenderTargetInitInfo(m_esmTileResolution * m_esmTileCountBothAxis,
m_esmTileResolution * m_esmTileCountBothAxis,
SHADOW_COLOR_PIXEL_FORMAT,
TextureUsageBit::SAMPLED_FRAGMENT | TextureUsageBit::FRAMEBUFFER_ATTACHMENT_WRITE
| TextureUsageBit::SAMPLED_COMPUTE,
"esm");
texinit.m_initialUsage = TextureUsageBit::SAMPLED_FRAGMENT;
ClearValue clearVal;
clearVal.m_colorf[0] = 1.0f;
m_esmAtlas = m_r->createAndClearRenderTarget(texinit, clearVal);
// FB
m_esmFbDescr.m_colorAttachments[0].m_loadOperation = AttachmentLoadOperation::LOAD;
m_esmFbDescr.m_colorAttachmentCount = 1;
m_esmFbDescr.bake();
}
// Tiles
m_esmTileAlloc.init(getAllocator(), m_esmTileCountBothAxis, m_esmTileCountBothAxis, m_lodCount, true);
// Programs and shaders
{
ANKI_CHECK(
getResourceManager().loadResource("shaders/ExponentialShadowmappingResolve.glslp", m_esmResolveProg));
ShaderProgramResourceConstantValueInitList<1> consts(m_esmResolveProg);
consts.add("INPUT_TEXTURE_SIZE",
UVec2(m_scratchTileCountX * m_scratchTileResolution, m_scratchTileCountY * m_scratchTileResolution));
const ShaderProgramResourceVariant* variant;
m_esmResolveProg->getOrCreateVariant(consts.get(), variant);
m_esmResolveGrProg = variant->getProgram();
}
return Error::NONE;
}
示例4: initInternal
Error ShadowMapping::initInternal(const ConfigSet& cfg)
{
ANKI_CHECK(initScratch(cfg));
ANKI_CHECK(initEsm(cfg));
m_lodDistances[0] = cfg.getNumber("r.shadowMapping.lightLodDistance0");
m_lodDistances[1] = cfg.getNumber("r.shadowMapping.lightLodDistance1");
return Error::NONE;
}
示例5: initInternal
Error Ssr::initInternal(const ConfigSet& cfg)
{
U32 width = m_r->getWidth() / SSR_FRACTION;
U32 height = m_r->getHeight() / SSR_FRACTION;
ANKI_R_LOGI("Initializing SSR pass (%ux%u)", width, height);
// Create RTs
TextureInitInfo texinit = m_r->create2DRenderTargetInitInfo(width,
height,
Format::R16G16B16A16_SFLOAT,
TextureUsageBit::IMAGE_COMPUTE_READ_WRITE | TextureUsageBit::SAMPLED_FRAGMENT,
"SSR");
texinit.m_initialUsage = TextureUsageBit::SAMPLED_FRAGMENT;
m_rt = m_r->createAndClearRenderTarget(texinit);
// Create shader
ANKI_CHECK(getResourceManager().loadResource("shaders/Ssr.glslp", m_prog));
ShaderProgramResourceConstantValueInitList<5> consts(m_prog);
consts.add("FB_SIZE", UVec2(width, height));
consts.add("WORKGROUP_SIZE", UVec2(m_workgroupSize[0], m_workgroupSize[1]));
consts.add("MAX_STEPS", U32(cfg.getNumber("r.ssr.maxSteps")));
consts.add("LIGHT_BUFFER_MIP_COUNT", U32(m_r->getDownscaleBlur().getMipmapCount()));
consts.add("HISTORY_COLOR_BLEND_FACTOR", F32(cfg.getNumber("r.ssr.historyBlendFactor")));
ShaderProgramResourceMutationInitList<1> mutators(m_prog);
mutators.add("VARIANT", 0);
const ShaderProgramResourceVariant* variant;
m_prog->getOrCreateVariant(mutators.get(), consts.get(), variant);
m_grProg[0] = variant->getProgram();
mutators[0].m_value = 1;
m_prog->getOrCreateVariant(mutators.get(), consts.get(), variant);
m_grProg[1] = variant->getProgram();
return Error::NONE;
}
示例6: init
//==============================================================================
Error TransientMemoryManager::init(const ConfigSet& cfg)
{
Array<const char*, U(TransientBufferType::COUNT)> configVars = {
{"gr.uniformPerFrameMemorySize",
"gr.storagePerFrameMemorySize",
"gr.vertexPerFrameMemorySize",
"gr.transferPerFrameMemorySize"}};
const VkPhysicalDeviceLimits& limits =
m_manager->getImplementation().getPhysicalDeviceProperties().limits;
Array<U32, U(TransientBufferType::COUNT)> alignments = {
{U32(limits.minUniformBufferOffsetAlignment),
U32(limits.minStorageBufferOffsetAlignment),
sizeof(F32) * 4,
sizeof(F32) * 4}};
Array<BufferUsageBit, U(TransientBufferType::COUNT)> usages = {
{BufferUsageBit::UNIFORM_ANY_SHADER,
BufferUsageBit::STORAGE_ANY,
BufferUsageBit::VERTEX,
BufferUsageBit::TRANSFER_SOURCE}};
auto alloc = m_manager->getAllocator();
for(TransientBufferType i = TransientBufferType::UNIFORM;
i < TransientBufferType::COUNT;
++i)
{
PerFrameBuffer& frame = m_perFrameBuffers[i];
frame.m_size = cfg.getNumber(configVars[i]);
ANKI_ASSERT(frame.m_size);
// Create buffer
frame.m_buff = alloc.newInstance<BufferImpl>(m_manager);
ANKI_CHECK(frame.m_buff->init(
frame.m_size, usages[i], BufferMapAccessBit::WRITE));
frame.m_bufferHandle = frame.m_buff->getHandle();
// Map once
frame.m_mappedMem = static_cast<U8*>(
frame.m_buff->map(0, frame.m_size, BufferMapAccessBit::WRITE));
ANKI_ASSERT(frame.m_mappedMem);
// Init the allocator
frame.m_alloc.init(frame.m_size, alignments[i]);
}
return ErrorCode::NONE;
}