2#include <QOffscreenSurface>
3#include <QtGui/private/qrhi_p.h>
5#include <score_plugin_gfx_export.h>
9#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
10using QRhiBufferReadbackResult = QRhiReadbackResult;
13class QOffscreenSurface;
45 QRhiRenderPassDescriptor* renderPassDescriptor{};
46 std::weak_ptr<RenderList> renderer{};
48 QOffscreenSurface* surface{};
49 std::weak_ptr<score::gfx::Window>
54 QRhiTexture::Format renderFormat{QRhiTexture::RGBA8};
56 QShaderVersion version{};
61 bool drawIndirect{
false};
62 bool drawIndirectMulti{
false};
88 bool drawIndirectCount{
false};
89 bool dispatchIndirect{
false};
92 bool multiview{
false};
93 bool resolveDepthStencil{
false};
94 bool tessellation{
false};
95 bool geometryShader{
false};
114 bool baseInstance{
false};
115 bool instanceIndexIncludesBaseInstance{
false};
116 bool variableRateShading{
false};
117 bool timestamps{
false};
118 bool pipelineCacheDataLoadSave{
false};
119 bool textureViewFormat{
false};
120 bool depthClamp{
false};
122 void populate(QRhi& rhi);
126 std::function<void()> customDeviceCleanup;
130 std::function<void()> preRhiDestroy;
137 std::function<void()> savePipelineCache;
146 preRhiDestroy =
nullptr;
153 if(customDeviceCleanup)
155 customDeviceCleanup();
156 customDeviceCleanup =
nullptr;
180SCORE_PLUGIN_GFX_EXPORT
181std::shared_ptr<RenderState> createRenderState(
182 GraphicsApi graphicsApi, QSize sz, QWindow* window,
185static const constexpr int32_t invalid_node_index = -1;
222inline QRhiBuffer::UsageFlags
225 if(!usage.testFlag(QRhiBuffer::StorageBuffer))
228 if(
int(usage) ==
int(QRhiBuffer::StorageBuffer))
234 if(rhi.isFeatureSupported(QRhi::Compute))
236 return usage & ~QRhiBuffer::UsageFlags(QRhiBuffer::StorageBuffer);
262 return multiViewCount >= 2 && api == GraphicsApi::Metal;
291 if(api == GraphicsApi::Metal)
317 GraphicsApi api,
const QShaderVersion& version,
int multiViewCount)
noexcept
322 if(qEnvironmentVariableIsSet(
"SCORE_GFX_DISABLE_MULTIVIEW"))
325 if(api != GraphicsApi::D3D11 && api != GraphicsApi::D3D12)
329 if(api == GraphicsApi::D3D11)
335 if(version.version() < 61)
355 if(multiViewCount > 4)
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
bool indirectDrawBreaksMultiView(GraphicsApi api, int multiViewCount) noexcept
Whether a GPU indirect draw silently loses multiview on this backend.
Definition RenderState.hpp:260
GraphicsApi
Available graphics APIs to use.
Definition RenderState.hpp:22
bool drawIndirectCountUsable(GraphicsApi api, int multiViewCount) noexcept
Whether the GPU-count draw path (drawIndexedIndirectCount) is usable.
Definition RenderState.hpp:287
SharedDeviceMode
Who owns the imported Vulkan device behind a RenderState.
Definition RenderState.hpp:175
bool viewIndexNeedsPassIndexFallback(GraphicsApi api, const QShaderVersion &version, int multiViewCount) noexcept
Whether MULTIVIEW must be emulated with one pass per view.
Definition RenderState.hpp:316
QRhiBuffer::UsageFlags compatibleBufferUsage(QRhi &rhi, QRhiBuffer::UsageFlags usage) noexcept
Drop a StorageBuffer usage the backend cannot actually honour.
Definition RenderState.hpp:223
Definition RenderState.hpp:59
Global state associated to a rendering context.
Definition RenderState.hpp:37