Loading...
Searching...
No Matches
GPUIndexWiden.hpp
1#pragma once
2#include <Gfx/Graph/RenderState.hpp>
3
4#include <score_plugin_gfx_export.h>
5
6#include <private/qrhi_p.h>
7
8namespace score::gfx
9{
10
21class SCORE_PLUGIN_GFX_EXPORT GPUIndexWiden
22{
23public:
24 struct Params
25 {
26 QRhiBuffer* src{}; // uint16 indices, bound as a storage buffer
27 QRhiBuffer* dst{}; // uint32 indices, bound as a storage buffer
28 uint32_t count{}; // number of indices
29 uint32_t src_offset_bytes{}; // a multiple of 2
30 uint32_t dst_offset_bytes{}; // a multiple of 4
31 };
32
34 {
35 QRhiShaderResourceBindings* srb{};
36 QRhiBuffer* paramsUBO{};
37 // The buffers srb was last created against, by globalResourceId: a buffer
38 // freed and reallocated can come back at the same address.
39 quint64 src_id{};
40 quint64 dst_id{};
41 };
42
43 bool init(RenderState& state);
44 void release();
45
46 PreparedOp prepare(QRhi& rhi, const Params& p);
47 static void releaseOp(PreparedOp& op);
48
49 void updateParams(QRhiResourceUpdateBatch& res, PreparedOp& op, const Params& p);
50 void dispatch(QRhiCommandBuffer& cb, const PreparedOp& op, const Params& p);
51
52 static constexpr int LocalSize = 256;
53
54private:
55 struct Dims
56 {
57 int x{}, y{};
58 };
59 Dims dims(uint32_t count) const noexcept;
60
61 QRhiComputePipeline* m_pipeline{};
62 QShader m_shader;
63 int m_maxWorkgroupsPerDim{65535};
64};
65
66}
Widens 16-bit indices in a GPU buffer into 32-bit ones in another.
Definition GPUIndexWiden.hpp:22
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
Definition GPUIndexWiden.hpp:25
Definition GPUIndexWiden.hpp:34
Global state associated to a rendering context.
Definition RenderState.hpp:40