40 static QSGRhiSupport *instance_internal();
41 static QSGRhiSupport *instance();
42 static int chooseSampleCount(
int samples, QRhi *rhi);
43 static int chooseSampleCountForWindowWithRhi(QWindow *window, QRhi *rhi);
44 static QImage grabAndBlockInCurrentFrame(QRhi *rhi, QRhiCommandBuffer *cb, QRhiTexture *src =
nullptr);
45 static void checkEnvQSgInfo();
48 static QRhiTexture::Format toRhiTextureFormatFromGL(uint format, QRhiTexture::Flags *flags);
52 static QRhiTexture::Format toRhiTextureFormatFromVulkan(uint format, QRhiTexture::Flags *flags);
56 static QRhiTexture::Format toRhiTextureFormatFromDXGI(uint format, QRhiTexture::Flags *flags);
60 static QRhiTexture::Format toRhiTextureFormatFromMetal(uint format, QRhiTexture::Flags *flags);
63 void configure(QSGRendererInterface::GraphicsApi api);
65 QRhi::Implementation rhiBackend()
const {
return m_rhiBackend; }
66 QString rhiBackendName()
const;
67 QSGRendererInterface::GraphicsApi graphicsApi()
const;
69 QSurface::SurfaceType windowSurfaceType()
const;
71 const void *rifResource(QSGRendererInterface::Resource res,
72 const QSGDefaultRenderContext *rc,
73 const QQuickWindow *w);
75 QOffscreenSurface *maybeCreateOffscreenSurface(QWindow *window);
76 struct RhiCreateResult {
80 RhiCreateResult createRhi(QQuickWindow *window, QSurface *offscreenSurface,
bool forcePreferSwRenderer =
false);
81 void destroyRhi(QRhi *rhi,
const QQuickGraphicsConfiguration &config);
82 void prepareWindowForRhi(QQuickWindow *window);
84 QImage grabOffscreen(QQuickWindow *window);
86 QImage grabOffscreenForProtectedContent(QQuickWindow *window);
89 void applySwapChainFormat(QRhiSwapChain *scWithWindowSet, QQuickWindow *window);
91 QRhiTexture::Format toRhiTextureFormat(uint nativeFormat, QRhiTexture::Flags *flags)
const;
93 bool attemptReinitWithSwRastUponFail()
const;
98 void adjustToPlatformQuirks();
99 void preparePipelineCache(QRhi *rhi, QQuickWindow *window);
100 void finalizePipelineCache(QRhi *rhi,
const QQuickGraphicsConfiguration &config);
103 QSGRendererInterface::GraphicsApi api;
105 bool m_settingsApplied =
false;
106 QRhi::Implementation m_rhiBackend = QRhi::Null;
bool qsg_useConsistentTiming()