Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQuickGraphicsDevice Class Reference

The QQuickGraphicsDevice class provides an opaque container for native graphics objects representing graphics devices or contexts. More...

#include <qquickgraphicsdevice.h>

Collaboration diagram for QQuickGraphicsDevice:

Public Member Functions

 QQuickGraphicsDevice ()
 Constructs a default QQuickGraphicsDevice that does not reference any native objects.
 ~QQuickGraphicsDevice ()
 Destructor.
 QQuickGraphicsDevice (const QQuickGraphicsDevice &other)
QQuickGraphicsDeviceoperator= (const QQuickGraphicsDevice &other)
bool isNull () const

Static Public Member Functions

static QQuickGraphicsDevice fromRhi (QRhi *rhi)
static QQuickGraphicsDevice fromRhiAdapter (QRhiAdapter *adapter)

Friends

class QQuickGraphicsDevicePrivate

Detailed Description

The QQuickGraphicsDevice class provides an opaque container for native graphics objects representing graphics devices or contexts.

Since
6.0 \inmodule QtQuick
See also
QQuickWindow::setGraphicsDevice(), QQuickRenderTarget

Definition at line 26 of file qquickgraphicsdevice.h.

Constructor & Destructor Documentation

◆ QQuickGraphicsDevice() [1/2]

QQuickGraphicsDevice::QQuickGraphicsDevice ( )

Constructs a default QQuickGraphicsDevice that does not reference any native objects.

Definition at line 24 of file qquickgraphicsdevice.cpp.

◆ ~QQuickGraphicsDevice()

QQuickGraphicsDevice::~QQuickGraphicsDevice ( )

Destructor.

Definition at line 58 of file qquickgraphicsdevice.cpp.

◆ QQuickGraphicsDevice() [2/2]

QQuickGraphicsDevice::QQuickGraphicsDevice ( const QQuickGraphicsDevice & other)

Definition at line 40 of file qquickgraphicsdevice.cpp.

Member Function Documentation

◆ fromRhi()

QQuickGraphicsDevice QQuickGraphicsDevice::fromRhi ( QRhi * rhi)
static
Returns
a new QQuickGraphicsDevice referencing an existing OpenGL context.

This factory function is suitable for OpenGL.

Note
It is up the caller to ensure that context is going to be compatible and usable with the QQuickWindow. Platform-specific mismatches in the associated QSurfaceFormat, or threading issues due to attempting to use context on multiple threads are up to the caller to avoid.
Returns
a new QQuickGraphicsDevice describing a DXGI adapter and D3D feature level.

This factory function is suitable for Direct3D 11 and 12, particularly in combination with OpenXR. adapterLuidLow and adapterLuidHigh together specify a LUID, while a featureLevel specifies a {D3D_FEATURE_LEVEL_} value. featureLevel can be set to 0 if it is not intended to be specified, in which case the scene graph's defaults will be used.

Note
With Direct 3D 12 featureLevel specifies the minimum feature level passed on to D3D12CreateDevice().
Returns
a new QQuickGraphicsDevice referencing a native device and context object.

This factory function is suitable for Direct3D 11. device is expected to be a {ID3D11Device*}, context is expected to be a {ID3D11DeviceContext*}.

It also supports Direct 3D 12, if that is the 3D API used at run time. With D3D12 context is unused and can be set to null. device is expected to be a {ID3D12Device*}.

Note
the resulting QQuickGraphicsDevice does not own any native resources, it merely contains references. It is the caller's responsibility to ensure that the native resource exists as long as necessary.
Returns
a new QQuickGraphicsDevice referencing an existing device and commandQueue object.

This factory function is suitable for Metal.

Note
the resulting QQuickGraphicsDevice does not own any native resources, it merely contains references. It is the caller's responsibility to ensure that the native resource exists as long as necessary.
Returns
a new QQuickGraphicsDevice referencing an existing physicalDevice.

This factory function is suitable for Vulkan, particularly in combination with OpenXR.

Note
the resulting QQuickGraphicsDevice does not own any native resources, it merely contains references. It is the caller's responsibility to ensure that the native resource exists as long as necessary.
Returns
a new QQuickGraphicsDevice referencing an existing device object.

This factory function is suitable for Vulkan. physicalDevice, device and queueFamilyIndex must always be provided. queueIndex is optional since the default value of 0 is often suitable.

Note
the resulting QQuickGraphicsDevice does not own any native resources, it merely contains references. It is the caller's responsibility to ensure that the native resource exists as long as necessary.
Returns
a new QQuickGraphicsDevice referencing an existing rhi object.
Note
Similarly to fromOpenGLContext(), the caller must be careful to only share a QRhi (and so the underlying graphics context or device) between QQuickWindows that are known to be compatible, not breaking the underlying graphics API's rules when it comes to threading, pixel formats, etc.
Since
6.6

Definition at line 225 of file qquickgraphicsdevice.cpp.

◆ fromRhiAdapter()

QQuickGraphicsDevice QQuickGraphicsDevice::fromRhiAdapter ( QRhiAdapter * adapter)
static
Returns
a new QQuickGraphicsDevice referencing an existing adapter QRhiAdapter object.

Not applicable to QRhi backends and graphics APIs where QRhiAdapter does not have a real implementation.

Equivalent to fromAdapter() for Direct 3D, and fromPhysicalDevice() for Vulkan.

Note
Ownership is not taken for adapter, and it must stay valid at minimum until the scene graph intializes, which most likely happens when the associated QQuickWindow becomes exposed.
Since
6.10
See also
QRhi::enumerateAdapters()

Definition at line 249 of file qquickgraphicsdevice.cpp.

◆ isNull()

bool QQuickGraphicsDevice::isNull ( ) const
Returns
true if this is a default constructed graphics device that does not reference any native objects.

Definition at line 68 of file qquickgraphicsdevice.cpp.

◆ operator=()

QQuickGraphicsDevice & QQuickGraphicsDevice::operator= ( const QQuickGraphicsDevice & other)

Definition at line 49 of file qquickgraphicsdevice.cpp.

◆ QQuickGraphicsDevicePrivate

friend class QQuickGraphicsDevicePrivate
friend

Definition at line 60 of file qquickgraphicsdevice.h.


The documentation for this class was generated from the following files: