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
79// Controls whether the copy helpers emit their own pre/post pipeline
80// barriers. Default: Auto (each call emits a {compute,transfer}→transfer +
81// transfer→compute pair). Use `None` when you are batching N calls
82// inside explicit beginBufferCopyBarrier / endBufferCopyBarrier brackets
83// to avoid N−1 redundant pipeline stalls. `None` with no surrounding
84// bracket emits NO synchronisation at all — correct only when the caller
85// knows nothing else in the frame touches the range.
87{
88 Auto,
89 None
90};
91
101SCORE_PLUGIN_GFX_EXPORT
102void beginBufferCopyBarrier(QRhi& rhi, QRhiCommandBuffer& cb);
103
106SCORE_PLUGIN_GFX_EXPORT
107void endBufferCopyBarrier(QRhi& rhi, QRhiCommandBuffer& cb);
108
109SCORE_PLUGIN_GFX_EXPORT
110void copyBuffer(
111 QRhi& rhi, QRhiCommandBuffer& cb,
112 QRhiBuffer* src, QRhiBuffer* dst, int size,
113 int srcOffset = 0, int dstOffset = 0,
114 BufferCopyBarrier barrier = BufferCopyBarrier::Auto);
115
116// Metal-specific implementation (defined in RhiBufferCopyMetal.mm)
117void copyBufferMetal(
118 QRhi& rhi, QRhiCommandBuffer& cb,
119 QRhiBuffer* src, QRhiBuffer* dst, int size,
120 int srcOffset = 0, int dstOffset = 0);
121
141{
142 int src_offset{};
143 int dst_offset{};
144 int size{};
145};
146SCORE_PLUGIN_GFX_EXPORT
147void copyBufferRegions(
148 QRhi& rhi, QRhiCommandBuffer& cb,
149 QRhiBuffer* src, QRhiBuffer* dst,
150 const BufferCopyRegion* regions, int count,
151 BufferCopyBarrier barrier = BufferCopyBarrier::Auto);
152
153// Metal-specific implementation
154void copyBufferRegionsMetal(
155 QRhi& rhi, QRhiCommandBuffer& cb,
156 QRhiBuffer* src, QRhiBuffer* dst,
157 const BufferCopyRegion* regions, int count);
158}
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
void beginBufferCopyBarrier(QRhi &rhi, QRhiCommandBuffer &cb)
Definition RhiComputeBarrier.cpp:302
BufferCopyBarrier
Copy the contents of one GPU buffer to another.
Definition RhiComputeBarrier.hpp:87
void insertComputeBarrier(QRhi &rhi, QRhiCommandBuffer &cb)
Insert a compute-to-compute memory barrier.
Definition RhiComputeBarrier.cpp:127
void endBufferCopyBarrier(QRhi &rhi, QRhiCommandBuffer &cb)
Definition RhiComputeBarrier.cpp:336
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:208
Region-based GPU buffer copy for strided / gather patterns.
Definition RhiComputeBarrier.hpp:141