diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-01-08 12:55:57 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-01-13 15:53:09 +0100 |
commit | 9a0ab41f28042c7f27208337e419435d16f00006 (patch) | |
tree | d3188dbb1796576f3d2ec3d763c648533bcf2752 /src/gui/rhi/qrhigles2_p_p.h | |
parent | 62e98af40f97b865aeed897e90231e76b329d614 (diff) |
rhi: gl: vulkan: Generate barriers between dispatches in a compute pass
The new float16texture_with_compute manual test demonstrates a case
that was not handled correctly before: multiple dispatch() calls in
a row storing to and then loading from the same subresource(s).
Without the appropriate barriers subtle data corruption issues appear.
For Vulkan this also adds better batching for image/buffer barriers when
using deferred recording.
Also, for OpenGL this fixes the case of updating a buffer or rendering into
a texture and then using it for load/store in a compute pass (previously this
also lacked an appropriate glMemoryBarrier).
Task-number: QTBUG-81217
Change-Id: I7970c445564473f9452662f4b1a20618cb8627a3
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhigles2_p_p.h')
-rw-r--r-- | src/gui/rhi/qrhigles2_p_p.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhigles2_p_p.h b/src/gui/rhi/qrhigles2_p_p.h index a9b3022612..679f806004 100644 --- a/src/gui/rhi/qrhigles2_p_p.h +++ b/src/gui/rhi/qrhigles2_p_p.h @@ -521,6 +521,17 @@ struct QGles2CommandBuffer : public QRhiCommandBuffer QRhiShaderResourceBindings *currentComputeSrb; uint currentSrbGeneration; + struct ComputePassState { + enum Access { + Read = 0x01, + Write = 0x02 + }; + QHash<QRhiResource *, QPair<int, bool> > writtenResources; + void reset() { + writtenResources.clear(); + } + } computePassState; + QVector<QByteArray> dataRetainPool; QVector<QImage> imageRetainPool; |