<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - comparison between same depths from glClearDepthf and fragment depth will fail"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=111170">111170</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>comparison between same depths from glClearDepthf and fragment depth will fail
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>19.1
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Drivers/DRI/i965
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>xing.xu@intel.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=144822" name="attach_144822" title="test case binary">attachment 144822</a> <a href="attachment.cgi?id=144822&action=edit" title="test case binary">[details]</a></span>
test case binary

****************************************
Issue analyze:
Take case “MaskedScissoredClearTest.Test/ES2_OpenGL_clear_cd” as an example. 

Summary of this case:
1),  Preset the depth buffer with value 0.5f, name it Zb, buffer depth
kClearDepth        = 0.5f;
glClearDepthf(kClearDepth);
2),  Draw quad with depth of 0.0f, name it Zf, fragment depth
drawQuad(depthTestProgram, essl1_shaders::PositionAttrib(), maskDepth ? 1.0f :
0.0f);

In theory, the depth 0.5f of glClearDepthf equals(GL_EQUAL) the depth of
drawQuad 0.0f. There is an equation between these two depths:
Zb = 0.5 x Zf + 0.5

On NVidia’s platform, we observed what we expected. On Intel platform, didn’t.

I also did below tests with different buffer depth and different depth func
(GL_GREATER and GL_LESS), you can easily see the relationship between Zf (0.0)
and Zb(0.5) on Intel platform(You may also refer to attachment
zbzf_testdata.png):
Zb      Zf  > (GL_GREATER)      < (GL_LESS)
0.5     0.0     √       x
0.499   0.0     √       x
0.501   0.0     x       √


****************************************
Reproduce steps (You may try the attached binary to reproduce):
1. Download angle source and install deps:
(<a href="https://github.com/google/angle/blob/master/doc/DevSetup.md">https://github.com/google/angle/blob/master/doc/DevSetup.md</a>)
git clone <a href="https://chromium.googlesource.com/angle/angle">https://chromium.googlesource.com/angle/angle</a>
cd angle
python scripts/bootstrap.py
gclient sync
git checkout master
./build/install-build-deps.sh
gn gen out/Release

2. Edit code(To enable the skipped test case)
--- a/src/tests/gl_tests/ClearTest.cpp
+++ b/src/tests/gl_tests/ClearTest.cpp
@@ -1248,7 +1248,7 @@ void
MaskedScissoredClearTestBase::MaskedScissoredColorDepthStencilClear(
                                                   &maskColor, &maskDepth,
&maskStencil, &scissor);

     // clearDepth && !maskDepth fails on Intel Ubuntu 19.04 Mesa 19.0.2 GL.
<a href="http://anglebug.com/3614">http://anglebug.com/3614</a>
-    ANGLE_SKIP_TEST_IF(IsLinux() && IsIntel() && IsDesktopOpenGL() &&
clearDepth && !maskDepth);
+    // ANGLE_SKIP_TEST_IF(IsLinux() && IsIntel() && IsDesktopOpenGL() &&
clearDepth && !maskDepth);


3. Build
ninja -C out/Release


4.  Run test case
./out/Release/angle_end2end_tests
--gtest_filter=MaskedScissoredClearTest.Test/ES2_OpenGL_clear_cd


I have reproduced this issue on below platform:
Mesa 19.1.1/Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated
Graphics Controller (rev 06)/Ubuntu 18.04

I can not reproduce this on:
OpenGL version string: 4.6.0 NVIDIA 430.26/GeForce GTX 1060/Ubuntu 18.04.
Windows 10/Intel UHD 630/



****************************************
The failed logs on Intel:
[----------] 1 test from MaskedScissoredClearTest
[ RUN   ] MaskedScissoredClearTest.Test/ES2_OpenGL_clear_cd
../../src/tests/gl_tests/ClearTest.cpp:1355: Failure
The difference between (expectedCenterColorRGB.R) and pixel[0] is 51, which
exceeds 1, where
(expectedCenterColorRGB.R) evaluates to 0,
pixel[0] evaluates to 51, and
1 evaluates to 1.
../../src/tests/gl_tests/ClearTest.cpp:1355: Failure
The difference between (expectedCenterColorRGB.G) and pixel[1] is 102, which
exceeds 1, where
(expectedCenterColorRGB.G) evaluates to 0,
pixel[1] evaluates to 102, and
1 evaluates to 1.


...
1 evaluates to 1.
[  FAILED  ] MaskedScissoredClearTest.Test/ES2_OpenGL_clear_cd, where
GetParam() = (ES2_OpenGL, 1, 1, 0, false) (38 ms)
[----------] 1 test from MaskedScissoredClearTest (38 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (38 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] MaskedScissoredClearTest.Test/ES2_OpenGL_clear_cd, where
GetParam() = (ES2_OpenGL, 1, 1, 0, false)

 1 FAILED TEST


****************************************
The pass logs on NV:

[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from MaskedScissoredClearTest
[ RUN   ] MaskedScissoredClearTest.Test/ES2_OpenGL_clear_cd
[       OK ] MaskedScissoredClearTest.Test/ES2_OpenGL_clear_cd (90 ms)
[----------] 1 test from MaskedScissoredClearTest (90 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (90 ms total)
[  PASSED  ] 1 test.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>