Skip to content

Commit

Permalink
Vulkan: Fix flakiness in MultipleProgramsShareDescriptors
Browse files Browse the repository at this point in the history
Precision differences causes the test to be flaky on some vendors.
The test is not validating color accuracy, there is no need to use
random numbers.

Bug: angleproject:42265270
Change-Id: Ied8794d14b394e049e5735d4c42a7baf6e3aca0f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6129616
Commit-Queue: mohan maiya <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
Reviewed-by: Yuxin Hu <[email protected]>
  • Loading branch information
Mohan Maiya authored and Angle LUCI CQ committed Dec 30, 2024
1 parent 017a938 commit 39882b2
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/tests/gl_tests/VulkanUniformUpdatesTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,15 @@ TEST_P(VulkanUniformUpdatesTest, MultipleProgramsShareDescriptors)
rx::ContextVk *contextVk = hackANGLE();
contextVk->setDefaultUniformBlocksMinSizeForTesting(512);

static constexpr size_t kNumPrograms = 2;
static constexpr size_t kDrawIterations = 4;
static constexpr GLint kPosLoc = 0;
constexpr size_t kNumPrograms = 2;
constexpr size_t kDrawIterations = 4;
constexpr GLint kPosLoc = 0;
const std::array<Vector3, kDrawIterations> uniforms = {
Vector3(0.1f, 0.2f, 0.3f), Vector3(0.4f, 0.5f, 0.6f), Vector3(0.7f, 0.8f, 0.9f),
Vector3(0.1f, 0.5f, 0.9f)};
const std::array<GLColor, kDrawIterations> expectedColors = {
GLColor(25, 51, 76, 255), GLColor(102, 127, 153, 255), GLColor(178, 204, 229, 255),
GLColor(25, 127, 229, 255)};

std::array<GLuint, kNumPrograms> programs = {};

Expand All @@ -592,18 +598,15 @@ TEST_P(VulkanUniformUpdatesTest, MultipleProgramsShareDescriptors)

ASSERT_GL_NO_ERROR();

RNG rng;

for (size_t drawIteration = 0; drawIteration < kDrawIterations; ++drawIteration)
{
for (GLuint program : programs)
{
Vector3 randVec = RandomVec3(rng.randomInt(), 0.0f, 1.0f);

glUseProgram(program);
glUniform4f(0, randVec.x(), randVec.y(), randVec.z(), 1.0f);
glUniform4f(0, uniforms[drawIteration].x(), uniforms[drawIteration].y(),
uniforms[drawIteration].z(), 1.0f);
glDrawArrays(GL_TRIANGLES, 0, 6);
EXPECT_PIXEL_COLOR_NEAR(0, 0, GLColor(randVec), 5);
EXPECT_PIXEL_COLOR_NEAR(0, 0, expectedColors[drawIteration], 5);
}
}

Expand Down

0 comments on commit 39882b2

Please sign in to comment.