osmesa/test: Clear the stencil bits in the depth test.

Since the depth buffer starts out as a malloc, and we weren't clearing it,
you could get undefined values in your top 8 bits.  This should fix
intermittent failures of the depth test.

(Sadly, valgrind wasn't catching this, presumably because the 32-bit value
there *is* written, just some bits are left undef)

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1243>
This commit is contained in:
Eric Anholt
2020-12-09 10:04:10 -08:00
committed by Marge Bot
parent a9a8e05b69
commit 7497917cfd

View File

@@ -186,7 +186,7 @@ TEST(OSMesaRenderTest, depth)
ASSERT_EQ(depth_cpp, 4); ASSERT_EQ(depth_cpp, 4);
glClearDepth(1.0); glClearDepth(1.0);
glClear(GL_DEPTH_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glFinish(); glFinish();
EXPECT_EQ(depth[w * 0 + 0], 0x00ffffff); EXPECT_EQ(depth[w * 0 + 0], 0x00ffffff);
EXPECT_EQ(depth[w * 0 + 1], 0x00ffffff); EXPECT_EQ(depth[w * 0 + 1], 0x00ffffff);