29#include <QtGui/private/qrhi_p.h>
37template <
typename CB,
typename =
void>
43 CB,
std::void_t<decltype(std::declval<CB&>().drawIndexedIndirectCount(
44 static_cast<QRhiBuffer*>(nullptr), 0u,
45 static_cast<QRhiBuffer*>(nullptr), 0u, 0u, 0u))>> : std::true_type
49template <
typename CB,
typename =
void>
55 CB,
std::void_t<decltype(std::declval<CB&>().dispatchIndirect(
56 static_cast<QRhiBuffer*>(nullptr), 0u))>> : std::true_type
62template <
typename R,
typename =
void>
65 static bool supported(R&)
noexcept {
return false; }
70 static bool supported(R& rhi)
noexcept
72 return rhi.isFeatureSupported(R::DrawIndirectCount);
76template <
typename R,
typename =
void>
79 static bool supported(R&)
noexcept {
return false; }
84 static bool supported(R& rhi)
noexcept
86 return rhi.isFeatureSupported(R::DispatchIndirect);
91#if defined(SCORE_GFX_SIMULATE_QT612)
92inline constexpr bool rhiHasDrawIndirectCount =
false;
93inline constexpr bool rhiHasDispatchIndirect =
false;
95inline constexpr bool rhiHasDrawIndirectCount
97inline constexpr bool rhiHasDispatchIndirect
103template <
typename R = QRhi>
106 if constexpr(rhiHasDrawIndirectCount)
113template <
typename R = QRhi>
116 if constexpr(rhiHasDispatchIndirect)
125template <
typename CB = QRhiCommandBuffer>
127 CB& cb,
bool indexed, QRhiBuffer* indirectBuffer, quint32 indirectOffset,
128 QRhiBuffer* countBuffer, quint32 countOffset, quint32 maxDrawCount,
129 quint32 stride)
noexcept
131 if constexpr(rhiHasDrawIndirectCount)
134 cb.drawIndexedIndirectCount(
135 indirectBuffer, indirectOffset, countBuffer, countOffset,
136 maxDrawCount, stride);
138 cb.drawIndirectCount(
139 indirectBuffer, indirectOffset, countBuffer, countOffset,
140 maxDrawCount, stride);
152template <
typename P,
typename =
void>
155 static constexpr bool exists =
false;
156 static typename P::Flags flag()
noexcept {
return {}; }
161 static constexpr bool exists =
true;
162 static typename P::Flags flag()
noexcept {
return P::UsesIndirectDraws; }
165template <
typename RB,
typename =
void>
168 static constexpr bool exists =
false;
169 static typename RB::Flags flag()
noexcept {
return {}; }
171template <
typename RB>
173 RB,
std::void_t<decltype(RB::NoTransientBacking)>>
175 static constexpr bool exists =
true;
176 static typename RB::Flags flag()
noexcept {
return RB::NoTransientBacking; }
188#if defined(SCORE_GFX_SIMULATE_QT612)
202 if(rhi.backend() == QRhi::Metal)
214 if(rhi.backend() == QRhi::Metal)
221template <
typename CB = QRhiCommandBuffer>
223 CB& cb, QRhiBuffer* argsBuffer, quint32 argsOffset)
noexcept
225 if constexpr(rhiHasDispatchIndirect)
227 cb.dispatchIndirect(argsBuffer, argsOffset);
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
bool drawIndirectCountCompat(CB &cb, bool indexed, QRhiBuffer *indirectBuffer, quint32 indirectOffset, QRhiBuffer *countBuffer, quint32 countOffset, quint32 maxDrawCount, quint32 stride) noexcept
Definition RhiIndirectCompat.hpp:126
bool dispatchIndirectCompat(CB &cb, QRhiBuffer *argsBuffer, quint32 argsOffset) noexcept
Definition RhiIndirectCompat.hpp:222
QRhiGraphicsPipeline::Flags indirectDrawPipelineFlags(const QRhi &rhi) noexcept
Definition RhiIndirectCompat.hpp:199
bool rhiSupportsDrawIndirectCount(R &rhi) noexcept
Definition RhiIndirectCompat.hpp:104
constexpr bool rhiHasIndirectCommandBufferFlags
Definition RhiIndirectCompat.hpp:192
bool rhiSupportsDispatchIndirect(R &rhi) noexcept
QRhi::DispatchIndirect reported by the device; same convention as above.
Definition RhiIndirectCompat.hpp:114
QRhiRenderBuffer::Flags depthStencilRenderBufferFlags(const QRhi &rhi) noexcept
Definition RhiIndirectCompat.hpp:211
Definition RhiIndirectCompat.hpp:78
Definition RhiIndirectCompat.hpp:64
Definition RhiIndirectCompat.hpp:51
Definition RhiIndirectCompat.hpp:39
Definition RhiIndirectCompat.hpp:154
Definition RhiIndirectCompat.hpp:167