Reduce the number of iterations of SwizzleTest.
KHR_debug from the GL drivers was generating a lot of spam.
BUG=angleproject:1925
Change-Id: I89568ea2bec3afb629f86c25d9e80aad1dbe79f8
Reviewed-on: https://chromium-review.googlesource.com/450857
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
diff --git a/src/tests/gl_tests/SwizzleTest.cpp b/src/tests/gl_tests/SwizzleTest.cpp
index b1ad131..3e53381 100644
--- a/src/tests/gl_tests/SwizzleTest.cpp
+++ b/src/tests/gl_tests/SwizzleTest.cpp
@@ -25,29 +25,34 @@
setConfigBlueBits(8);
setConfigAlphaBits(8);
- GLenum swizzles[] =
- {
- GL_RED,
- GL_GREEN,
- GL_BLUE,
- GL_ALPHA,
- GL_ZERO,
- GL_ONE,
+ constexpr GLenum swizzles[] = {
+ GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_ZERO, GL_ONE,
};
- for (int r = 0; r < 6; r++)
+ // Only use every 13th swizzle permutation, use a prime number to make sure the permuations
+ // are somewhat evenly distributed. Reduces the permuations from 1296 to 100.
+ constexpr size_t swizzleReductionFactor = 13;
+
+ size_t swizzleCount = 0;
+ for (GLenum r : swizzles)
{
- for (int g = 0; g < 6; g++)
+ for (GLenum g : swizzles)
{
- for (int b = 0; b < 6; b++)
+ for (GLenum b : swizzles)
{
- for (int a = 0; a < 6; a++)
+ for (GLenum a : swizzles)
{
+ swizzleCount++;
+ if (swizzleCount % swizzleReductionFactor != 0)
+ {
+ continue;
+ }
+
swizzlePermutation permutation;
- permutation.swizzleRed = swizzles[r];
- permutation.swizzleGreen = swizzles[g];
- permutation.swizzleBlue = swizzles[b];
- permutation.swizzleAlpha = swizzles[a];
+ permutation.swizzleRed = r;
+ permutation.swizzleGreen = g;
+ permutation.swizzleBlue = b;
+ permutation.swizzleAlpha = a;
mPermutations.push_back(permutation);
}
}
@@ -163,10 +168,8 @@
ASSERT_GL_NO_ERROR();
- for (size_t i = 0; i < mPermutations.size(); i++)
+ for (const auto &permutation : mPermutations)
{
- const swizzlePermutation& permutation = mPermutations[i];
-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, permutation.swizzleRed);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, permutation.swizzleGreen);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, permutation.swizzleBlue);