summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhi.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-04-28 18:15:03 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-04-29 22:36:00 +0200
commit1c0a7a87e9e8dd630d35b2c3e57d45c42f6d12bd (patch)
tree6bba3482a817ecf5dcd732de633131e0b0a9416e /src/gui/rhi/qrhi.cpp
parentf2347077f503d103974636cae9319d127714e2e4 (diff)
rhi: Add backing format hint to QRhiRenderBuffer
Task-number: QTBUG-83707 Change-Id: I63548f4ace70af614a2aa082663bb3ae9fbedc25 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhi.cpp')
-rw-r--r--src/gui/rhi/qrhi.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp
index 1eb26985bf..6a118d20c8 100644
--- a/src/gui/rhi/qrhi.cpp
+++ b/src/gui/rhi/qrhi.cpp
@@ -2123,9 +2123,11 @@ QRhiBuffer::NativeBuffer QRhiBuffer::nativeBuffer()
\internal
*/
QRhiRenderBuffer::QRhiRenderBuffer(QRhiImplementation *rhi, Type type_, const QSize &pixelSize_,
- int sampleCount_, Flags flags_)
+ int sampleCount_, Flags flags_,
+ QRhiTexture::Format backingFormatHint_)
: QRhiResource(rhi),
- m_type(type_), m_pixelSize(pixelSize_), m_sampleCount(sampleCount_), m_flags(flags_)
+ m_type(type_), m_pixelSize(pixelSize_), m_sampleCount(sampleCount_), m_flags(flags_),
+ m_backingFormatHint(backingFormatHint_)
{
}
@@ -5488,14 +5490,29 @@ QRhiBuffer *QRhi::newBuffer(QRhiBuffer::Type type,
\return a new renderbuffer with the specified \a type, \a pixelSize, \a
sampleCount, and \a flags.
+ When \a backingFormatHint is set to a texture format other than
+ QRhiTexture::UnknownFormat, it may be used by the backend to decide what
+ format to use for the storage backing the renderbuffer.
+
+ \note \a backingFormatHint becomes relevant typically when multisampling
+ and floating point texture formats are involved: rendering into a
+ multisample QRhiRenderBuffer and then resolving into a non-RGBA8
+ QRhiTexture implies (with some graphics APIs) that the storage backing the
+ QRhiRenderBuffer uses the matching non-RGBA8 format. That means that
+ passing a format like QRhiTexture::RGBA32F is important, because backends
+ will typically opt for QRhiTexture::RGBA8 by default, which would then
+ break later on due to attempting to set up RGBA8->RGBA32F multisample
+ resolve in the color attachment(s) of the QRhiTextureRenderTarget.
+
\sa QRhiResource::release()
*/
QRhiRenderBuffer *QRhi::newRenderBuffer(QRhiRenderBuffer::Type type,
const QSize &pixelSize,
int sampleCount,
- QRhiRenderBuffer::Flags flags)
+ QRhiRenderBuffer::Flags flags,
+ QRhiTexture::Format backingFormatHint)
{
- return d->createRenderBuffer(type, pixelSize, sampleCount, flags);
+ return d->createRenderBuffer(type, pixelSize, sampleCount, flags, backingFormatHint);
}
/*!