132void QPlatformTextureList::appendTexture(
void *source, QRhiTexture *texture,
const QRect &geometry,
133 const QRect &clipRect, Flags flags)
135 Q_D(QPlatformTextureList);
136 QBackingstoreTextureInfo bi;
138 bi.texture = texture;
139 bi.textureExtra =
nullptr;
141 bi.clipRect = clipRect;
143 d->textures.append(bi);
146void QPlatformTextureList::appendTexture(
void *source, QRhiTexture *textureLeft, QRhiTexture *textureRight,
const QRect &geometry,
147 const QRect &clipRect, Flags flags)
149 Q_D(QPlatformTextureList);
151 QBackingstoreTextureInfo bi;
153 bi.texture = textureLeft;
154 bi.textureExtra = textureRight;
156 bi.clipRect = clipRect;
158 d->textures.append(bi);
212QPlatformBackingStore::FlushResult QPlatformBackingStore::rhiFlush(QWindow *window,
213 qreal sourceDevicePixelRatio,
214 const QRegion ®ion,
215 const QPoint &offset,
216 QPlatformTextureList *textures,
217 bool translucentBackground,
218 qreal sourceTransformFactor)
220 auto &surfaceSupport = d_ptr->surfaceSupport[window->surfaceType()];
221 return surfaceSupport.compositor.flush(
this,
222 surfaceSupport.rhiSupport.rhi(),
223 surfaceSupport.rhiSupport.swapChainForWindow(window),
224 window, sourceDevicePixelRatio, region, offset, textures,
225 translucentBackground, sourceTransformFactor);
271QRhiTexture *QPlatformBackingStore::toTexture(QRhiResourceUpdateBatch *resourceUpdates,
272 const QRegion &dirtyRegion,
273 TextureFlags *flags)
const
275 auto &surfaceSupport = d_ptr->surfaceSupport[window()->surfaceType()];
276 return surfaceSupport.compositor.toTexture(
this,
277 surfaceSupport.rhiSupport.rhi(), resourceUpdates,
373void QPlatformBackingStore::createRhi(QWindow *window, QPlatformBackingStoreRhiConfig config)
375 if (!config.isEnabled())
378 qCDebug(lcQpaBackingStore) <<
"Setting up RHI support in" <<
this
379 <<
"for" << window <<
"with" << window->surfaceType()
380 <<
"and requested API" << config.api();
382 auto &support = d_ptr->surfaceSupport[window->surfaceType()];
383 if (!support.rhiSupport.rhi()) {
384 support.rhiSupport.setConfig(config);
385 support.rhiSupport.setWindow(window);
386 support.rhiSupport.setFormat(window->format());
387 support.rhiSupport.create();
389 qCDebug(lcQpaBackingStore) <<
"Window already has RHI support"
390 <<
"with backend" << support.rhiSupport.rhi()->backendName();
400void QPlatformBackingStore::graphicsDeviceReportedLost(QWindow *window)
402 auto &surfaceSupport = d_ptr->surfaceSupport[window->surfaceType()];
403 if (!surfaceSupport.rhiSupport.rhi())
406 qWarning(
"Rhi backingstore: graphics device lost, attempting to reinitialize");
407 surfaceSupport.compositor.reset();
408 surfaceSupport.rhiSupport.reset();
409 surfaceSupport.rhiSupport.create();
410 if (!surfaceSupport.rhiSupport.rhi())
411 qWarning(
"Rhi backingstore: failed to reinitialize after losing the device");
QPlatformTextureList::Flags flags
QRhiTexture * textureExtra