Loading...
Searching...
No Matches
RhiComputeBarrier.hpp
1#pragma once
2#include <score_plugin_gfx_export.h>
3class QRhi;
4class QRhiBuffer;
5class QRhiCommandBuffer;
6class QRhiShaderResourceBindings;
7
8namespace score::gfx
9{
38SCORE_PLUGIN_GFX_EXPORT
40 QRhi& rhi, QRhiCommandBuffer& cb, QRhiShaderResourceBindings& srb,
41 int x, int y, int z);
42
58SCORE_PLUGIN_GFX_EXPORT
59void insertComputeBarrier(QRhi& rhi, QRhiCommandBuffer& cb);
60
81// Controls whether the copy helpers emit their own pre/post pipeline
82// barriers. Default: Auto (each call emits a {compute,transfer}→transfer +
83// transfer→compute pair). Use `None` when you are batching N calls
84// inside explicit beginBufferCopyBarrier / endBufferCopyBarrier brackets
85// to avoid N−1 redundant pipeline stalls. `None` with no surrounding
86// bracket emits NO synchronisation at all — correct only when the caller
87// knows nothing else in the frame touches the range.
89{
90 Auto,
91 None
92};
93
103SCORE_PLUGIN_GFX_EXPORT
104void beginBufferCopyBarrier(QRhi& rhi, QRhiCommandBuffer& cb);
105
109SCORE_PLUGIN_GFX_EXPORT
110void endBufferCopyBarrier(QRhi& rhi, QRhiCommandBuffer& cb);
111
112SCORE_PLUGIN_GFX_EXPORT
113void copyBuffer(
114 QRhi& rhi, QRhiCommandBuffer& cb,
115 QRhiBuffer* src, QRhiBuffer* dst, int size,
116 int srcOffset = 0, int dstOffset = 0,
117 BufferCopyBarrier barrier = BufferCopyBarrier::Auto);
118
119// Metal-specific implementation (defined in RhiBufferCopyMetal.mm)
120void copyBufferMetal(
121 QRhi& rhi, QRhiCommandBuffer& cb,
122 QRhiBuffer* src, QRhiBuffer* dst, int size,
123 int srcOffset = 0, int dstOffset = 0);
124
144{
145 int src_offset{};
146 int dst_offset{};
147 int size{};
148};
149SCORE_PLUGIN_GFX_EXPORT
150void copyBufferRegions(
151 QRhi& rhi, QRhiCommandBuffer& cb,
152 QRhiBuffer* src, QRhiBuffer* dst,
153 const BufferCopyRegion* regions, int count,
154 BufferCopyBarrier barrier = BufferCopyBarrier::Auto);
155
156// Metal-specific implementation
157void copyBufferRegionsMetal(
158 QRhi& rhi, QRhiCommandBuffer& cb,
159 QRhiBuffer* src, QRhiBuffer* dst,
160 const BufferCopyRegion* regions, int count);
161}
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
void beginBufferCopyBarrier(QRhi &rhi, QRhiCommandBuffer &cb)
Definition RhiComputeBarrier.cpp:312
BufferCopyBarrier
Copy the contents of one GPU buffer to another.
Definition RhiComputeBarrier.hpp:89
void insertComputeBarrier(QRhi &rhi, QRhiCommandBuffer &cb)
Insert a compute-to-compute memory barrier.
Definition RhiComputeBarrier.cpp:137
void endBufferCopyBarrier(QRhi &rhi, QRhiCommandBuffer &cb)
Definition RhiComputeBarrier.cpp:346
bool dispatchComputeLayeredImages(QRhi &rhi, QRhiCommandBuffer &cb, QRhiShaderResourceBindings &srb, int x, int y, int z)
Dispatch a compute pass, working around Qt's non-layered bind of layered (3D / cube / array) storage ...
Definition RhiComputeBarrier.cpp:218
Region-based GPU buffer copy for strided / gather patterns.
Definition RhiComputeBarrier.hpp:144