| https://gitlab.freedesktop.org/mesa/mesa/-/issues/8926 |
| https://gerrit.khronos.org/c/vk-gl-cts/+/11076 |
| |
| From 44f1be32fe6bd2a7de7b9169fc71cc44e0b26124 Mon Sep 17 00:00:00 2001 |
| From: Jordan Justen <jordan.l.justen@intel.com> |
| Date: Fri, 27 Jan 2023 15:40:28 -0800 |
| Subject: [PATCH] glsShaderExecUtil.cpp: Add buffer update memory barrier for |
| results buffer |
| |
| This ensures that any ssbo writes done by the shader will be visible |
| in the mapped memory results buffer. |
| |
| From the OpenGL 4.5 (Core Profile) specification, section 7.12: |
| |
| "BUFFER_UPDATE_BARRIER_BIT: Reads and writes to buffer object memory |
| after the barrier using the commands in sections 6.2, 6.2.1, 6.3, |
| 6.6, and 6.5 will reflect data written by shaders prior to the |
| barrier. Additionally, writes via these commands issued after the |
| barrier will wait on the completion of any shader writes to the same |
| memory initiated prior to the barrier." |
| |
| I was seeing a failure with |
| dEQP-GLES31.functional.shaders.builtin_functions.integer.uaddcarry.uint_mediump_tess_eval |
| (and many other tess tests) until I added this barrier. |
| |
| This was noticed after Mesa's bec68a85a2d ("iris: Improve direct CPU |
| map heuristics"): |
| |
| https://gitlab.freedesktop.org/mesa/mesa/-/commit/bec68a85a2d |
| |
| A similar test suite change was added to piglit following the Mesa |
| change: |
| |
| https://gitlab.freedesktop.org/mesa/piglit/-/commit/c669792b |
| |
| Affects (at least): |
| dEQP-GLES31.functional.shaders.*tess* |
| |
| Components: OpenGL, OpenGL ES |
| |
| Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> |
| Change-Id: I5f23694dc488533a2af38d339aca6b3f17ad08db |
| --- |
| modules/glshared/glsShaderExecUtil.cpp | 1 + |
| 1 file changed, 1 insertion(+) |
| |
| diff --git a/modules/glshared/glsShaderExecUtil.cpp b/modules/glshared/glsShaderExecUtil.cpp |
| index 16d8d032c..4a1959173 100644 |
| --- a/modules/glshared/glsShaderExecUtil.cpp |
| +++ b/modules/glshared/glsShaderExecUtil.cpp |
| @@ -1064,6 +1064,7 @@ void BufferIoExecutor::readOutputBuffer (void* const* outputPtrs, int numValues) |
| |
| DE_ASSERT(outputBufferSize > 0); // At least some outputs are required. |
| |
| + gl.memoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT); |
| gl.bindBuffer(GL_SHADER_STORAGE_BUFFER, buffer); |
| void* mapPtr = gl.mapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, outputBufferSize, GL_MAP_READ_BIT); |
| GLU_EXPECT_NO_ERROR(gl.getError(), "glMapBufferRange()"); |
| -- |
| 2.39.2 |
| |