Commit a9bee1b8 by Zhenyao Mo

Add row-sharing packing tests for VariablePacker_test.cpp

Recent test failures leads to suspicion that our variable packing algorithm is buggy - turns out to be an underlying driver bug. With the added test cases, such suspicion shouldn't even arise. BUG=angleproject:1142 TEST=angle_unittests Change-Id: I1fb3c5c7798d9ad17668a3d633286e031da79cab Reviewed-on: https://chromium-review.googlesource.com/295901Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Tested-by: 's avatarZhenyao Mo <zmo@chromium.org>
parent 465e6f45
......@@ -170,3 +170,33 @@ TEST(VariablePacking, NonSquareMats) {
EXPECT_FALSE(packer.CheckVariablesWithinPackingLimits(squareSize, vars));
}
}
// Scalar type variables can be packed sharing rows with other variables.
TEST(VariablePacking, ReuseRows)
{
VariablePacker packer;
std::vector<sh::ShaderVariable> vars;
const int kMaxRows = 512;
// uniform bool u0[129];
// uniform bool u1[129];
// uniform bool u2[129];
// uniform bool u3[129];
int num_arrays = 4;
int num_elements_per_array = kMaxRows / num_arrays + 1;
for (int ii = 0; ii < num_arrays; ++ii)
{
vars.push_back(sh::ShaderVariable(GL_BOOL, num_elements_per_array));
}
EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars));
vars.clear();
// uniform vec2 u0[257];
// uniform float u1[257];
// uniform int u1[257];
int num_elements_per_array = kMaxRows / 2 + 1;
vars.push_back(sh::ShaderVariable(GL_FLOAT_VEC2, num_elements_per_array));
vars.push_back(sh::ShaderVariable(GL_FLOAT, num_elements_per_array));
vars.push_back(sh::ShaderVariable(GL_INT, num_elements_per_array));
EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment