Loading...
Searching...
No Matches
GPUBufferScatter.hpp
1#pragma once
2#include <Gfx/Graph/RenderState.hpp>
3
4#include <private/qrhi_p.h>
5
6namespace score::gfx
7{
8
27{
28public:
29 struct Params
30 {
31 QRhiBuffer* staging{}; // Source SSBO (raw CPU data, uploaded as-is)
32 QRhiBuffer* output{}; // Destination SSBO (format-converted result)
33 uint32_t element_count{};
34 uint32_t src_components{}; // Floats per source element (1-4)
35 uint32_t dst_components{}; // Floats per destination element (1-4)
36 uint32_t src_stride_floats{}; // Stride between source elements (in floats, >= src_components)
37 uint32_t src_offset_floats{}; // Starting offset in source buffer (in floats)
38 };
39
40 bool init(RenderState& state);
41 void release();
42
45 {
46 QRhiShaderResourceBindings* srb{};
47 QRhiBuffer* paramsUBO{};
48 };
49 PreparedOp prepare(QRhi& rhi, const Params& p);
50
52 void updateParams(QRhiResourceUpdateBatch& res, const PreparedOp& op, const Params& p);
53
55 void dispatch(QRhiCommandBuffer& cb, const PreparedOp& op, const Params& p);
56
57 static constexpr int LocalSize = 256;
58
59private:
60 QRhiComputePipeline* m_pipeline{};
61 QShader m_shader;
62};
63
64} // namespace score::gfx
GPU-side buffer format conversion (scatter).
Definition GPUBufferScatter.hpp:27
void updateParams(QRhiResourceUpdateBatch &res, const PreparedOp &op, const Params &p)
Update params UBO and SRB. Call BEFORE beginComputePass (needs a live batch).
Definition GPUBufferScatter.cpp:120
void dispatch(QRhiCommandBuffer &cb, const PreparedOp &op, const Params &p)
Dispatch the scatter. Must be called inside beginComputePass/endComputePass.
Definition GPUBufferScatter.cpp:156
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:12
Definition GPUBufferScatter.hpp:30
Create or update an SRB+UBO for a specific scatter operation.
Definition GPUBufferScatter.hpp:45
Global state associated to a rendering context.
Definition RenderState.hpp:37