aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2024-02-23 15:44:47 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2024-03-15 17:50:04 +0100
commitb8f5a7848b019be68f0d0fba30fd82b4777a35e5 (patch)
treed7af2d60b6617b0b456d24b85ec3efb596b32ea9 /src/quick
parentac6ae119e003dd676b36ba3199c380ba4c4b77f9 (diff)
QQuickRt: allow specifying a viewFormat where applicable
Some of the fromXxxx static constructors now get a third (elsewhere, second) overload. This has all the Qt 6.8 new functionality merged into one to prevent the explosion of these functions. (arraySize for multiview, flags for multisample-resolve (and other future uses), and a viewFormat in addition to format) Also order everything in the logical way: first the Qt 6.0 era versions (that do not have a format argument), then the Qt 6.4 overloads with format, then the Qt 6.8 overload with the full set of features. With OpenGL we do not and will not do texture views. Hence no viewFormat argument. However, there is a version requirement: OpenGL ES 3.0 (or 2.0) is not sufficient for some of the new features. Given the main customer for these is Quick 3D XR with devices like the Quest 3 with OpenGL ES 3.2, this should not be a problem in practice. D3D11 has no multiview support, hence no arraySize argument. Also no viewFormat argument since casting is limited with D3D11 (would need typeless formats, which we do not do). The sRGB problem is still solvable by passing in a modified format (stripping _SRGB). The same goes for OpenGL, just adjust the format. D3D12 and Vulkan have full support for everything, although viewFormat requires Windows 1703 or newer to be functional. This should be fine nowadays. The Metal version also has all the arguments, even though viewFormat may be ignored for the time being, until support is implemented in the QRhi backend. Task-number: QTBUG-122288 Task-number: QTBUG-122614 Change-Id: Ia760ce785b72378aba26695db2a4d57e10eaac90 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquickrendertarget.cpp906
-rw-r--r--src/quick/items/qquickrendertarget.h35
-rw-r--r--src/quick/items/qquickrendertarget_p.h8
3 files changed, 346 insertions, 603 deletions
diff --git a/src/quick/items/qquickrendertarget.cpp b/src/quick/items/qquickrendertarget.cpp
index e84ed02d29..cbc5fdd530 100644
--- a/src/quick/items/qquickrendertarget.cpp
+++ b/src/quick/items/qquickrendertarget.cpp
@@ -162,6 +162,24 @@ void QQuickRenderTarget::setMirrorVertically(bool enable)
}
/*!
+ \enum QQuickRenderTarget::Flag
+ Flags for the static QQuickRenderTarget constructor functions.
+
+ \value MultisampleResolve Indicates the the \c 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 \c sampleCount argument is greater than 1, it implies the
+ provided texture is multisample. The flag has no effect is the
+ \c sampleCount is 1 (indicating that multisampling is not involved).
+
+ \since 6.8
+*/
+
+/*!
\return a new QQuickRenderTarget referencing an OpenGL texture object
specified by \a textureId.
@@ -213,81 +231,83 @@ QQuickRenderTarget QQuickRenderTarget::fromOpenGLTexture(uint textureId, uint fo
d->pixelSize = pixelSize;
d->sampleCount = qMax(1, sampleCount);
- QRhiTexture::Flags rhiFlags;
- auto rhiFormat = QSGRhiSupport::toRhiTextureFormatFromGL(format, &rhiFlags);
- d->u.nativeTexture = { textureId, 0, uint(rhiFormat), uint(rhiFlags) };
+ QRhiTexture::Flags formatFlags;
+ QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromGL(format, &formatFlags);
+ d->u.nativeTexture = { textureId, 0, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
return rt;
}
/*!
- \return a new QQuickRenderTarget referencing an OpenGL texture object
- specified by \a textureId.
-
- Unlike fromOpenGLTexture(), this variant assumes that \a textureId is a
- non-multisample 2D texture, whereas \a sampleCount defines the number of
- samples desired. The resulting QQuickRenderTarget will use an intermediate,
- automatically created multisample texture as its color attachment, and will
- resolve the samples into \a textureId. This is the recommended approach to
- perform MSAA when the native OpenGL texture is not already multisample.
+ \overload
- \a format specifies the native internal format of the texture. Only texture
- formats that are supported by Qt's rendering infrastructure should be used.
+ \return a new QQuickRenderTarget referencing an OpenGL texture
+ object specified by \a textureId. The texture is assumed to have a
+ format of GL_RGBA (GL_RGBA8).
- \a pixelSize specifies the size of the image, in pixels. Currently only 2D
- textures are supported.
+ \a pixelSize specifies the size of the image, in pixels. Currently
+ only 2D textures are supported.
- \a sampleCount specifies the number of samples used for multisample
- antialiasing. 0 or 1 means no multisampling, in which case this function is
- identical to fromOpenGLTexture().
+ \a 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.
- A depth-stencil buffer, if applicable, is created and used automatically.
+ 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 \a textureId must be a valid name in the rendering
context used by the Qt Quick scenegraph.
- \note the resulting QQuickRenderTarget does not own any native resources, it
- merely contains references and the associated metadata of the size and
+ \note the resulting QQuickRenderTarget does not own any native resources,
+ it merely contains references and the associated metadata of the size and
sample count. It is the caller's responsibility to ensure that the native
resource exists as long as necessary.
- \since 6.8
-
- \note The implementation of this function is not currently compatible with
- OpenGL ES 3.0 and requires OpenGL ES 3.1 at minimum. (or OpenGL 3.0 on desktop)
-
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl, fromOpenGLTexture()
- */
-QQuickRenderTarget QQuickRenderTarget::fromOpenGLTextureWithMultiSampleResolve(uint textureId, uint format, const QSize &pixelSize, int sampleCount)
+ \sa QQuickWindow::setRenderTarget(), QQuickRenderControl
+*/
+QQuickRenderTarget QQuickRenderTarget::fromOpenGLTexture(uint textureId, const QSize &pixelSize, int sampleCount)
{
- QQuickRenderTarget rt = fromOpenGLTexture(textureId, format, pixelSize, sampleCount);
- QQuickRenderTargetPrivate::get(&rt)->multisampleResolve = sampleCount > 1;
- return rt;
+ return fromOpenGLTexture(textureId, 0, pixelSize, sampleCount);
}
/*!
- \return a new QQuickRenderTarget referencing a 2D texture array with the
- specified \a arraySize and OpenGL \a textureId.
+ \overload
- \note This implies multiview rendering (GL_OVR_multiview etc.), which can be
- relevant with VR/AR especially. \a arraySize is the number of views,
- typically \c 2. This overload should not be used other cases.
- See \l QSGMaterial::viewCount() for details on enabling multiview rendering
- within the Qt Quick scenegraph.
+ \return a new QQuickRenderTarget referencing an OpenGL 2D texture or texture
+ array object specified by \a textureId.
\a format specifies the native internal format of the texture. Only texture
formats that are supported by Qt's rendering infrastructure should be used.
- \a pixelSize specifies the size of the image, in pixels.
+ \a pixelSize specifies the size of the image, in pixels. Currently only 2D
+ textures and 2D texture arrays are supported.
\a 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.
+ multisample texture, except when \a flags contains \l MultisampleResolve. In
+ that case, \a textureId is assumed to be a non-multisample 2D texture or 2D
+ texture array, and \a sampleCount defines the number of samples desired. The
+ resulting QQuickRenderTarget will use an intermediate, automatically created
+ multisample texture (or texture array) as its color attachment, and will
+ resolve the samples into \a textureId. This is the recommended approach to
+ perform MSAA when the native OpenGL texture is not already multisample.
- The texture is used as the first color attachment of the render target used
- by the Qt Quick scenegraph. A depth-stencil texture array with a matching
- number of layers, sample count, and a format of \c D24S8 is created and used
- automatically.
+ When \a arraySize is greater than 1, it implies multiview rendering
+ (\l{https://registry.khronos.org/OpenGL/extensions/OVR/OVR_multiview.txt}{GL_OVR_multiview},
+ \l QRhiColorAttachment::setMultiViewCount()), which can be relevant with
+ VR/AR especially. In this case \a arraySize is the number of views,
+ typically \c 2. See \l QSGMaterial::viewCount() for details on enabling
+ multiview rendering within the Qt Quick scenegraph.
+
+ A depth-stencil buffer, if applicable, is created and used automatically.
+ When the color buffer is multisample, the depth-stencil buffer will
+ automatically be multisample too. For multiview rendering, the depth-stencil
+ texture will automatically be made an array with a matching \a arraySize.
+
+ The OpenGL object name \a textureId must be a valid 2D texture name in the
+ rendering context used by the Qt Quick scenegraph. When \a arraySize is
+ greater than 1, \a textureId must be a valid 2D texture array name.
\note the resulting QQuickRenderTarget does not own any native resources, it
merely contains references and the associated metadata of the size and
@@ -296,9 +316,13 @@ QQuickRenderTarget QQuickRenderTarget::fromOpenGLTextureWithMultiSampleResolve(u
\since 6.8
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl
+ \note The implementation of this overload is not compatible with OpenGL ES
+ 2.0 or 3.0, and requires OpenGL ES 3.1 at minimum. (or OpenGL 3.0 on
+ desktop)
+
+ \sa QQuickWindow::setRenderTarget(), QQuickRenderControl, fromOpenGLTexture()
*/
-QQuickRenderTarget QQuickRenderTarget::fromOpenGLTextureMultiView(uint textureId, uint format, const QSize &pixelSize, int sampleCount, int arraySize)
+QQuickRenderTarget QQuickRenderTarget::fromOpenGLTexture(uint textureId, uint format, const QSize &pixelSize, int sampleCount, int arraySize, Flags flags)
{
QQuickRenderTarget rt;
QQuickRenderTargetPrivate *d = QQuickRenderTargetPrivate::get(&rt);
@@ -313,104 +337,25 @@ QQuickRenderTarget QQuickRenderTarget::fromOpenGLTextureMultiView(uint textureId
return rt;
}
- if (arraySize < 1) {
- qWarning("QQuickRenderTarget: Texture array must have at least one element");
- return rt;
- }
+ QRhiTexture::Flags formatFlags;
+ QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromGL(format, &formatFlags);
- d->type = QQuickRenderTargetPrivate::Type::NativeTextureArray;
d->pixelSize = pixelSize;
d->sampleCount = qMax(1, sampleCount);
+ d->multisampleResolve = flags.testFlag(Flag::MultisampleResolve);
- QRhiTexture::Flags rhiFlags;
- auto rhiFormat = QSGRhiSupport::toRhiTextureFormatFromGL(format, &rhiFlags);
- d->u.nativeTextureArray = { textureId, 0, arraySize, uint(rhiFormat), uint(rhiFlags) };
-
- return rt;
-}
-
-/*!
- \return a new QQuickRenderTarget referencing a 2D texture array with the
- specified \a arraySize and OpenGL \a textureId.
-
- \note This implies multiview rendering (GL_OVR_multiview etc.), which can be
- relevant with VR/AR especially. \a arraySize is the number of views,
- typically \c 2. This overload should not be used other cases.
- See \l QSGMaterial::viewCount() for details on enabling multiview rendering
- within the Qt Quick scenegraph.
-
- Unlike fromOpenGLTextureMultiView(), this variant assumes that \a textureId
- is a non-multisample 2D texture array, whereas \a sampleCount defines the
- number of samples desired. The resulting QQuickRenderTarget will use an
- intermediate, automatically created multisample texture array as its color
- attachment, and will resolve the samples into \a textureId. This is the
- recommended approach to perform MSAA when the native OpenGL texture is not
- already multisample.
-
- \a format specifies the native internal format of the texture. Only texture
- formats that are supported by Qt's rendering infrastructure should be used.
-
- \a pixelSize specifies the size of the image, in pixels.
-
- \a sampleCount specifies the number of samples used for multisample
- antialiasing. 0 or 1 means no multisampling, in which case this function is
- identical to fromOpenGLTextureMultiView().
-
- The texture is used as the first color attachment of the render target used
- by the Qt Quick scenegraph. A depth-stencil texture array with a matching
- number of layers, sample count, and a format of \c D24S8 is created and used
- automatically.
-
- \note the resulting QQuickRenderTarget does not own any native resources, it
- merely contains references and the associated metadata of the size and
- sample count. It is the caller's responsibility to ensure that the native
- resource exists as long as necessary.
-
- \since 6.8
+ if (arraySize <= 1) {
+ d->type = QQuickRenderTargetPrivate::Type::NativeTexture;
+ d->u.nativeTexture = { textureId, 0, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
+ } else {
+ d->type = QQuickRenderTargetPrivate::Type::NativeTextureArray;
+ d->u.nativeTextureArray = { textureId, 0, arraySize, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
+ }
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl
- */
-QQuickRenderTarget QQuickRenderTarget::fromOpenGLTextureMultiViewWithMultiSampleResolve(uint textureId, uint format, const QSize &pixelSize, int sampleCount, int arraySize)
-{
- QQuickRenderTarget rt = fromOpenGLTextureMultiView(textureId, format, pixelSize, sampleCount, arraySize);
- QQuickRenderTargetPrivate::get(&rt)->multisampleResolve = sampleCount > 1;
return rt;
}
/*!
- \overload
-
- \return a new QQuickRenderTarget referencing an OpenGL texture
- object specified by \a textureId. The texture is assumed to have a
- format of GL_RGBA (GL_RGBA8).
-
- \a pixelSize specifies the size of the image, in pixels. Currently
- only 2D textures are supported.
-
- \a 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 \a textureId must be a valid name in the rendering
- context used by the Qt Quick scenegraph.
-
- \note the resulting QQuickRenderTarget does not own any native resources,
- it merely contains references and the associated metadata of the size and
- sample count. It is the caller's responsibility to ensure that the native
- resource exists as long as necessary.
-
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl
-*/
-QQuickRenderTarget QQuickRenderTarget::fromOpenGLTexture(uint textureId, const QSize &pixelSize, int sampleCount)
-{
- return fromOpenGLTexture(textureId, 0, pixelSize, sampleCount);
-}
-
-/*!
\return a new QQuickRenderTarget referencing an OpenGL renderbuffer object
specified by \a renderbufferId.
@@ -508,83 +453,84 @@ QQuickRenderTarget QQuickRenderTarget::fromD3D11Texture(void *texture, uint form
d->pixelSize = pixelSize;
d->sampleCount = qMax(1, sampleCount);
- QRhiTexture::Flags flags;
- auto rhiFormat = QSGRhiSupport::toRhiTextureFormatFromDXGI(format, &flags);
- d->u.nativeTexture = { quint64(texture), 0, uint(rhiFormat), uint(flags) };
+ QRhiTexture::Flags formatFlags;
+ QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromDXGI(format, &formatFlags);
+ d->u.nativeTexture = { quint64(texture), 0, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
return rt;
}
/*!
- \return a new QQuickRenderTarget referencing a D3D11 texture object
- specified by \a texture.
-
- Unlike fromD3D11Texture(), this variant assumes that \a texture is a
- non-multisample 2D texture, whereas \a sampleCount defines the number of
- samples desired. The resulting QQuickRenderTarget will use an intermediate,
- automatically created multisample texture as its color attachment, and will
- resolve the samples into \a texture. This is the recommended approach to
- perform MSAA when the native Direct 3D texture is not already multisample.
+ \overload
- \a format specifies the DXGI_FORMAT of the texture. Only texture formats
- that are supported by Qt's rendering infrastructure should be used.
+ \return a new QQuickRenderTarget referencing a D3D11 texture
+ object specified by \a texture. The texture is assumed to have a
+ format of DXGI_FORMAT_R8G8B8A8_UNORM.
\a pixelSize specifies the size of the image, in pixels. Currently only 2D
textures are supported.
- \a sampleCount specifies the number of samples used for multisample
- antialiasing. 0 or 1 means no multisampling, in which case this function is
- identical to fromD3D11Texture().
+ \a 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.
- \note the resulting QQuickRenderTarget does not own any native resources, it
- merely contains references and the associated metadata of the size and
+ \note the resulting QQuickRenderTarget does not own any native resources,
+ it merely contains references and the associated metadata of the size and
sample count. It is the caller's responsibility to ensure that the native
resource exists as long as necessary.
- \since 6.8
-
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl, fromD3D11Texture()
- */
-QQuickRenderTarget QQuickRenderTarget::fromD3D11TextureWithMultiSampleResolve(void *texture, uint format,
- const QSize &pixelSize, int sampleCount)
+ \sa QQuickWindow::setRenderTarget(), QQuickRenderControl
+*/
+QQuickRenderTarget QQuickRenderTarget::fromD3D11Texture(void *texture, const QSize &pixelSize, int sampleCount)
{
- QQuickRenderTarget rt = fromD3D11Texture(texture, format, pixelSize, sampleCount);
- QQuickRenderTargetPrivate::get(&rt)->multisampleResolve = sampleCount > 1;
- return rt;
+ return fromD3D11Texture(texture, 0 /* DXGI_FORMAT_UNKNOWN */, pixelSize, sampleCount);
}
/*!
\overload
- \return a new QQuickRenderTarget referencing a D3D11 texture
- object specified by \a texture. The texture is assumed to have a
- format of DXGI_FORMAT_R8G8B8A8_UNORM.
+ \return a new QQuickRenderTarget referencing a D3D11 texture object
+ specified by \a texture.
+
+ \a format specifies the DXGI_FORMAT of the texture. Only texture formats
+ that are supported by Qt's rendering infrastructure should be used.
\a pixelSize specifies the size of the image, in pixels. Currently only 2D
textures are supported.
\a 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.
+ multisample texture, except when \a flags contains \l MultisampleResolve. In
+ that case, \a texture is assumed to be a non-multisample 2D texture and \a
+ sampleCount defines the number of samples desired. The resulting
+ QQuickRenderTarget will use an intermediate, automatically created
+ multisample texture as its color attachment, and will resolve the samples
+ into \a texture. This is the recommended approach to perform MSAA when the
+ native texture is not already multisample.
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.
+ created and used automatically. When the color buffer is multisample, the
+ depth-stencil buffer will automatically be multisample too.
- \note the resulting QQuickRenderTarget does not own any native resources,
- it merely contains references and the associated metadata of the size and
+ \note the resulting QQuickRenderTarget does not own any native resources, it
+ merely contains references and the associated metadata of the size and
sample count. It is the caller's responsibility to ensure that the native
resource exists as long as necessary.
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl
-*/
-QQuickRenderTarget QQuickRenderTarget::fromD3D11Texture(void *texture, const QSize &pixelSize, int sampleCount)
+ \since 6.8
+
+ \sa QQuickWindow::setRenderTarget(), QQuickRenderControl, fromD3D11Texture()
+ */
+QQuickRenderTarget QQuickRenderTarget::fromD3D11Texture(void *texture, uint format, const QSize &pixelSize, int sampleCount, Flags flags)
{
- return fromD3D11Texture(texture, 0 /* DXGI_FORMAT_UNKNOWN */, pixelSize, sampleCount);
+ QQuickRenderTarget rt = fromD3D11Texture(texture, format, pixelSize, sampleCount);
+ QQuickRenderTargetPrivate::get(&rt)->multisampleResolve = flags.testFlag(Flag::MultisampleResolve);
+ return rt;
}
/*!
@@ -640,23 +586,18 @@ QQuickRenderTarget QQuickRenderTarget::fromD3D12Texture(void *texture,
d->pixelSize = pixelSize;
d->sampleCount = qMax(1, sampleCount);
- QRhiTexture::Flags flags;
- auto rhiFormat = QSGRhiSupport::toRhiTextureFormatFromDXGI(format, &flags);
- d->u.nativeTexture = { quint64(texture), resourceState, uint(rhiFormat), uint(flags) };
+ QRhiTexture::Flags formatFlags;
+ QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromDXGI(format, &formatFlags);
+ d->u.nativeTexture = { quint64(texture), resourceState, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
return rt;
}
/*!
- \return a new QQuickRenderTarget referencing a D3D12 texture object
- specified by \a texture.
+ \overload
- Unlike fromD3D12Texture(), this variant assumes that \a texture is a
- non-multisample 2D texture, whereas \a sampleCount defines the number of
- samples desired. The resulting QQuickRenderTarget will use an intermediate,
- automatically created multisample texture as its color attachment, and will
- resolve the samples into \a texture. This is the recommended approach to
- perform MSAA when the native Direct 3D texture is not already multisample.
+ \return a new QQuickRenderTarget referencing a D3D12 2D texture or 2D
+ texture array object specified by \a texture.
\a resourceState must a valid bitmask with bits from D3D12_RESOURCE_STATES,
specifying the resource's current state.
@@ -664,65 +605,39 @@ QQuickRenderTarget QQuickRenderTarget::fromD3D12Texture(void *texture,
\a format specifies the DXGI_FORMAT of the texture. Only texture formats
that are supported by Qt's rendering infrastructure should be used.
- \a pixelSize specifies the size of the image, in pixels. Currently only 2D
- textures are supported.
-
- \a sampleCount specifies the number of samples used for multisample
- antialiasing. 0 or 1 means no multisampling, in which case this function is
- identical to fromD3D12Texture().
-
- 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.
-
- \note the resulting QQuickRenderTarget does not own any native resources, it
- merely contains references and the associated metadata of the size and
- sample count. It is the caller's responsibility to ensure that the native
- resource exists as long as necessary.
-
- \since 6.8
-
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl, fromD3D12Texture()
- */
-QQuickRenderTarget QQuickRenderTarget::fromD3D12TextureWithMultiSampleResolve(void *texture,
- int resourceState,
- uint format,
- const QSize &pixelSize,
- int sampleCount)
-{
- QQuickRenderTarget rt = fromD3D12Texture(texture, resourceState, format, pixelSize, sampleCount);
- QQuickRenderTargetPrivate::get(&rt)->multisampleResolve = sampleCount > 1;
- return rt;
-}
-
-/*!
- \return a new QQuickRenderTarget referencing a D3D12 texture array object
- specified by \a texture. The number of array elements (layers) is given in
- \a arraySize.
-
- \note This implies multiview rendering (GL_OVR_multiview etc.), which can be
- relevant with VR/AR especially. \a arraySize is the number of views,
- typically \c 2. This overload should not be used other cases.
- See \l QSGMaterial::viewCount() for details on enabling multiview rendering
- within the Qt Quick scenegraph.
-
- \a resourceState must a valid bitmask with bits from D3D12_RESOURCE_STATES,
- specifying the resource's current state.
-
- \a format specifies the DXGI_FORMAT of the texture. Only texture formats
- that are supported by Qt's rendering infrastructure should be used.
+ \a viewFormat is the DXGI_FORMAT used for the render target view (RTV).
+ Often the same as \a format. Functional only when
+ \l{https://microsoft.github.io/DirectX-Specs/d3d/RelaxedCasting.html}{relaxed
+ format casting} is supported by the driver, the argument is ignored otherwise.
+ In practice support is expected to be always available on Windows 10 1703
+ and newer.
\a pixelSize specifies the size of the image, in pixels. Currently only 2D
- textures are supported.
+ textures and 2D texture arrays are supported.
\a 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.
+ multisample texture, except when \a flags contains \l MultisampleResolve. In
+ that case, \a texture is assumed to be a non-multisample 2D texture or 2D
+ texture array, and \a sampleCount defines the number of samples desired. The
+ resulting QQuickRenderTarget will use an intermediate, automatically created
+ multisample texture (or texture array) as its color attachment, and will
+ resolve the samples into \a texture. This is the recommended approach to
+ perform MSAA when the native D3D12 texture is not already multisample.
+
+ The number of array elements (layers) is given in \a arraySize. When greater
+ than 1, it implies multiview rendering
+ (\l{https://microsoft.github.io/DirectX-Specs/d3d/ViewInstancing.html}{view
+ instancing}), which can be relevant with VR/AR especially. \a arraySize is
+ the number of views, typically \c 2. See \l QSGMaterial::viewCount() for
+ details on enabling multiview rendering within the Qt Quick scenegraph.
The texture is used as the first color attachment of the render target used
- by the Qt Quick scenegraph. A depth-stencil texture array with a matching
- number of layers, sample count, and a format of \l{QRhiTexture::}{D24S8} is
- created and used automatically.
+ by the Qt Quick scenegraph. A depth-stencil buffer, if applicable, is
+ created and used automatically. When the color buffer is multisample, the
+ depth-stencil buffer will automatically be multisample too. For multiview
+ rendering, the depth-stencil texture will automatically be made an array
+ with a matching \a arraySize.
\note the resulting QQuickRenderTarget does not own any native resources, it
merely contains references and the associated metadata of the size and
@@ -733,12 +648,14 @@ QQuickRenderTarget QQuickRenderTarget::fromD3D12TextureWithMultiSampleResolve(vo
\sa QQuickWindow::setRenderTarget(), QQuickRenderControl
*/
-QQuickRenderTarget QQuickRenderTarget::fromD3D12TextureMultiView(void *texture,
- int resourceState,
- uint format,
- const QSize &pixelSize,
- int sampleCount,
- int arraySize)
+QQuickRenderTarget QQuickRenderTarget::fromD3D12Texture(void *texture,
+ int resourceState,
+ uint format,
+ uint viewFormat,
+ const QSize &pixelSize,
+ int sampleCount,
+ int arraySize,
+ Flags flags)
{
QQuickRenderTarget rt;
QQuickRenderTargetPrivate *d = QQuickRenderTargetPrivate::get(&rt);
@@ -753,80 +670,27 @@ QQuickRenderTarget QQuickRenderTarget::fromD3D12TextureMultiView(void *texture,
return rt;
}
- if (arraySize < 1) {
- qWarning("QQuickRenderTarget: Texture array must have at least one element");
- return rt;
- }
+ QRhiTexture::Flags formatFlags;
+ QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromDXGI(format, &formatFlags);
+ QRhiTexture::Flags viewFormatFlags;
+ QRhiTexture::Format rhiViewFormat = QSGRhiSupport::toRhiTextureFormatFromDXGI(viewFormat, &viewFormatFlags);
- d->type = QQuickRenderTargetPrivate::Type::NativeTextureArray;
d->pixelSize = pixelSize;
d->sampleCount = qMax(1, sampleCount);
+ d->multisampleResolve = flags.testFlag(Flag::MultisampleResolve);
- QRhiTexture::Flags flags;
- auto rhiFormat = QSGRhiSupport::toRhiTextureFormatFromDXGI(format, &flags);
- d->u.nativeTextureArray = { quint64(texture), resourceState, arraySize, uint(rhiFormat), uint(flags) };
+ if (arraySize <= 1) {
+ d->type = QQuickRenderTargetPrivate::Type::NativeTexture;
+ d->u.nativeTexture = { quint64(texture), resourceState, uint(rhiFormat), uint(formatFlags), uint(rhiViewFormat), uint(viewFormatFlags) };
+ } else {
+ d->type = QQuickRenderTargetPrivate::Type::NativeTextureArray;
+ d->u.nativeTextureArray = { quint64(texture), resourceState, arraySize, uint(rhiFormat), uint(formatFlags), uint(rhiViewFormat), uint(viewFormatFlags) };
+ }
return rt;
}
-/*!
- \return a new QQuickRenderTarget referencing a D3D12 texture array object
- specified by \a texture. The number of array elements (layers) is given in
- \a arraySize.
-
- \note This implies multiview rendering (GL_OVR_multiview etc.), which can be
- relevant with VR/AR especially. \a arraySize is the number of views,
- typically \c 2. This overload should not be used other cases.
- See \l QSGMaterial::viewCount() for details on enabling multiview rendering
- within the Qt Quick scenegraph.
-
- Unlike fromD3D12TextureMultiView(), this variant assumes that \a texture is a
- non-multisample 2D texture array, whereas \a sampleCount defines the number
- of samples desired. The resulting QQuickRenderTarget will use an
- intermediate, automatically created multisample texture array as its color
- attachment, and will resolve the samples into \a texture. This is the
- recommended approach to perform MSAA when the native Direct 3D texture is not
- already multisample.
-
- \a resourceState must a valid bitmask with bits from D3D12_RESOURCE_STATES,
- specifying the resource's current state.
-
- \a format specifies the DXGI_FORMAT of the texture. Only texture formats
- that are supported by Qt's rendering infrastructure should be used.
-
- \a pixelSize specifies the size of the image, in pixels. Currently only 2D
- textures are supported.
-
- \a sampleCount specifies the number of samples used for multisample
- antialiasing. 0 or 1 means no multisampling, in which case this function is
- identical to fromD3D12TextureMultiView().
-
- The texture is used as the first color attachment of the render target used
- by the Qt Quick scenegraph. A depth-stencil texture array with a matching
- number of layers, sample count, and a format of \l{QRhiTexture::}{D24S8} is
- created and used automatically.
-
- \note the resulting QQuickRenderTarget does not own any native resources, it
- merely contains references and the associated metadata of the size and
- sample count. It is the caller's responsibility to ensure that the native
- resource exists as long as necessary.
-
- \since 6.8
-
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl
- */
-QQuickRenderTarget QQuickRenderTarget::fromD3D12TextureMultiViewWithMultiSampleResolve(void *texture,
- int resourceState,
- uint format,
- const QSize &pixelSize,
- int sampleCount,
- int arraySize)
-{
- QQuickRenderTarget rt = fromD3D12TextureMultiView(texture, resourceState, format, pixelSize, sampleCount, arraySize);
- QQuickRenderTargetPrivate::get(&rt)->multisampleResolve = sampleCount > 1;
- return rt;
-}
-#endif
+#endif // Q_OS_WIN
/*!
\return a new QQuickRenderTarget referencing a Metal texture object
@@ -876,34 +740,23 @@ QQuickRenderTarget QQuickRenderTarget::fromMetalTexture(MTLTexture *texture, uin
d->pixelSize = pixelSize;
d->sampleCount = qMax(1, sampleCount);
- QRhiTexture::Flags flags;
- auto rhiFormat = QSGRhiSupport::toRhiTextureFormatFromMetal(format, &flags);
- d->u.nativeTexture = { quint64(texture), 0, uint(rhiFormat), uint(flags) };
+ QRhiTexture::Flags formatFlags;
+ QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromMetal(format, &formatFlags);
+ d->u.nativeTexture = { quint64(texture), 0, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
return rt;
}
/*!
- \return a new QQuickRenderTarget referencing a Metal texture object
- specified by \a texture.
-
- Unlike fromMetalTexture(), this variant assumes that \a texture is a
- non-multisample 2D texture, whereas \a sampleCount defines the number of
- samples desired. The resulting QQuickRenderTarget will use an intermediate,
- automatically created multisample texture as its color attachment, and will
- resolve the samples into \a texture. This is the recommended approach to
- perform MSAA when the native Metal texture is not already multisample.
+ \overload
- \a format specifies the MTLPixelFormat of the texture. Only texture formats
- that are supported by Qt's rendering infrastructure should be used.
+ \return a new QQuickRenderTarget referencing a Metal texture object
+ specified by \a texture. The texture is assumed to have a format of
+ MTLPixelFormatRGBA8Unorm.
\a pixelSize specifies the size of the image, in pixels. Currently only 2D
textures are supported.
- \a sampleCount specifies the number of samples used for multisample
- antialiasing. 0 or 1 means no multisampling, in which case this function is
- identical to fromMetalTexture().
-
\a 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.
@@ -917,42 +770,54 @@ QQuickRenderTarget QQuickRenderTarget::fromMetalTexture(MTLTexture *texture, uin
sample count. It is the caller's responsibility to ensure that the native
resource exists as long as necessary.
- \since 6.8
-
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl, fromMetalTexture()
- */
-QQuickRenderTarget QQuickRenderTarget::fromMetalTextureWithMultiSampleResolve(MTLTexture *texture, uint format,
- const QSize &pixelSize, int sampleCount)
+ \sa QQuickWindow::setRenderTarget(), QQuickRenderControl
+*/
+QQuickRenderTarget QQuickRenderTarget::fromMetalTexture(MTLTexture *texture, const QSize &pixelSize, int sampleCount)
{
- QQuickRenderTarget rt = fromMetalTexture(texture, format, pixelSize, sampleCount);
- QQuickRenderTargetPrivate::get(&rt)->multisampleResolve = sampleCount > 1;
- return rt;
+ return fromMetalTexture(texture, 0 /* MTLPixelFormatInvalid */, pixelSize, sampleCount);
}
/*!
- \return a new QQuickRenderTarget referencing a Metal texture array object
- with \a arraySize elements specified by \a texture.
+ \overload
- \note This implies multiview rendering (GL_OVR_multiview etc.), which can be
- relevant with VR/AR especially. \a arraySize is the number of views,
- typically \c 2. This overload should not be used other cases.
- See \l QSGMaterial::viewCount() for details on enabling multiview rendering
- within the Qt Quick scenegraph.
+ \return a new QQuickRenderTarget referencing a Metal 2D texture or 2D
+ texture array given in \a texture.
\a format specifies the MTLPixelFormat of the texture. Only texture formats
that are supported by Qt's rendering infrastructure should be used.
+ \a viewFormat is usually set to the same value as \a format. In some cases,
+ such as when rendering into a texture with a \c{_SRGB} format and the
+ implicit linear->sRGB conversion on shader writes is not wanted, the value
+ can be different. Note however that the value may be ignored by Qt, when at
+ run time QRhi reports that the \l{QRhi::TextureViewFormat} feature is
+ unsupported.
+
\a pixelSize specifies the size of the image, in pixels. Currently only 2D
- textures are supported.
+ textures and 2D texture arrays are supported.
\a 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.
+ multisample texture, except when \a flags contains \l MultisampleResolve. In
+ that case, \a image is assumed to be a non-multisample 2D texture or 2D
+ texture array, and \a sampleCount defines the number of samples desired. The
+ resulting QQuickRenderTarget will use an intermediate, automatically created
+ multisample texture (or texture array) as its color attachment, and will
+ resolve the samples into \a image. This is the recommended approach to
+ perform MSAA when the native Metal texture is not already multisample.
+
+ The number of array elements (layers) is given in \a arraySize. When greater
+ than 1, it implies multiview rendering, which can be relevant with VR/AR
+ especially. \a arraySize is the number of views, typically \c 2. See
+ \l QSGMaterial::viewCount() for details on enabling multiview rendering within
+ the Qt Quick scenegraph.
The texture is used as the first color attachment of the render target used
- by the Qt Quick scenegraph. A depth-stencil texture array with a matching
- number of layers, sample count, and a format of \c D24S8 is created and used
- automatically.
+ by the Qt Quick scenegraph. A depth-stencil buffer, if applicable, is
+ created and used automatically. When the color buffer is multisample, the
+ depth-stencil buffer will automatically be multisample too. For multiview
+ rendering, the depth-stencil texture will automatically be made an array
+ with a matching \a arraySize.
\note the resulting QQuickRenderTarget does not own any native resources, it
merely contains references and the associated metadata of the size and
@@ -963,8 +828,8 @@ QQuickRenderTarget QQuickRenderTarget::fromMetalTextureWithMultiSampleResolve(MT
\sa QQuickWindow::setRenderTarget(), QQuickRenderControl
*/
-QQuickRenderTarget QQuickRenderTarget::fromMetalTextureMultiView(MTLTexture *texture, uint format,
- const QSize &pixelSize, int sampleCount, int arraySize)
+QQuickRenderTarget QQuickRenderTarget::fromMetalTexture(MTLTexture *texture, uint format, uint viewFormat,
+ const QSize &pixelSize, int sampleCount, int arraySize, Flags flags)
{
QQuickRenderTarget rt;
QQuickRenderTargetPrivate *d = QQuickRenderTargetPrivate::get(&rt);
@@ -979,101 +844,26 @@ QQuickRenderTarget QQuickRenderTarget::fromMetalTextureMultiView(MTLTexture *tex
return rt;
}
- if (arraySize < 1) {
- qWarning("QQuickRenderTarget: Texture array must have at least one element");
- return rt;
- }
+ QRhiTexture::Flags formatFlags;
+ QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromMetal(format, &formatFlags);
+ QRhiTexture::Flags viewFormatFlags;
+ QRhiTexture::Format rhiViewFormat = QSGRhiSupport::toRhiTextureFormatFromMetal(viewFormat, &viewFormatFlags);
- d->type = QQuickRenderTargetPrivate::Type::NativeTextureArray;
d->pixelSize = pixelSize;
d->sampleCount = qMax(1, sampleCount);
+ d->multisampleResolve = flags.testFlag(MultisampleResolve);
- QRhiTexture::Flags flags;
- auto rhiFormat = QSGRhiSupport::toRhiTextureFormatFromMetal(format, &flags);
- d->u.nativeTextureArray = { quint64(texture), 0, arraySize, uint(rhiFormat), uint(flags) };
-
- return rt;
-}
-
-/*!
- \return a new QQuickRenderTarget referencing a Metal texture array object
- with \a arraySize elements specified by \a texture.
-
- \note This implies multiview rendering (GL_OVR_multiview etc.), which can be
- relevant with VR/AR especially. \a arraySize is the number of views,
- typically \c 2. This overload should not be used other cases.
- See \l QSGMaterial::viewCount() for details on enabling multiview rendering
- within the Qt Quick scenegraph.
-
- Unlike fromMetalTextureMultiView(), this variant assumes that \a texture is a
- non-multisample 2D texture array, whereas \a sampleCount defines the number
- of samples desired. The resulting QQuickRenderTarget will use an
- intermediate, automatically created multisample texture array as its color
- attachment, and will resolve the samples into \a texture. This is the
- recommended approach to perform MSAA when the native Metal texture is not
- already multisample.
-
- \a format specifies the MTLPixelFormat of the texture. Only texture formats
- that are supported by Qt's rendering infrastructure should be used.
-
- \a pixelSize specifies the size of the image, in pixels. Currently only 2D
- textures are supported.
-
- \a sampleCount specifies the number of samples used for multisample
- antialiasing. 0 or 1 means no multisampling, in which case this function is
- identical to fromMetalTextureMultiView().
-
- The texture is used as the first color attachment of the render target used
- by the Qt Quick scenegraph. A depth-stencil texture array with a matching
- number of layers, sample count, and a format of \c D24S8 is created and used
- automatically.
-
- \note the resulting QQuickRenderTarget does not own any native resources, it
- merely contains references and the associated metadata of the size and
- sample count. It is the caller's responsibility to ensure that the native
- resource exists as long as necessary.
-
- \since 6.8
+ if (arraySize <= 1) {
+ d->type = QQuickRenderTargetPrivate::Type::NativeTexture;
+ d->u.nativeTexture = { quint64(texture), 0, uint(rhiFormat), uint(formatFlags), uint(rhiViewFormat), uint(viewFormatFlags) };
+ } else {
+ d->type = QQuickRenderTargetPrivate::Type::NativeTextureArray;
+ d->u.nativeTextureArray = { quint64(texture), 0, arraySize, uint(rhiFormat), uint(formatFlags), uint(rhiViewFormat), uint(viewFormatFlags) };
+ }
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl
- */
-QQuickRenderTarget QQuickRenderTarget::fromMetalTextureMultiViewWithMultiSampleResolve(MTLTexture *texture, uint format,
- const QSize &pixelSize, int sampleCount, int arraySize)
-{
- QQuickRenderTarget rt = fromMetalTextureMultiView(texture, format, pixelSize, sampleCount, arraySize);
- QQuickRenderTargetPrivate::get(&rt)->multisampleResolve = sampleCount > 1;
return rt;
}
-/*!
- \overload
-
- \return a new QQuickRenderTarget referencing a Metal texture object
- specified by \a texture. The texture is assumed to have a format of
- MTLPixelFormatRGBA8Unorm.
-
- \a pixelSize specifies the size of the image, in pixels. Currently only 2D
- textures are supported.
-
- \a 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.
-
- \note the resulting QQuickRenderTarget does not own any native resources,
- it merely contains references and the associated metadata of the size and
- sample count. It is the caller's responsibility to ensure that the native
- resource exists as long as necessary.
-
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl
-*/
-QQuickRenderTarget QQuickRenderTarget::fromMetalTexture(MTLTexture *texture, const QSize &pixelSize, int sampleCount)
-{
- return fromMetalTexture(texture, 0 /* MTLPixelFormatInvalid */, pixelSize, sampleCount);
-}
#endif
/*!
@@ -1105,8 +895,7 @@ QQuickRenderTarget QQuickRenderTarget::fromMetalTexture(MTLTexture *texture, con
\sa QQuickWindow::setRenderTarget(), QQuickRenderControl
*/
#if QT_CONFIG(vulkan) || defined(Q_QDOC)
-QQuickRenderTarget QQuickRenderTarget::fromVulkanImage(VkImage image, VkImageLayout layout, VkFormat format,
- const QSize &pixelSize, int sampleCount)
+QQuickRenderTarget QQuickRenderTarget::fromVulkanImage(VkImage image, VkImageLayout layout, VkFormat format, const QSize &pixelSize, int sampleCount)
{
QQuickRenderTarget rt;
QQuickRenderTargetPrivate *d = QQuickRenderTargetPrivate::get(&rt);
@@ -1125,36 +914,28 @@ QQuickRenderTarget QQuickRenderTarget::fromVulkanImage(VkImage image, VkImageLay
d->pixelSize = pixelSize;
d->sampleCount = qMax(1, sampleCount);
- QRhiTexture::Flags flags;
- auto rhiFormat = QSGRhiSupport::toRhiTextureFormatFromVulkan(format, &flags);
- d->u.nativeTexture = { quint64(image), layout, uint(rhiFormat), uint(flags) };
+ QRhiTexture::Flags formatFlags;
+ QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromVulkan(format, &formatFlags);
+ d->u.nativeTexture = { quint64(image), layout, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
return rt;
}
/*!
- \return a new QQuickRenderTarget referencing a Vulkan image object
- specified by \a image. The current \a layout of the image must be provided
- as well.
-
- Unlike fromVulkanImage(), this variant assumes that \a image is a
- non-multisample 2D texture, whereas \a sampleCount defines the number of
- samples desired. The resulting QQuickRenderTarget will use an intermediate,
- automatically created multisample texture as its color attachment, and will
- resolve the samples into \a image. This is the recommended approach to
- perform MSAA when the native Vulkan image is not already multisample.
+ \overload
- \a format specifies the VkFormat of the image. Only image formats that are
- supported by Qt's rendering infrastructure should be used.
+ \return a new QQuickRenderTarget referencing a Vulkan image object specified
+ by \a image. The image is assumed to have a format of
+ VK_FORMAT_R8G8B8A8_UNORM.
\a pixelSize specifies the size of the image, in pixels. Currently only 2D
textures are supported.
- \a sampleCount specifies the number of samples used for multisample
- antialiasing. 0 or 1 means no multisampling, in which case this function is
- identical to fromVulkanImage().
+ \a 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
+ 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.
@@ -1163,43 +944,55 @@ QQuickRenderTarget QQuickRenderTarget::fromVulkanImage(VkImage image, VkImageLay
sample count. It is the caller's responsibility to ensure that the native
resource exists as long as necessary.
- \since 6.8
-
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl, fromVulkanImage()
- */
-QQuickRenderTarget QQuickRenderTarget::fromVulkanImageWithMultiSampleResolve(VkImage image, VkImageLayout layout, VkFormat format,
- const QSize &pixelSize, int sampleCount)
+ \sa QQuickWindow::setRenderTarget(), QQuickRenderControl
+*/
+QQuickRenderTarget QQuickRenderTarget::fromVulkanImage(VkImage image, VkImageLayout layout, const QSize &pixelSize, int sampleCount)
{
- QQuickRenderTarget rt = fromVulkanImage(image, layout, format, pixelSize, sampleCount);
- QQuickRenderTargetPrivate::get(&rt)->multisampleResolve = sampleCount > 1;
- return rt;
+ return fromVulkanImage(image, layout, VK_FORMAT_UNDEFINED, pixelSize, sampleCount);
}
/*!
- \return a new QQuickRenderTarget referencing a Vulkan image object with
- \a arraySize layers specified by \a image. The current \a layout of the image
- must be provided as well.
+ \overload
- \note This implies multiview rendering (GL_OVR_multiview etc.), which can be
- relevant with VR/AR especially. \a arraySize is the number of views,
- typically \c 2. This overload should not be used other cases.
- See \l QSGMaterial::viewCount() for details on enabling multiview rendering
- within the Qt Quick scenegraph.
+ \return a new QQuickRenderTarget referencing a Vulkan image object
+ specified by \a image. The current \a layout of the image must be provided
+ as well. The image must be either a 2D texture or 2D texture array.
\a format specifies the VkFormat of the image. Only image formats that are
supported by Qt's rendering infrastructure should be used.
+ \a viewFormat is usually set to the same value as \a format. In some cases,
+ such as when rendering into a texture with a \c{_SRGB} format and the
+ implicit linear->sRGB conversion on shader writes is not wanted, the value
+ can be different. (for example, a \a format of \c VK_FORMAT_R8G8B8A8_SRGB
+ and \a viewFormat of \c VK_FORMAT_R8G8B8A8_UNORM).
+
\a pixelSize specifies the size of the image, in pixels. Currently only 2D
textures are supported.
\a 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.
+ multisample texture, except when \a flags contains \l MultisampleResolve. In
+ that case, \a image is assumed to be a non-multisample 2D texture or 2D
+ texture array, and \a sampleCount defines the number of samples desired. The
+ resulting QQuickRenderTarget will use an intermediate, automatically created
+ multisample texture (or texture array) as its color attachment, and will
+ resolve the samples into \a image. This is the recommended approach to
+ perform MSAA when the native Vulkan image is not already multisample.
+
+ The number of array elements (layers) is given in \a arraySize. When greater
+ than 1, it implies multiview rendering
+ (\l{https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_multiview.html}{VK_KHR_multiview}),
+ which can be relevant with VR/AR especially. \a arraySize is the number of
+ views, typically \c 2. See \l QSGMaterial::viewCount() for details on
+ enabling multiview rendering within the Qt Quick scenegraph.
- The image is used as the first color attachment of the render target used by
- the Qt Quick scenegraph. A depth-stencil texture array with a matching
- number of layers, sample count, and a format of \c D24S8 is created and used
- automatically.
+ 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. When the color buffer is multisample, the
+ depth-stencil buffer will automatically be multisample too. For multiview
+ rendering, the depth-stencil texture will automatically be made an array
+ with a matching \a arraySize.
\note the resulting QQuickRenderTarget does not own any native resources, it
merely contains references and the associated metadata of the size and
@@ -1210,8 +1003,8 @@ QQuickRenderTarget QQuickRenderTarget::fromVulkanImageWithMultiSampleResolve(VkI
\sa QQuickWindow::setRenderTarget(), QQuickRenderControl
*/
-QQuickRenderTarget QQuickRenderTarget::fromVulkanImageMultiView(VkImage image, VkImageLayout layout, VkFormat format,
- const QSize &pixelSize, int sampleCount, int arraySize)
+QQuickRenderTarget QQuickRenderTarget::fromVulkanImage(VkImage image, VkImageLayout layout, VkFormat format, VkFormat viewFormat,
+ const QSize &pixelSize, int sampleCount, int arraySize, Flags flags)
{
QQuickRenderTarget rt;
QQuickRenderTargetPrivate *d = QQuickRenderTargetPrivate::get(&rt);
@@ -1226,103 +1019,27 @@ QQuickRenderTarget QQuickRenderTarget::fromVulkanImageMultiView(VkImage image, V
return rt;
}
- if (arraySize < 1) {
- qWarning("QQuickRenderTarget: Texture array must have at least one element");
- return rt;
- }
+ QRhiTexture::Flags formatFlags;
+ QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromVulkan(format, &formatFlags);
+ QRhiTexture::Flags viewFormatFlags;
+ QRhiTexture::Format rhiViewFormat = QSGRhiSupport::toRhiTextureFormatFromVulkan(viewFormat, &viewFormatFlags);
- d->type = QQuickRenderTargetPrivate::Type::NativeTextureArray;
d->pixelSize = pixelSize;
d->sampleCount = qMax(1, sampleCount);
+ d->multisampleResolve = flags.testFlag(Flag::MultisampleResolve);
- QRhiTexture::Flags flags;
- auto rhiFormat = QSGRhiSupport::toRhiTextureFormatFromVulkan(format, &flags);
- d->u.nativeTextureArray = { quint64(image), layout, arraySize, uint(rhiFormat), uint(flags) };
-
- return rt;
-}
-
-/*!
- \return a new QQuickRenderTarget referencing a Vulkan image object with
- \a arraySize layers specified by \a image. The current \a layout of the image
- must be provided as well.
-
- \note This implies multiview rendering (GL_OVR_multiview etc.), which can be
- relevant with VR/AR especially. \a arraySize is the number of views,
- typically \c 2. This overload should not be used other cases.
- See \l QSGMaterial::viewCount() for details on enabling multiview rendering
- within the Qt Quick scenegraph.
-
- Unlike fromVulkanImageMultiView(), this variant assumes that \a image is a
- non-multisample 2D texture array, whereas \a sampleCount defines the number
- of samples desired. The resulting QQuickRenderTarget will use an
- intermediate, automatically created multisample texture array as its color
- attachment, and will resolve the samples into \a image. This is the
- recommended approach to perform MSAA when the native Vulkan image is not
- already multisample.
-
- \a format specifies the VkFormat of the image. Only image formats that are
- supported by Qt's rendering infrastructure should be used.
-
- \a pixelSize specifies the size of the image, in pixels. Currently only 2D
- textures are supported.
-
- \a sampleCount specifies the number of samples used for multisample
- antialiasing. 0 or 1 means no multisampling, in which case this function is
- identical to fromVulkanImageMultiView().
-
- The image is used as the first color attachment of the render target used by
- the Qt Quick scenegraph. A depth-stencil texture array with a matching
- number of layers, sample count, and a format of \c D24S8 is created and used
- automatically.
-
- \note the resulting QQuickRenderTarget does not own any native resources, it
- merely contains references and the associated metadata of the size and
- sample count. It is the caller's responsibility to ensure that the native
- resource exists as long as necessary.
-
- \since 6.8
+ if (arraySize <= 1) {
+ d->type = QQuickRenderTargetPrivate::Type::NativeTexture;
+ d->u.nativeTexture = { quint64(image), layout, uint(rhiFormat), uint(formatFlags), uint(rhiViewFormat), uint(viewFormatFlags) };
+ } else {
+ d->type = QQuickRenderTargetPrivate::Type::NativeTextureArray;
+ d->u.nativeTextureArray = { quint64(image), layout, arraySize, uint(rhiFormat), uint(formatFlags), uint(rhiViewFormat), uint(viewFormatFlags) };
+ }
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl
- */
-QQuickRenderTarget QQuickRenderTarget::fromVulkanImageMultiViewWithMultiSampleResolve(VkImage image, VkImageLayout layout, VkFormat format,
- const QSize &pixelSize, int sampleCount, int arraySize)
-{
- QQuickRenderTarget rt = fromVulkanImageMultiView(image, layout, format, pixelSize, sampleCount, arraySize);
- QQuickRenderTargetPrivate::get(&rt)->multisampleResolve = sampleCount > 1;
return rt;
}
-/*!
- \overload
-
- \return a new QQuickRenderTarget referencing a Vulkan image object specified
- by \a image. The image is assumed to have a format of
- VK_FORMAT_R8G8B8A8_UNORM.
-
- \a pixelSize specifies the size of the image, in pixels. Currently only 2D
- textures are supported.
-
- \a 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.
-
- \note the resulting QQuickRenderTarget does not own any native resources,
- it merely contains references and the associated metadata of the size and
- sample count. It is the caller's responsibility to ensure that the native
- resource exists as long as necessary.
-
- \sa QQuickWindow::setRenderTarget(), QQuickRenderControl
-*/
-QQuickRenderTarget QQuickRenderTarget::fromVulkanImage(VkImage image, VkImageLayout layout, const QSize &pixelSize, int sampleCount)
-{
- return fromVulkanImage(image, layout, VK_FORMAT_UNDEFINED, pixelSize, sampleCount);
-}
-#endif
+#endif // Vulkan
/*!
\return a new QQuickRenderTarget referencing an existing \a renderTarget.
@@ -1418,7 +1135,9 @@ bool QQuickRenderTarget::isEqual(const QQuickRenderTarget &other) const noexcept
if (d->u.nativeTexture.object != other.d->u.nativeTexture.object
|| d->u.nativeTexture.layoutOrState != other.d->u.nativeTexture.layoutOrState
|| d->u.nativeTexture.rhiFormat != other.d->u.nativeTexture.rhiFormat
- || d->u.nativeTexture.rhiFlags != other.d->u.nativeTexture.rhiFlags)
+ || d->u.nativeTexture.rhiFormatFlags != other.d->u.nativeTexture.rhiFormatFlags
+ || d->u.nativeTexture.rhiViewFormat != other.d->u.nativeTexture.rhiViewFormat
+ || d->u.nativeTexture.rhiViewFormatFlags != other.d->u.nativeTexture.rhiViewFormatFlags)
return false;
break;
case QQuickRenderTargetPrivate::Type::NativeTextureArray:
@@ -1426,7 +1145,9 @@ bool QQuickRenderTarget::isEqual(const QQuickRenderTarget &other) const noexcept
|| d->u.nativeTextureArray.layoutOrState != other.d->u.nativeTextureArray.layoutOrState
|| d->u.nativeTextureArray.arraySize != other.d->u.nativeTextureArray.arraySize
|| d->u.nativeTextureArray.rhiFormat != other.d->u.nativeTextureArray.rhiFormat
- || d->u.nativeTextureArray.rhiFlags != other.d->u.nativeTextureArray.rhiFlags)
+ || d->u.nativeTextureArray.rhiFormatFlags != other.d->u.nativeTextureArray.rhiFormatFlags
+ || d->u.nativeTextureArray.rhiViewFormat != other.d->u.nativeTextureArray.rhiViewFormat
+ || d->u.nativeTextureArray.rhiViewFormatFlags != other.d->u.nativeTextureArray.rhiViewFormatFlags)
return false;
break;
case QQuickRenderTargetPrivate::Type::NativeRenderbuffer:
@@ -1520,14 +1241,15 @@ static bool createRhiRenderTarget(QRhiTexture *texture,
std::unique_ptr<QRhiTexture> colorBuffer;
QRhiTexture::Flags multisampleTextureFlags;
+ QRhiTexture::Format multisampleTextureFormat = texture->format();
if (multisampleResolve) {
multisampleTextureFlags = QRhiTexture::RenderTarget;
- // Pass in texture->format() as a hint, to not be tied to rgba8. Also keep the srgb flag.
if (texture->flags().testFlag(QRhiTexture::sRGB))
multisampleTextureFlags |= QRhiTexture::sRGB;
if (dst->implicitBuffers.multisampleTexture) {
if (dst->implicitBuffers.multisampleTexture->pixelSize() == pixelSize
+ && dst->implicitBuffers.multisampleTexture->format() == multisampleTextureFormat
&& dst->implicitBuffers.multisampleTexture->sampleCount() == sampleCount
&& dst->implicitBuffers.multisampleTexture->flags().testFlags(multisampleTextureFlags))
{
@@ -1549,8 +1271,9 @@ static bool createRhiRenderTarget(QRhiTexture *texture,
}
if (multisampleResolve && !colorBuffer) {
- colorBuffer.reset(rhi->newTexture(texture->format(), pixelSize, sampleCount, multisampleTextureFlags));
+ colorBuffer.reset(rhi->newTexture(multisampleTextureFormat, pixelSize, sampleCount, multisampleTextureFlags));
colorBuffer->setName(QByteArrayLiteral("Multisample color buffer for QQuickRenderTarget"));
+ colorBuffer->setWriteViewFormat(texture->writeViewFormat());
if (!colorBuffer->create()) {
qWarning("Failed to build multisample color buffer for QQuickRenderTarget");
return false;
@@ -1611,6 +1334,7 @@ static bool createRhiRenderTargetMultiView(QRhiTexture *texture,
std::unique_ptr<QRhiTexture> colorBuffer;
QRhiTexture::Flags multisampleTextureFlags;
+ QRhiTexture::Format multisampleTextureFormat = texture->format();
if (multisampleResolve) {
multisampleTextureFlags = QRhiTexture::RenderTarget;
if (texture->flags().testFlag(QRhiTexture::sRGB))
@@ -1618,6 +1342,7 @@ static bool createRhiRenderTargetMultiView(QRhiTexture *texture,
if (dst->implicitBuffers.multisampleTexture) {
if (dst->implicitBuffers.multisampleTexture->pixelSize() == pixelSize
+ && dst->implicitBuffers.multisampleTexture->format() == multisampleTextureFormat
&& dst->implicitBuffers.multisampleTexture->sampleCount() == sampleCount
&& dst->implicitBuffers.multisampleTexture->arraySize() == arraySize
&& dst->implicitBuffers.multisampleTexture->flags().testFlags(multisampleTextureFlags))
@@ -1640,8 +1365,9 @@ static bool createRhiRenderTargetMultiView(QRhiTexture *texture,
}
if (multisampleResolve && !colorBuffer) {
- colorBuffer.reset(rhi->newTextureArray(texture->format(), arraySize, pixelSize, sampleCount, multisampleTextureFlags));
+ colorBuffer.reset(rhi->newTextureArray(multisampleTextureFormat, arraySize, pixelSize, sampleCount, multisampleTextureFlags));
colorBuffer->setName(QByteArrayLiteral("Multisample color buffer (multiview) for QQuickRenderTarget"));
+ colorBuffer->setWriteViewFormat(texture->writeViewFormat());
if (!colorBuffer->create()) {
qWarning("Failed to build multisample texture array for QQuickRenderTarget");
return false;
@@ -1694,10 +1420,16 @@ bool QQuickRenderTargetPrivate::resolve(QRhi *rhi, QQuickWindowRenderTarget *dst
case Type::NativeTexture:
{
- const auto format = u.nativeTexture.rhiFormat == QRhiTexture::UnknownFormat ? QRhiTexture::RGBA8
- : QRhiTexture::Format(u.nativeTexture.rhiFormat);
- const auto flags = QRhiTexture::RenderTarget | QRhiTexture::Flags(u.nativeTexture.rhiFlags);
+ QRhiTexture::Format format = u.nativeTexture.rhiFormat == QRhiTexture::UnknownFormat ? QRhiTexture::RGBA8
+ : QRhiTexture::Format(u.nativeTexture.rhiFormat);
+ QRhiTexture::Format viewFormat = u.nativeTexture.rhiViewFormat == QRhiTexture::UnknownFormat ? QRhiTexture::RGBA8
+ : QRhiTexture::Format(u.nativeTexture.rhiViewFormat);
+ const auto flags = QRhiTexture::RenderTarget | QRhiTexture::Flags(u.nativeTexture.rhiFormatFlags);
std::unique_ptr<QRhiTexture> texture(rhi->newTexture(format, pixelSize, multisampleResolve ? 1 : sampleCount, flags));
+ const bool textureIsSrgb = flags.testFlag(QRhiTexture::sRGB);
+ const bool viewIsSrgb = QRhiTexture::Flags(u.nativeTexture.rhiViewFormatFlags).testFlag(QRhiTexture::sRGB);
+ if (viewFormat != format || viewIsSrgb != textureIsSrgb)
+ texture->setWriteViewFormat({ viewFormat, viewIsSrgb });
if (!texture->createFrom({ u.nativeTexture.object, u.nativeTexture.layoutOrState })) {
qWarning("Failed to build wrapper texture for QQuickRenderTarget");
return false;
@@ -1710,11 +1442,17 @@ bool QQuickRenderTargetPrivate::resolve(QRhi *rhi, QQuickWindowRenderTarget *dst
case Type::NativeTextureArray:
{
- const auto format = u.nativeTextureArray.rhiFormat == QRhiTexture::UnknownFormat ? QRhiTexture::RGBA8
- : QRhiTexture::Format(u.nativeTextureArray.rhiFormat);
- const auto flags = QRhiTexture::RenderTarget | QRhiTexture::Flags(u.nativeTextureArray.rhiFlags);
+ QRhiTexture::Format format = u.nativeTextureArray.rhiFormat == QRhiTexture::UnknownFormat ? QRhiTexture::RGBA8
+ : QRhiTexture::Format(u.nativeTextureArray.rhiFormat);
+ QRhiTexture::Format viewFormat = u.nativeTextureArray.rhiViewFormat == QRhiTexture::UnknownFormat ? QRhiTexture::RGBA8
+ : QRhiTexture::Format(u.nativeTextureArray.rhiViewFormat);
+ const auto flags = QRhiTexture::RenderTarget | QRhiTexture::Flags(u.nativeTextureArray.rhiFormatFlags);
const int arraySize = u.nativeTextureArray.arraySize;
std::unique_ptr<QRhiTexture> texture(rhi->newTextureArray(format, arraySize, pixelSize, multisampleResolve ? 1 : sampleCount, flags));
+ const bool textureIsSrgb = flags.testFlag(QRhiTexture::sRGB);
+ const bool viewIsSrgb = QRhiTexture::Flags(u.nativeTextureArray.rhiViewFormatFlags).testFlag(QRhiTexture::sRGB);
+ if (viewFormat != format || viewIsSrgb != textureIsSrgb)
+ texture->setWriteViewFormat({ viewFormat, viewIsSrgb });
if (!texture->createFrom({ u.nativeTextureArray.object, u.nativeTextureArray.layoutOrState })) {
qWarning("Failed to build wrapper texture array for QQuickRenderTarget");
return false;
diff --git a/src/quick/items/qquickrendertarget.h b/src/quick/items/qquickrendertarget.h
index 98af8daea8..f604b91412 100644
--- a/src/quick/items/qquickrendertarget.h
+++ b/src/quick/items/qquickrendertarget.h
@@ -24,6 +24,11 @@ class QPaintDevice;
class Q_QUICK_EXPORT QQuickRenderTarget
{
public:
+ enum class Flag {
+ MultisampleResolve = 0x01
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
QQuickRenderTarget();
~QQuickRenderTarget();
QQuickRenderTarget(const QQuickRenderTarget &other);
@@ -38,38 +43,32 @@ public:
void setMirrorVertically(bool enable);
#if QT_CONFIG(opengl) || defined(Q_QDOC)
- static QQuickRenderTarget fromOpenGLTexture(uint textureId, uint format, const QSize &pixelSize, int sampleCount = 1);
static QQuickRenderTarget fromOpenGLTexture(uint textureId, const QSize &pixelSize, int sampleCount = 1);
- static QQuickRenderTarget fromOpenGLTextureWithMultiSampleResolve(uint textureId, uint format, const QSize &pixelSize, int sampleCount);
- static QQuickRenderTarget fromOpenGLTextureMultiView(uint textureId, uint format, const QSize &pixelSize, int sampleCount, int arraySize);
- static QQuickRenderTarget fromOpenGLTextureMultiViewWithMultiSampleResolve(uint textureId, uint format, const QSize &pixelSize, int sampleCount, int arraySize);
+ static QQuickRenderTarget fromOpenGLTexture(uint textureId, uint format, const QSize &pixelSize, int sampleCount = 1);
+ static QQuickRenderTarget fromOpenGLTexture(uint textureId, uint format, const QSize &pixelSize, int sampleCount, int arraySize, Flags flags);
+
static QQuickRenderTarget fromOpenGLRenderBuffer(uint renderbufferId, const QSize &pixelSize, int sampleCount = 1);
#endif
#if defined(Q_OS_WIN) || defined(Q_QDOC)
- static QQuickRenderTarget fromD3D11Texture(void *texture, uint format, const QSize &pixelSize, int sampleCount = 1);
static QQuickRenderTarget fromD3D11Texture(void *texture, const QSize &pixelSize, int sampleCount = 1);
- static QQuickRenderTarget fromD3D11TextureWithMultiSampleResolve(void *texture, uint format, const QSize &pixelSize, int sampleCount);
+ static QQuickRenderTarget fromD3D11Texture(void *texture, uint format, const QSize &pixelSize, int sampleCount = 1);
+ static QQuickRenderTarget fromD3D11Texture(void *texture, uint format, const QSize &pixelSize, int sampleCount, Flags flags);
+
static QQuickRenderTarget fromD3D12Texture(void *texture, int resourceState, uint format, const QSize &pixelSize, int sampleCount = 1);
- static QQuickRenderTarget fromD3D12TextureWithMultiSampleResolve(void *texture, int resourceState, uint format, const QSize &pixelSize, int sampleCount);
- static QQuickRenderTarget fromD3D12TextureMultiView(void *texture, int resourceState, uint format, const QSize &pixelSize, int sampleCount, int arraySize);
- static QQuickRenderTarget fromD3D12TextureMultiViewWithMultiSampleResolve(void *texture, int resourceState, uint format, const QSize &pixelSize, int sampleCount, int arraySize);
+ static QQuickRenderTarget fromD3D12Texture(void *texture, int resourceState, uint format, uint viewFormat, const QSize &pixelSize, int sampleCount, int arraySize, Flags flags);
#endif
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS) || defined(Q_QDOC)
- static QQuickRenderTarget fromMetalTexture(MTLTexture *texture, uint format, const QSize &pixelSize, int sampleCount = 1);
static QQuickRenderTarget fromMetalTexture(MTLTexture *texture, const QSize &pixelSize, int sampleCount = 1);
- static QQuickRenderTarget fromMetalTextureWithMultiSampleResolve(MTLTexture *texture, uint format, const QSize &pixelSize, int sampleCount);
- static QQuickRenderTarget fromMetalTextureMultiView(MTLTexture *texture, uint format, const QSize &pixelSize, int sampleCount, int arraySize);
- static QQuickRenderTarget fromMetalTextureMultiViewWithMultiSampleResolve(MTLTexture *texture, uint format, const QSize &pixelSize, int sampleCount, int arraySize);
+ static QQuickRenderTarget fromMetalTexture(MTLTexture *texture, uint format, const QSize &pixelSize, int sampleCount = 1);
+ static QQuickRenderTarget fromMetalTexture(MTLTexture *texture, uint format, uint viewFormat, const QSize &pixelSize, int sampleCount, int arraySize, Flags flags);
#endif
#if QT_CONFIG(vulkan) || defined(Q_QDOC)
- static QQuickRenderTarget fromVulkanImage(VkImage image, VkImageLayout layout, VkFormat format, const QSize &pixelSize, int sampleCount = 1);
static QQuickRenderTarget fromVulkanImage(VkImage image, VkImageLayout layout, const QSize &pixelSize, int sampleCount = 1);
- static QQuickRenderTarget fromVulkanImageWithMultiSampleResolve(VkImage image, VkImageLayout layout, VkFormat format, const QSize &pixelSize, int sampleCount);
- static QQuickRenderTarget fromVulkanImageMultiView(VkImage image, VkImageLayout layout, VkFormat format, const QSize &pixelSize, int sampleCount, int arraySize);
- static QQuickRenderTarget fromVulkanImageMultiViewWithMultiSampleResolve(VkImage image, VkImageLayout layout, VkFormat format, const QSize &pixelSize, int sampleCount, int arraySize);
+ static QQuickRenderTarget fromVulkanImage(VkImage image, VkImageLayout layout, VkFormat format, const QSize &pixelSize, int sampleCount = 1);
+ static QQuickRenderTarget fromVulkanImage(VkImage image, VkImageLayout layout, VkFormat format, VkFormat viewFormat, const QSize &pixelSize, int sampleCount, int arraySize, Flags flags);
#endif
static QQuickRenderTarget fromRhiRenderTarget(QRhiRenderTarget *renderTarget);
@@ -88,6 +87,8 @@ private:
{ return !lhs.isEqual(rhs); }
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickRenderTarget::Flags)
+
QT_END_NAMESPACE
#endif // QQUICKRENDERTARGET_H
diff --git a/src/quick/items/qquickrendertarget_p.h b/src/quick/items/qquickrendertarget_p.h
index bfedd57d56..6d087c2e71 100644
--- a/src/quick/items/qquickrendertarget_p.h
+++ b/src/quick/items/qquickrendertarget_p.h
@@ -51,14 +51,18 @@ public:
quint64 object;
int layoutOrState;
uint rhiFormat;
- uint rhiFlags;
+ uint rhiFormatFlags;
+ uint rhiViewFormat;
+ uint rhiViewFormatFlags;
};
struct NativeTextureArray {
quint64 object;
int layoutOrState;
int arraySize;
uint rhiFormat;
- uint rhiFlags;
+ uint rhiFormatFlags;
+ uint rhiViewFormat;
+ uint rhiViewFormatFlags;
};
union {
NativeTexture nativeTexture;