QQuickGraphicsDevice Class

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

头: #include <QQuickGraphicsDevice>
CMake: find_package(Qt6 REQUIRED COMPONENTS Quick)
target_link_libraries(mytarget PRIVATE Qt6::Quick)
qmake: QT += quick
Since: Qt 6.0

公共函数

QQuickGraphicsDevice ()
~QQuickGraphicsDevice ()
bool isNull () const

静态公共成员

QQuickGraphicsDevice fromAdapter (quint32 adapterLuidLow , qint32 adapterLuidHigh , int featureLevel = 0)
QQuickGraphicsDevice fromDeviceAndCommandQueue (MTLDevice * device , MTLCommandQueue * commandQueue )
QQuickGraphicsDevice fromDeviceAndContext (void * device , void * context )
QQuickGraphicsDevice fromDeviceObjects (VkPhysicalDevice physicalDevice , VkDevice device , int queueFamilyIndex , int queueIndex = 0)
QQuickGraphicsDevice fromOpenGLContext (QOpenGLContext * context )
QQuickGraphicsDevice fromPhysicalDevice (VkPhysicalDevice physicalDevice )
(从 6.6 起) QQuickGraphicsDevice fromRhi (QRhi * rhi )

详细描述

另请参阅 QQuickWindow::setGraphicsDevice () 和 QQuickRenderTarget .

成员函数文档编制

QQuickGraphicsDevice:: QQuickGraphicsDevice ()

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

[noexcept] QQuickGraphicsDevice:: ~QQuickGraphicsDevice ()

析构函数。

[static] QQuickGraphicsDevice QQuickGraphicsDevice:: fromAdapter ( quint32 adapterLuidLow , qint32 adapterLuidHigh , int featureLevel = 0)

返回新的 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_ 值。 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.

注意: With Direct 3D 12 featureLevel specifies the minimum feature level passed on to D3D12CreateDevice().

[static] QQuickGraphicsDevice QQuickGraphicsDevice:: fromDeviceAndCommandQueue ( MTLDevice * device , MTLCommandQueue * commandQueue )

返回新的 QQuickGraphicsDevice referencing an existing device and commandQueue 对象。

This factory function is suitable for Metal.

注意: 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.

[static] QQuickGraphicsDevice QQuickGraphicsDevice:: fromDeviceAndContext ( void * device , void * context )

返回新的 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* .

注意: 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.

[static] QQuickGraphicsDevice QQuickGraphicsDevice:: fromDeviceObjects ( VkPhysicalDevice physicalDevice , VkDevice device , int queueFamilyIndex , int queueIndex = 0)

返回新的 QQuickGraphicsDevice referencing an existing device 对象。

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.

注意: 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.

[static] QQuickGraphicsDevice QQuickGraphicsDevice:: fromOpenGLContext ( QOpenGLContext * context )

返回新的 QQuickGraphicsDevice referencing an existing OpenGL context .

This factory function is suitable for OpenGL.

注意: 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.

[static] QQuickGraphicsDevice QQuickGraphicsDevice:: fromPhysicalDevice ( VkPhysicalDevice physicalDevice )

返回新的 QQuickGraphicsDevice referencing an existing physicalDevice .

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

注意: 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.

[static, since 6.6] QQuickGraphicsDevice QQuickGraphicsDevice:: fromRhi ( QRhi * rhi )

返回新的 QQuickGraphicsDevice referencing an existing rhi 对象。

注意: 类似于 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.

该函数在 Qt 6.6 引入。

bool QQuickGraphicsDevice:: isNull () const

Returns true if this is a default constructed graphics device that does not reference any native objects.