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();
49 static QRhiTexture::Format toRhiTextureFormatFromGL(uint format, QRhiTexture::Flags *flags);
53 static QRhiTexture::Format toRhiTextureFormatFromVulkan(uint format, QRhiTexture::Flags *flags);
57 static QRhiTexture::Format toRhiTextureFormatFromDXGI(uint format, QRhiTexture::Flags *flags);
61 static QRhiTexture::Format toRhiTextureFormatFromMetal(uint format, QRhiTexture::Flags *flags);
64 void configure(QSGRendererInterface::GraphicsApi api);
66 QRhi::Implementation rhiBackend()
const {
return m_rhiBackend; }
67 QString rhiBackendName()
const;
68 QSGRendererInterface::GraphicsApi graphicsApi()
const;
70 QSurface::SurfaceType windowSurfaceType()
const;
72 const void *rifResource(QSGRendererInterface::Resource res,
73 const QSGDefaultRenderContext *rc,
74 const QQuickWindow *w);
76 QOffscreenSurface *maybeCreateOffscreenSurface(QWindow *window);
77 struct RhiCreateResult {
81 RhiCreateResult createRhi(QQuickWindow *window, QSurface *offscreenSurface,
bool forcePreferSwRenderer =
false);
82 void destroyRhi(QRhi *rhi,
const QQuickGraphicsConfiguration &config);
83 void prepareWindowForRhi(QQuickWindow *window);
85 QImage grabOffscreen(QQuickWindow *window);
87 QImage grabOffscreenForProtectedContent(QQuickWindow *window);
90 void applySwapChainFormat(QRhiSwapChain *scWithWindowSet, QQuickWindow *window);
92 QRhiTexture::Format toRhiTextureFormat(uint nativeFormat, QRhiTexture::Flags *flags)
const;
94 bool attemptReinitWithSwRastUponFail()
const;
99 void adjustToPlatformQuirks();
100 void preparePipelineCache(QRhi *rhi, QQuickWindow *window);
101 void finalizePipelineCache(QRhi *rhi,
const QQuickGraphicsConfiguration &config);
104 QSGRendererInterface::GraphicsApi api;
106 bool m_settingsApplied =
false;
107 QRhi::Implementation m_rhiBackend = QRhi::Null;
bool qsg_useConsistentTiming()