本文整理汇总了C++中TMap::at方法的典型用法代码示例。如果您正苦于以下问题:C++ TMap::at方法的具体用法?C++ TMap::at怎么用?C++ TMap::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMap
的用法示例。
在下文中一共展示了TMap::at方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outputHLSLSamplerUniformGroup
void UniformHLSL::outputHLSLSamplerUniformGroup(
TInfoSinkBase &out,
const HLSLTextureSamplerGroup textureGroup,
const TVector<const TIntermSymbol *> &group,
const TMap<const TIntermSymbol *, TString> &samplerInStructSymbolsToAPINames,
unsigned int *groupTextureRegisterIndex)
{
if (group.empty())
{
return;
}
unsigned int groupRegisterCount = 0;
for (const TIntermSymbol *uniform : group)
{
const TType &type = uniform->getType();
const TString &name = uniform->getSymbol();
unsigned int registerCount;
// The uniform might be just a regular sampler or one extracted from a struct.
unsigned int samplerArrayIndex = 0u;
const Uniform *uniformByName = findUniformByName(name);
if (uniformByName)
{
samplerArrayIndex = assignUniformRegister(type, name, ®isterCount);
}
else
{
ASSERT(samplerInStructSymbolsToAPINames.find(uniform) !=
samplerInStructSymbolsToAPINames.end());
samplerArrayIndex = assignSamplerInStructUniformRegister(
type, samplerInStructSymbolsToAPINames.at(uniform), ®isterCount);
}
groupRegisterCount += registerCount;
if (type.isArray())
{
out << "static const uint " << DecorateIfNeeded(uniform->getName()) << ArrayString(type)
<< " = {";
for (unsigned int i = 0u; i < type.getArraySize(); ++i)
{
if (i > 0u)
out << ", ";
out << (samplerArrayIndex + i);
}
out << "};\n";
}
else
{
out << "static const uint " << DecorateIfNeeded(uniform->getName()) << " = "
<< samplerArrayIndex << ";\n";
}
}
TString suffix = TextureGroupSuffix(textureGroup);
// Since HLSL_TEXTURE_2D is the first group, it has a fixed offset of zero.
if (textureGroup != HLSL_TEXTURE_2D)
{
out << "static const uint textureIndexOffset" << suffix << " = "
<< (*groupTextureRegisterIndex) << ";\n";
out << "static const uint samplerIndexOffset" << suffix << " = "
<< (*groupTextureRegisterIndex) << ";\n";
}
out << "uniform " << TextureString(textureGroup) << " textures" << suffix << "["
<< groupRegisterCount << "]"
<< " : register(t" << (*groupTextureRegisterIndex) << ");\n";
out << "uniform " << SamplerString(textureGroup) << " samplers" << suffix << "["
<< groupRegisterCount << "]"
<< " : register(s" << (*groupTextureRegisterIndex) << ");\n";
*groupTextureRegisterIndex += groupRegisterCount;
}