Commit 3a2522de by Jamie Madill Committed by Commit Bot

Make TransformFeedbackTest deterministic.

Instead of using rand(), use a fixed seed RNG. This can ensure runs use the same draw call counts no matter the time of day. Note: there may have been a setting somewhere that was seeding the RNG because I wasn't seeing variation between test runs locally. This change makes it explicit. Bug: angleproject:4029 Change-Id: Ic51bf2a6779da3b96a3357eed99c0f7fa9d81648 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2042210Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 463c318a
...@@ -555,6 +555,8 @@ TEST_P(TransformFeedbackTest, MultiContext) ...@@ -555,6 +555,8 @@ TEST_P(TransformFeedbackTest, MultiContext)
EGL_NONE, EGL_NONE,
}; };
// Keep a fixed seed RNG so we are deterministic.
RNG rng(0);
EGLWindow *window = getEGLWindow(); EGLWindow *window = getEGLWindow();
EGLDisplay display = window->getDisplay(); EGLDisplay display = window->getDisplay();
...@@ -572,7 +574,7 @@ TEST_P(TransformFeedbackTest, MultiContext) ...@@ -572,7 +574,7 @@ TEST_P(TransformFeedbackTest, MultiContext)
}; };
ContextInfo contexts[32]; ContextInfo contexts[32];
const size_t maxDrawSize = 1024; const size_t maxDrawSize = 512;
std::vector<float> transformFeedbackData(maxDrawSize); std::vector<float> transformFeedbackData(maxDrawSize);
for (size_t i = 0; i < maxDrawSize; i++) for (size_t i = 0; i < maxDrawSize; i++)
...@@ -640,9 +642,9 @@ void main(void) ...@@ -640,9 +642,9 @@ void main(void)
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
// For each pass, draw between 0 and maxDrawSize primitives // For each pass, draw between 0 and maxDrawSize primitives
for (auto &primCount : context.primitiveCounts) for (size_t &primCount : context.primitiveCounts)
{ {
primCount = rand() % maxDrawSize; primCount = rng.randomIntBetween(1, maxDrawSize);
} }
glBeginTransformFeedback(GL_POINTS); glBeginTransformFeedback(GL_POINTS);
......
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