summaryrefslogtreecommitdiffstats
path: root/examples/corelib/threads/semaphores/semaphores.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-09-27 13:56:33 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-09-28 17:14:20 +0000
commitf2d0b53adbba8e67a6701063544c5584a987a756 (patch)
treef458e845257be6e514e7d5a60cbd5ea74a4dc8cb /examples/corelib/threads/semaphores/semaphores.cpp
parent747a0006cde0cbf774d3350d3f14bc7feaed40f5 (diff)
rhi: gl: Do not issue memory barriers when we do not have to
First, issue glMemoryBarrier() only if the read-after-write or write-after-write occurs for a write involving incoherent memory access. In practice this means a QRhiTexture with UsedWithLoadStore or a QRhiBuffer used as an SSBO. Doing the barrier call for other types of texture or buffers is pointless, and potentially wasteful. What is more, some OpenGL implementations feature bugs that manifest themselves when glMemoryBarrier() is called, see associated Jira issue for details. Second, reduce GL_ALL_BARRIER_BITS to the ones relevant for the type of the resource, in an attempt to provide a minor optimization. Real fine-grained resource usage tracking is not implemented for OpenGL so this still means specifying all buffer-related or all texture-related barriers together, but this is still better than all. As the usage of compute is quite close to zero in Qt at the moment, this won't make much of a difference in practice. Fixes: QTBUG-96322 Change-Id: Ibf794e2e8a4cbc3c69acaa88476e85de6646b605 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit fea1d57c2bf3cc9d14a3ee61f9c8e5273decc201) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/corelib/threads/semaphores/semaphores.cpp')
0 files changed, 0 insertions, 0 deletions