本文整理汇总了C++中VariablePacker类的典型用法代码示例。如果您正苦于以下问题:C++ VariablePacker类的具体用法?C++ VariablePacker怎么用?C++ VariablePacker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VariablePacker类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TEST
// Check special assumptions about packing non-square mats
TEST(VariablePacking, NonSquareMats) {
for (size_t mt = 0; mt < ArraySize(nonSqMatTypes); ++mt) {
GLenum type = nonSqMatTypes[mt];
int rows = gl::VariableRowCount(type);
int cols = gl::VariableColumnCount(type);
int squareSize = std::max(rows, cols);
std::vector<sh::ShaderVariable> vars;
vars.push_back(SimpleVar(type, 1));
// Fill columns
for (int row = 0; row < squareSize; row++) {
for (int col = squareSize; col < 4; ++col) {
vars.push_back(SimpleVar(GL_FLOAT, 1));
}
}
VariablePacker packer;
EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(squareSize, vars));
// and one scalar and packing should fail
vars.push_back(SimpleVar(GL_FLOAT, 1));
EXPECT_FALSE(packer.CheckVariablesWithinPackingLimits(squareSize, vars));
}
}
开发者ID:rtwf,项目名称:skia-externals,代码行数:30,代码来源:VariablePacker_test.cpp
示例2: ShCheckVariablesWithinPackingLimits
bool ShCheckVariablesWithinPackingLimits(
int maxVectors, ShVariableInfo *varInfoArray, size_t varInfoArraySize)
{
if (varInfoArraySize == 0)
return true;
ASSERT(varInfoArray);
std::vector<sh::ShaderVariable> variables;
for (size_t ii = 0; ii < varInfoArraySize; ++ii)
{
sh::ShaderVariable var(varInfoArray[ii].type, varInfoArray[ii].size);
variables.push_back(var);
}
VariablePacker packer;
return packer.CheckVariablesWithinPackingLimits(maxVectors, variables);
}
开发者ID:mariospr,项目名称:chromium-browser,代码行数:15,代码来源:ShaderLang.cpp
示例3: ShCheckVariablesWithinPackingLimits
int ShCheckVariablesWithinPackingLimits(
int maxVectors, ShVariableInfo* varInfoArray, size_t varInfoArraySize)
{
if (varInfoArraySize == 0)
return 1;
ASSERT(varInfoArray);
TVariableInfoList variables;
for (size_t ii = 0; ii < varInfoArraySize; ++ii)
{
TVariableInfo var(varInfoArray[ii].type, varInfoArray[ii].size);
variables.push_back(var);
}
VariablePacker packer;
return packer.CheckVariablesWithinPackingLimits(maxVectors, variables) ? 1 : 0;
}
开发者ID:vvuk,项目名称:angle-old,代码行数:15,代码来源:ShaderLang.cpp
示例4: enforcePackingRestrictions
bool TCompiler::enforcePackingRestrictions()
{
VariablePacker packer;
return packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
}
开发者ID:KTXSoftware,项目名称:angleproject,代码行数:5,代码来源:Compiler.cpp
示例5: TEST
TEST(VariablePacking, Pack) {
VariablePacker packer;
TVariableInfoList vars;
const int kMaxRows = 16;
// test no vars.
EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars));
ShDataType types[] = {
SH_FLOAT_MAT4, // 0
SH_FLOAT_MAT2, // 1
SH_FLOAT_VEC4, // 2
SH_INT_VEC4, // 3
SH_BOOL_VEC4, // 4
SH_FLOAT_MAT3, // 5
SH_FLOAT_VEC3, // 6
SH_INT_VEC3, // 7
SH_BOOL_VEC3, // 8
SH_FLOAT_VEC2, // 9
SH_INT_VEC2, // 10
SH_BOOL_VEC2, // 11
SH_FLOAT, // 12
SH_INT, // 13
SH_BOOL, // 14
SH_SAMPLER_2D, // 15
SH_SAMPLER_CUBE, // 16
SH_SAMPLER_EXTERNAL_OES, // 17
SH_SAMPLER_2D_RECT_ARB, // 18
};
for (size_t tt = 0; tt < sizeof(types) / sizeof(types[0]); ++tt) {
ShDataType type = types[tt];
int num_rows = VariablePacker::GetNumRows(type);
int num_components_per_row = VariablePacker::GetNumComponentsPerRow(type);
// Check 1 of the type.
vars.clear();
vars.push_back(TVariableInfo(type, 1));
EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars));
// Check exactly the right amount of 1 type as an array.
int num_vars = kMaxRows / num_rows;
vars.clear();
vars.push_back(TVariableInfo(type, num_vars));
EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars));
// test too many
vars.clear();
vars.push_back(TVariableInfo(type, num_vars + 1));
EXPECT_FALSE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars));
// Check exactly the right amount of 1 type as individual vars.
num_vars = kMaxRows / num_rows *
((num_components_per_row > 2) ? 1 : (4 / num_components_per_row));
vars.clear();
for (int ii = 0; ii < num_vars; ++ii) {
vars.push_back(TVariableInfo(type, 1));
}
EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars));
// Check 1 too many.
vars.push_back(TVariableInfo( type, 1));
EXPECT_FALSE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars));
}
// Test example from GLSL ES 3.0 spec chapter 11.
vars.clear();
vars.push_back(TVariableInfo(SH_FLOAT_VEC4, 1));
vars.push_back(TVariableInfo(SH_FLOAT_MAT3, 1));
vars.push_back(TVariableInfo(SH_FLOAT_MAT3, 1));
vars.push_back(TVariableInfo(SH_FLOAT_VEC2, 6));
vars.push_back(TVariableInfo(SH_FLOAT_VEC2, 4));
vars.push_back(TVariableInfo(SH_FLOAT_VEC2, 1));
vars.push_back(TVariableInfo(SH_FLOAT, 3));
vars.push_back(TVariableInfo(SH_FLOAT, 2));
vars.push_back(TVariableInfo(SH_FLOAT, 1));
EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars));
}
开发者ID:WHS-TechOps,项目名称:Aviator,代码行数:76,代码来源:VariablePacker_test.cpp
注:本文中的VariablePacker类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论