Add memoryBarrier before buffer map verify
authorJoe M. Kniss <djmk@google.com>
Fri, 16 Nov 2018 16:59:30 +0000 (08:59 -0800)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Fri, 15 Oct 2021 20:19:52 +0000 (20:19 +0000)
OpenGL ES 3.2 Specification Section 7.11.2:

Shader Memory Access Synchronization ...

"Explicit syncronization is required to ensure the effects of buffer and
texture data stores performed by shaders will be visible to subsequent
operations using the same objects..."

Many of the ES3.1 compute tests lack a memory barrier before mapping and
verifiying buffer contents.  This can lead to flaky test failures when
the buffer has not been completely written to by the dispatchCompute
command. Specifically, chromeos and it's android arc++ has seen
consistent, yet flaky failures in es31fSynchronizationTests.inter_invocation.

It is unclear why this test should fail when similar tests, which also
lack explicit synchronization, do not.

Cherry pick from AOSP.

Original commit:
https://android.googlesource.com/platform/external/deqp/+/30c710319864b9e952daaaaf098df20845c2f70d
https://android-review.googlesource.com/c/platform/external/deqp/+/854112

TEST=chromeos caroline-arcnext (skylake)
Affects: dEQP-GLES31.functional.synchronization.*
Components: AOSP
Google Bug: b/85161472

Change-Id: I5093e7e206996e7c13c8c3615ee01ebbadc42f58
Signed-off-by: Joe M. Kniss <djmk@google.com>
modules/gles31/functional/es31fSynchronizationTests.cpp

index 2e0ba6e..38f731e 100644 (file)
@@ -388,6 +388,7 @@ bool InterInvocationTestCase::verifyResults (void)
        bool                                    error                           = false;
 
        gl.bindBuffer(GL_SHADER_STORAGE_BUFFER, m_resultBuf);
+       gl.memoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT);
        mapped = gl.mapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, m_workWidth * m_workHeight * sizeof(deInt32), GL_MAP_READ_BIT);
        GLU_EXPECT_NO_ERROR(gl.getError(), "map buffer");