41 static QSGRhiSupport *instance_internal();
42 static QSGRhiSupport *instance();
43 static int chooseSampleCount(
int samples, QRhi *rhi);
44 static int chooseSampleCountForWindowWithRhi(QWindow *window, QRhi *rhi);
45 static QImage grabAndBlockInCurrentFrame(QRhi *rhi, QRhiCommandBuffer *cb, QRhiTexture *src =
nullptr);
46 static void checkEnvQSgInfo();
47 static QRhiRenderBuffer::Flags depthStencilBufferFlags();
50 static QRhiTexture::Format toRhiTextureFormatFromGL(uint format, QRhiTexture::Flags *flags);
54 static QRhiTexture::Format toRhiTextureFormatFromVulkan(uint format, QRhiTexture::Flags *flags);
58 static QRhiTexture::Format toRhiTextureFormatFromDXGI(uint format, QRhiTexture::Flags *flags);
62 static QRhiTexture::Format toRhiTextureFormatFromMetal(uint format, QRhiTexture::Flags *flags);
65 void configure(QSGRendererInterface::GraphicsApi api);
67 QRhi::Implementation rhiBackend()
const {
return m_rhiBackend; }
68 QString rhiBackendName()
const;
69 QSGRendererInterface::GraphicsApi graphicsApi()
const;
71 QSurface::SurfaceType windowSurfaceType()
const;
73 const void *rifResource(QSGRendererInterface::Resource res,
74 const QSGDefaultRenderContext *rc,
75 const QQuickWindow *w);
77 QOffscreenSurface *maybeCreateOffscreenSurface(QWindow *window);
78 struct RhiCreateResult {
82 RhiCreateResult createRhi(QQuickWindow *window, QSurface *offscreenSurface,
bool forcePreferSwRenderer =
false);
83 void destroyRhi(QRhi *rhi,
const QQuickGraphicsConfiguration &config);
84 void prepareWindowForRhi(QQuickWindow *window);
86 QImage grabOffscreen(QQuickWindow *window);
88 QImage grabOffscreenForProtectedContent(QQuickWindow *window);
91 void applySwapChainFormat(QRhiSwapChain *scWithWindowSet, QQuickWindow *window);
93 QRhiTexture::Format toRhiTextureFormat(uint nativeFormat, QRhiTexture::Flags *flags)
const;
95 bool attemptReinitWithSwRastUponFail()
const;
100 void adjustToPlatformQuirks();
101 void preparePipelineCache(QRhi *rhi, QQuickWindow *window);
102 void finalizePipelineCache(QRhi *rhi,
const QQuickGraphicsConfiguration &config);
105 QSGRendererInterface::GraphicsApi api;
107 bool m_settingsApplied =
false;
108 QRhi::Implementation m_rhiBackend = QRhi::Null;
bool qsg_useConsistentTiming()