Bug 94455 - dEQP rgba8888d32s8 FBO mode doesn't work
Summary: dEQP rgba8888d32s8 FBO mode doesn't work
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Kenneth Graunke
QA Contact: Intel 3D Bugs Mailing List
Depends on:
Blocks: i965-deqp
  Show dependency treegraph
Reported: 2016-03-09 01:19 UTC by Kenneth Graunke
Modified: 2019-03-14 08:40 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Description Kenneth Graunke 2016-03-09 01:19:01 UTC
A lot of dEQP tests fail when run in FBO mode with 32-bit depth and 8-bit stencil.  You can activate this mode by passing --deqp-surface-type=fbo --deqp-gl-config-name=rgba8888d32s8.

For example,

./deqp-gles2 --deqp-surface-type=fbo --deqp-gl-config-name=rgba8888d32s8 --deqp-case=dEQP-GLES2.functional.fragment_ops.depth_stencil.stencil_depth_funcs.no_stencil_depth_always

Notably, d32s0 works, as do d16s8 and d24s8.
Comment 1 Iago Toral 2016-10-25 10:49:34 UTC
It seems that the cause of this is a bug in dEQP, that confuses the number of bits in the stencil buffer with the number of bits in the depth buffer when it renders the reference image.

Specifically, the test passes the depthBits where it should be passing stencilBits (so 32 where it should be using 8). As result, when it uses the number of stencil bits here:

int maskedVal = clear.stencil & ((1<<stencilBits)-1);

The result of ((1<<stencilBits)-1) overflows and causes incorrect result in maskedVal (the value to clear the stencil buffer to). For values of stencilBits that do not cause overflow (so 24, 16 or 8), the result of the AND operation leads to the same result as if we passed the correct number of stencil bits. That explains why the test only fails when we have 32b depth and stencil > 0b.

This patch to dEQP fixes the specific test case mentioned in the bug report and should fix others as well:

diff --git a/modules/gles2/functional/es2fDepthStencilTests.cpp b/modules/gles2/functional/es2fDepthStencilTests.cpp
index 793c7a3..eacda9e 100644
--- a/modules/gles2/functional/es2fDepthStencilTests.cpp
+++ b/modules/gles2/functional/es2fDepthStencilTests.cpp
@@ -669,7 +669,7 @@ DepthStencilCase::IterateResult DepthStencilCase::iterate (void)
                translateCommand(testCmd, refTestCmd, m_renderTarget);
                // Base clears.
-               renderReference(m_baseClears, m_refColorBuffer->getAccess(), m_refStencilBuffer->getAccess(), m_renderTarget.depthBits);
+               renderReference(m_baseClears, m_refColorBuffer->getAccess(), m_refStencilBuffer->getAccess(), m_renderTarget.stencilBits);
                // Base depths.
                for (vector<RefRenderCommand>::const_iterator cmd = m_refBaseDepthRenders.begin(); cmd != m_refBaseDepthRenders.end(); ++cmd)
Comment 2 Iago Toral 2016-10-25 11:38:52 UTC
Based on the previous comment I suggest we close this as RESOLVED/NOTOURBUG
Comment 3 Matt Turner 2016-10-25 17:38:59 UTC
(In reply to Iago Toral from comment #2)
> Based on the previous comment I suggest we close this as RESOLVED/NOTOURBUG

Thanks, done. Feel free to make the change yourself in the future.
Comment 4 Kenneth Graunke 2017-03-11 17:49:51 UTC
I submitted Iago's patch as:
Comment 5 Kenneth Graunke 2017-03-14 05:36:56 UTC
Patch landed in dEQP as commit d8d17bc4d9d9a3b2f9215ba04cbb9891dcf54ab1.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.