Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
The QQuickRenderTarget class provides an opaque container for native graphics resources specifying a render target, and associated metadata. More...
#include <qquickrendertarget.h>
Public Types | |
enum class | Flag { MultisampleResolve = 0x01 } |
Flags for the static QQuickRenderTarget constructor functions. More... | |
Public Member Functions | |
QQuickRenderTarget () | |
Constructs a default QQuickRenderTarget that does not reference any native objects. | |
~QQuickRenderTarget () | |
Destructor. | |
QQuickRenderTarget (const QQuickRenderTarget &other) | |
QQuickRenderTarget & | operator= (const QQuickRenderTarget &other) |
bool | isNull () const |
qreal | devicePixelRatio () const |
void | setDevicePixelRatio (qreal ratio) |
Sets the device pixel ratio for this render target to ratio. | |
bool | mirrorVertically () const |
void | setMirrorVertically (bool enable) |
Sets the size of the render target contents should be mirrored vertically to enable when drawing. | |
QRhiTexture * | depthTexture () const |
void | setDepthTexture (QRhiTexture *texture) |
Requests using the given texture as the depth or depth-stencil buffer. | |
Static Public Member Functions | |
static QQuickRenderTarget | fromRhiRenderTarget (QRhiRenderTarget *renderTarget) |
static QQuickRenderTarget | fromPaintDevice (QPaintDevice *device) |
Friends | |
class | QQuickRenderTargetPrivate |
bool | operator== (const QQuickRenderTarget &lhs, const QQuickRenderTarget &rhs) noexcept |
bool | operator!= (const QQuickRenderTarget &lhs, const QQuickRenderTarget &rhs) noexcept |
The QQuickRenderTarget class provides an opaque container for native graphics resources specifying a render target, and associated metadata.
Definition at line 25 of file qquickrendertarget.h.
|
strong |
Flags for the static QQuickRenderTarget constructor functions.
\value MultisampleResolve Indicates the the sampleCount
argument is not the number of samples for the provided texture (and that the texture is still a non-multisample texture), but rather the desired samples for multisample antialiasing. Triggers automatically creating and managing an intermediate multisample texture (or texture array) as the color buffer, transparently to the application. The samples are resolved into the provided texture at the end of the render pass automatically. When this flag is not set, and the sampleCount
argument is greater than 1, it implies the provided texture is multisample. The flag has no effect is the sampleCount
is 1 (indicating that multisampling is not involved).
Enumerator | |
---|---|
MultisampleResolve |
Definition at line 28 of file qquickrendertarget.h.
QQuickRenderTarget::QQuickRenderTarget | ( | ) |
Constructs a default QQuickRenderTarget that does not reference any native objects.
Definition at line 45 of file qquickrendertarget.cpp.
QQuickRenderTarget::~QQuickRenderTarget | ( | ) |
Destructor.
Definition at line 79 of file qquickrendertarget.cpp.
References QBasicAtomicInteger< T >::deref(), and QQuickRenderTargetPrivate::ref.
QQuickRenderTarget::QQuickRenderTarget | ( | const QQuickRenderTarget & | other | ) |
Definition at line 61 of file qquickrendertarget.cpp.
References QBasicAtomicInteger< T >::ref(), and QQuickRenderTargetPrivate::ref.
QRhiTexture * QQuickRenderTarget::depthTexture | ( | ) | const |
The value is only non-null when setDepthTexture() was called.
Definition at line 172 of file qquickrendertarget.cpp.
References QQuickRenderTargetPrivate::customDepthTexture.
qreal QQuickRenderTarget::devicePixelRatio | ( | ) | const |
The default device pixel ratio is 1.0.
Definition at line 104 of file qquickrendertarget.cpp.
References QQuickRenderTargetPrivate::devicePixelRatio.
|
static |
This option of redirecting rendering to a QPaintDevice is available only when running with the software
backend of Qt Quick.
Definition at line 1153 of file qquickrendertarget.cpp.
References d, device, and QQuickRenderTargetPrivate::get().
|
static |
format specifies the native internal format of the texture. Only texture formats that are supported by Qt's rendering infrastructure should be used.
pixelSize specifies the size of the image, in pixels. Currently only 2D textures are supported.
sampleCount specifies the number of samples. 0 or 1 means no multisampling, while a value like 4 or 8 states that the native object is a multisample texture.
The texture is used as the first color attachment of the render target used by the Qt Quick scenegraph. A depth-stencil buffer, if applicable, is created and used automatically.
The OpenGL object name textureId must be a valid name in the rendering context used by the Qt Quick scenegraph.
format specifies the DXGI_FORMAT of the texture. Only texture formats that are supported by Qt's rendering infrastructure should be used.
pixelSize specifies the size of the image, in pixels. Currently only 2D textures are supported.
sampleCount specifies the number of samples. 0 or 1 means no multisampling, while a value like 4 or 8 states that the native object is a multisample texture.
The texture is used as the first color attachment of the render target used by the Qt Quick scenegraph. A depth-stencil buffer, if applicable, is created and used automatically.
format specifies the MTLPixelFormat of the texture. Only texture formats that are supported by Qt's rendering infrastructure should be used.
pixelSize specifies the size of the image, in pixels. Currently only 2D textures are supported.
sampleCount specifies the number of samples. 0 or 1 means no multisampling, while a value like 4 or 8 states that the native object is a multisample texture.
The texture is used as the first color attachment of the render target used by the Qt Quick scenegraph. A depth-stencil buffer, if applicable, is created and used automatically.
format specifies the VkFormat of the image. Only image formats that are supported by Qt's rendering infrastructure should be used.
pixelSize specifies the size of the image, in pixels. Currently only 2D textures are supported.
sampleCount specifies the number of samples. 0 or 1 means no multisampling, while a value like 4 or 8 states that the native object is a multisample texture.
The image is used as the first color attachment of the render target used by the Qt Quick scenegraph. A depth-stencil buffer, if applicable, is created and used automatically.
renderTarget will in most cases be a QRhiTextureRenderTarget, which allows directing the Qt Quick scene's rendering into a QRhiTexture.
Definition at line 1121 of file qquickrendertarget.cpp.
References d, QQuickRenderTargetPrivate::get(), QRhiRenderTarget::pixelSize(), qWarning, and QRhiRenderTarget::sampleCount().
Referenced by QSGRhiSupport::grabOffscreen().
bool QQuickRenderTarget::isNull | ( | ) | const |
Definition at line 89 of file qquickrendertarget.cpp.
References QQuickRenderTargetPrivate::type.
bool QQuickRenderTarget::mirrorVertically | ( | ) | const |
The default value is {false}
.
Definition at line 139 of file qquickrendertarget.cpp.
References QQuickRenderTargetPrivate::mirrorVertically.
QQuickRenderTarget & QQuickRenderTarget::operator= | ( | const QQuickRenderTarget & | other | ) |
Definition at line 70 of file qquickrendertarget.cpp.
References other(), and qAtomicAssign().
void QQuickRenderTarget::setDepthTexture | ( | QRhiTexture * | texture | ) |
Requests using the given texture as the depth or depth-stencil buffer.
Ownership of texture is not taken.
The request is only taken into account when relevant. For example, calling this function has no effect with fromRhiRenderTarget(), fromPaintDevice(), or fromOpenGLRenderBuffer().
Normally a depth-stencil buffer is created automatically, transparently to the user of QQuickRenderTarget. Therefore, there is no need to call this function in most cases when working with QQuickRenderTarget. In special circumstances, it can however become essential to be able to provide a texture to render depth (or depth and stencil) data into, instead of letting Qt Quick create its own intermediate textures or buffers. An example of this is \l{https://www.khronos.org/openxr/}{OpenXR} and its extensions such as \l{https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XR_KHR_composition_layer_depth}{XR_KHR_composition_layer_depth}. In order to "submit the depth buffer" to the XR compositor, one has to, in practice, retrieve an already created depth (depth-stencil) texture from OpenXR (from the XrSwapchain) and use that texture as the render target for depth data. That would not be possible without this function.
Definition at line 216 of file qquickrendertarget.cpp.
References QQuickRenderTargetPrivate::customDepthTexture.
Referenced by QOpenXRGraphicsOpenGL::renderTarget(), QOpenXRGraphicsOpenGLES::renderTarget(), and QOpenXRGraphicsVulkan::renderTarget().
Sets the device pixel ratio for this render target to ratio.
This is the ratio between {device pixels} and {device independent pixels}.
Note that the specified device pixel ratio value will be ignored if QQuickRenderControl::renderWindow() is re-implemented to return a valid QWindow.
Definition at line 121 of file qquickrendertarget.cpp.
References QQuickRenderTargetPrivate::devicePixelRatio.
void QQuickRenderTarget::setMirrorVertically | ( | bool | enable | ) |
Sets the size of the render target contents should be mirrored vertically to enable when drawing.
This allows easy integration of third-party rendering code that does not follow the standard expectations.
software
backend.Definition at line 156 of file qquickrendertarget.cpp.
References QQuickRenderTargetPrivate::mirrorVertically.
|
friend |
Definition at line 90 of file qquickrendertarget.h.
|
friend |
Definition at line 88 of file qquickrendertarget.h.
|
friend |
Definition at line 86 of file qquickrendertarget.h.