Mesa (master): osmesa/test: Clear the stencil bits in the depth test.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 10 18:54:25 UTC 2020


Module: Mesa
Branch: master
Commit: 7497917cfd8972849c611087366a027fecdea80b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7497917cfd8972849c611087366a027fecdea80b

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Dec  9 10:04:10 2020 -0800

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 at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1243>

---

 src/gallium/targets/osmesa/test-render.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/targets/osmesa/test-render.cpp b/src/gallium/targets/osmesa/test-render.cpp
index 0ab1d550921..fbb0f3dfca2 100644
--- a/src/gallium/targets/osmesa/test-render.cpp
+++ b/src/gallium/targets/osmesa/test-render.cpp
@@ -186,7 +186,7 @@ TEST(OSMesaRenderTest, depth)
    ASSERT_EQ(depth_cpp, 4);
 
    glClearDepth(1.0);
-   glClear(GL_DEPTH_BUFFER_BIT);
+   glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    glFinish();
    EXPECT_EQ(depth[w * 0 + 0], 0x00ffffff);
    EXPECT_EQ(depth[w * 0 + 1], 0x00ffffff);



More information about the mesa-commit mailing list