diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/rhi/qrhi.cpp | 12 | ||||
-rw-r--r-- | src/gui/rhi/qrhid3d11.cpp | 3 | ||||
-rw-r--r-- | src/gui/rhi/qrhigles2.cpp | 3 | ||||
-rw-r--r-- | src/gui/rhi/qrhimetal.mm | 3 | ||||
-rw-r--r-- | src/gui/rhi/qrhinull.cpp | 3 | ||||
-rw-r--r-- | src/gui/rhi/qrhivulkan.cpp | 3 |
6 files changed, 27 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index 452a39642f..8196d107fe 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -2929,6 +2929,18 @@ QRhiResource::Type QRhiRenderTarget::resourceType() const \fn QSize QRhiRenderTarget::pixelSize() const \return the size in pixels. + + Valid only after create() has been called successfully. Until then the + result is a default-constructed QSize. + + With QRhiTextureRenderTarget the returned size is the size of the + associated attachments at the time of create(), in practice the size of the + first color attachment, or the depth/stencil buffer if there are no color + attachments. If the associated textures or renderbuffers are resized and + rebuilt afterwards, then pixelSize() performs an implicit call to create() + in order to rebuild the underlying data structures. This implicit check is + similar to what QRhiCommandBuffer::beginPass() does, and ensures that the + returned size is always up-to-date. */ /*! diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index d029cd2fbf..fc6fd59f4f 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -3631,6 +3631,9 @@ bool QD3D11TextureRenderTarget::create() QSize QD3D11TextureRenderTarget::pixelSize() const { + if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QD3D11Texture, QD3D11RenderBuffer>(m_desc, d.currentResIdList)) + const_cast<QD3D11TextureRenderTarget *>(this)->create(); + return d.pixelSize; } diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 0c2225f194..21dd8da229 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -5317,6 +5317,9 @@ bool QGles2TextureRenderTarget::create() QSize QGles2TextureRenderTarget::pixelSize() const { + if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QGles2Texture, QGles2RenderBuffer>(m_desc, d.currentResIdList)) + const_cast<QGles2TextureRenderTarget *>(this)->create(); + return d.pixelSize; } diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index dd79c77dc9..4198306ffc 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -3183,6 +3183,9 @@ bool QMetalTextureRenderTarget::create() QSize QMetalTextureRenderTarget::pixelSize() const { + if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QMetalTexture, QMetalRenderBuffer>(m_desc, d->currentResIdList)) + const_cast<QMetalTextureRenderTarget *>(this)->create(); + return d->pixelSize; } diff --git a/src/gui/rhi/qrhinull.cpp b/src/gui/rhi/qrhinull.cpp index 9544878350..2790b19ebc 100644 --- a/src/gui/rhi/qrhinull.cpp +++ b/src/gui/rhi/qrhinull.cpp @@ -860,6 +860,9 @@ bool QNullTextureRenderTarget::create() QSize QNullTextureRenderTarget::pixelSize() const { + if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QNullTexture, QNullRenderBuffer>(m_desc, d.currentResIdList)) + const_cast<QNullTextureRenderTarget *>(this)->create(); + return d.pixelSize; } diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 025419d045..c27b55f885 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -6637,6 +6637,9 @@ bool QVkTextureRenderTarget::create() QSize QVkTextureRenderTarget::pixelSize() const { + if (!QRhiRenderTargetAttachmentTracker::isUpToDate<QVkTexture, QVkRenderBuffer>(m_desc, d.currentResIdList)) + const_cast<QVkTextureRenderTarget *>(this)->create(); + return d.pixelSize; } |