Loading...
Searching...
No Matches
IndirectCountClamp.hpp
1#pragma once
2#include <score_plugin_gfx_export.h>
3
4#include <QtGlobal>
5
6class QRhi;
7class QRhiBuffer;
8class QRhiCommandBuffer;
9class QRhiComputePipeline;
10class QRhiResourceUpdateBatch;
11class QRhiShaderResourceBindings;
12
13namespace score::gfx
14{
15struct RenderState;
16
34class SCORE_PLUGIN_GFX_EXPORT IndirectCountClamp
35{
36public:
37 struct Input
38 {
39 QRhiBuffer* commands{};
40 quint32 commandsOffset{}; // bytes, a multiple of 4
41 quint32 stride{}; // bytes, a multiple of 4
42 quint32 slots{}; // command slots to copy
43 QRhiBuffer* count{};
44 quint32 countOffset{}; // bytes, a multiple of 4
48 int64_t frame{-1};
49 };
50
53 QRhiBuffer* run(
54 RenderState& state, QRhiCommandBuffer& cb, QRhiResourceUpdateBatch*& res,
55 const Input& in);
56
57 void release();
58
60 const char* refusal() const noexcept { return m_refusal; }
61
62 static constexpr int LocalSize = 64;
63
67 quint64 bindingsId() const noexcept;
68 quint64 pipelineBindingsId() const noexcept { return m_pipelineBindingsId; }
69
70private:
71 bool ensurePipeline(RenderState& state);
72
73 QRhiComputePipeline* m_pipeline{};
74 QRhiShaderResourceBindings* m_srb{};
75 QRhiBuffer* m_params{};
76 QRhiBuffer* m_clamped{};
77 bool m_failed{};
78 const char* m_refusal{};
79 int64_t m_lastFrame{-1};
80 quint64 m_pipelineBindingsId{};
81
82 // What m_srb binds; any change rebuilds it.
83 quint64 m_boundCommands{};
84 quint64 m_boundCount{};
85 quint32 m_boundCommandsSize{};
86 quint32 m_boundCountSize{};
87};
88}
The draw-count rung, emulated with compute for backends without it.
Definition IndirectCountClamp.hpp:35
const char * refusal() const noexcept
Why the last run() returned nullptr, or nullptr when it did not.
Definition IndirectCountClamp.hpp:60
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
Definition IndirectCountClamp.hpp:38
Global state associated to a rendering context.
Definition RenderState.hpp:40