- Qt 6.7
- Qt Quick
- C++ Classes
- QSGD3D12Texture
- Qt 6.7.1 Reference Documentation

# QSGD3D12Texture Struct

struct QNativeInterface::QSGD3D12Texture

Provides access to and enables adopting Direct3D 12 texture objects. More...

Header: | #include <QSGTexture>
CMake: | find_package(Qt6 REQUIRED COMPONENTS Quick) target_link_libraries(mytarget PRIVATE Qt6::Quick)
qmake: | QT += quick
Since: | Qt 6.6

- List of all members, including inherited members
- QSGD3D12Texture is part of Native Interfaces.

## Public Functions

virtual void * | nativeTexture() const = 0

## Static Public Members

`(since 6.6)` QSGTexture * | fromNative(void *texture, int resourceState, QQuickWindow *window, const QSize &size, QQuickWindow::CreateTextureOptions options = {})

## Detailed Description

## Member Function Documentation

### `[static, since 6.6]` QSGTexture *QSGD3D12Texture::fromNative(void *texture, int resourceState, QQuickWindow *window, const QSize &size, QQuickWindow::CreateTextureOptions options = {})

Creates a new QSGTexture wrapping an existing Direct 3D 12 texture object for window.

The native object is wrapped, but not owned, by the resulting QSGTexture. The caller of the function is responsible for deleting the returned QSGTexture, but that will not destroy the underlying native object.

This function is currently suitable for 2D RGBA textures only.

Warning: This function will return null if the scene graph has not yet been initialized.

Use options to customize the texture attributes. Only the TextureHasAlphaChannel and TextureHasMipmaps are taken into account here.

size specifies the size in pixels.

resourceState must specify the current state of the texture resource.

Note: This function must be called on the scene graph rendering thread.

This function was introduced in Qt 6.6.

See also QQuickWindow::sceneGraphInitialized(), QSGTexture, Scene Graph - Metal Texture Import, and Scene Graph - Vulkan Texture Import.

### `[pure virtual]` void *QSGD3D12Texture::nativeTexture() const

Returns the ID3D12Texture object.