summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-05-27 17:44:49 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-05-28 17:53:32 +0200
commit56977990e04efa051b1ebd4ce9274d6b69c7bd0c (patch)
treeeaa66635b67faaf94df7b0670fa9e0971268a936 /src/gui
parentc991d87ee2c239fedb77f76f25936dddf5eb5982 (diff)
rhi: Harmonize create-destroy API pattern with the rest of Qt
For historical reasons we use build and release instead of create and destroy. This becomes confusing now that more modules in Qt start taking QRhi into use. Migrate to the more familiar naming, so those who have used QWindow or QOpenGLContext before will find it natural. Change-Id: I05eb2243ce274c59b03a5f8bcbb2792a4f37120f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/rhi/qrhi.cpp235
-rw-r--r--src/gui/rhi/qrhi_p.h25
-rw-r--r--src/gui/rhi/qrhi_p_p.h6
-rw-r--r--src/gui/rhi/qrhid3d11.cpp102
-rw-r--r--src/gui/rhi/qrhid3d11_p_p.h48
-rw-r--r--src/gui/rhi/qrhigles2.cpp90
-rw-r--r--src/gui/rhi/qrhigles2_p_p.h46
-rw-r--r--src/gui/rhi/qrhimetal.mm112
-rw-r--r--src/gui/rhi/qrhimetal_p_p.h46
-rw-r--r--src/gui/rhi/qrhinull.cpp68
-rw-r--r--src/gui/rhi/qrhinull_p_p.h44
-rw-r--r--src/gui/rhi/qrhivulkan.cpp112
-rw-r--r--src/gui/rhi/qrhivulkan_p_p.h48
13 files changed, 492 insertions, 490 deletions
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp
index 9fc2f68b11..f7ecacf456 100644
--- a/src/gui/rhi/qrhi.cpp
+++ b/src/gui/rhi/qrhi.cpp
@@ -141,45 +141,45 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
\badcode
vbuf = rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertexData));
- if (!vbuf->build()) { error }
+ if (!vbuf->create()) { error }
...
delete vbuf;
\endcode
\list
- \li The returned value from both create() and functions like newBuffer() is
- owned by the caller.
+ \li The returned value from functions like newBuffer() is always owned by
+ the caller.
\li Just creating a QRhiResource subclass never allocates or initializes any
- native resources. That is only done when calling the \c build function of a
- subclass, for example, QRhiBuffer::build() or QRhiTexture::build().
+ native resources. That is only done when calling the \c create() function of a
+ subclass, for example, QRhiBuffer::create() or QRhiTexture::create().
\li The exception is
QRhiTextureRenderTarget::newCompatibleRenderPassDescriptor() and
- QRhiSwapChain::newCompatibleRenderPassDescriptor(). There is no \c build
+ QRhiSwapChain::newCompatibleRenderPassDescriptor(). There is no \c create()
operation for these and the returned object is immediately active.
\li The resource objects themselves are treated as immutable: once a
- resource is built, changing any parameters via the setters, such as,
+ resource has create() called, changing any parameters via the setters, such as,
QRhiTexture::setPixelSize(), has no effect, unless the underlying native
- resource is released and \c build is called again. See more about resource
+ resource is released and \c create() is called again. See more about resource
reuse in the sections below.
\li The underlying native resources are scheduled for releasing by the
- QRhiResource destructor, or by calling QRhiResource::release(). Backends
+ QRhiResource destructor, or by calling QRhiResource::destroy(). Backends
often queue release requests and defer executing them to an unspecified
time, this is hidden from the applications. This way applications do not
have to worry about releasing native resources that may still be in use by
an in-flight frame.
\li Note that this does not mean that a QRhiResource can freely be
- destroyed or release()'d within a frame (that is, in a
+ destroy()'ed or deleted within a frame (that is, in a
\l{QRhiCommandBuffer::beginFrame()}{beginFrame()} -
\l{QRhiCommandBuffer::endFrame()}{endFrame()} section). As a general rule,
all referenced QRhiResource objects must stay unchanged until the frame is
submitted by calling \l{QRhiCommandBuffer::endFrame()}{endFrame()}. To ease
- this, QRhiResource::releaseAndDestroyLater() is provided as a convenience.
+ this, QRhiResource::deleteLater() is provided as a convenience.
\endlist
@@ -201,9 +201,9 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
relative to a draw call.
Furthermore, instances of QRhiResource subclasses must be treated immutable
- within a frame in which they are referenced in any way. Create or rebuild
+ within a frame in which they are referenced in any way. Create
all resources upfront, before starting to record commands for the next
- frame. Reusing a QRhiResource instance within a frame (by rebuilding it and
+ frame. Reusing a QRhiResource instance within a frame (by calling \c create()
then referencing it again in the same \c{beginFrame - endFrame} section)
should be avoided as it may lead to unexpected results, depending on the
backend.
@@ -211,14 +211,14 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
As a general rule, all referenced QRhiResource objects must stay valid and
unmodified until the frame is submitted by calling
\l{QRhiCommandBuffer::endFrame()}{endFrame()}. On the other hand, calling
- \l{QRhiResource::release()}{release()} or destroying the QRhiResource are
+ \l{QRhiResource::destroy()}{destroy()} or deleting the QRhiResource are
always safe once the frame is submitted, regardless of the status of the
underlying native resources (which may still be in use by the GPU - but
that is taken care of internally).
Unlike APIs like OpenGL, upload and copy type of commands cannot be mixed
with draw commands. The typical renderer will involve a sequence similar to
- the following: \c{(re)build resources} - \c{begin frame} - \c{record
+ the following: \c{(re)create resources} - \c{begin frame} - \c{record
uploads and copies} - \c{start renderpass} - \c{record draw calls} - \c{end
renderpass} - \c{end frame}. Recording copy type of operations happens via
QRhiResourceUpdateBatch. Such operations are committed typically on
@@ -292,8 +292,8 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
\section3 Resource reuse
From the user's point of view a QRhiResource is reusable immediately after
- calling QRhiResource::release(). With the exception of swapchains, calling
- \c build() on an already built object does an implicit \c release(). This
+ calling QRhiResource::destroy(). With the exception of swapchains, calling
+ \c create() on an already created object does an implicit \c destroy(). This
provides a handy shortcut to reuse a QRhiResource instance with different
parameters, with a new native graphics object underneath.
@@ -304,26 +304,26 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
needs changing, destroying and creating a whole new QRhiBuffer or
QRhiSampler would invalidate all references to the old instance. By just
changing the appropriate parameters via QRhiBuffer::setSize() or similar
- and then calling QRhiBuffer::build(), everything works as expected and
+ and then calling QRhiBuffer::create(), everything works as expected and
there is no need to touch the QRhiShaderResourceBindings at all, even
though there is a good chance that under the hood the QRhiBuffer is now
backed by a whole new native buffer.
\badcode
ubuf = rhi->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, 256);
- ubuf->build();
+ ubuf->create();
srb = rhi->newShaderResourceBindings()
srb->setBindings({
QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, ubuf)
});
- srb->build();
+ srb->create();
...
// now in a later frame we need to grow the buffer to a larger size
ubuf->setSize(512);
- ubuf->build(); // same as ubuf->release(); ubuf->build();
+ ubuf->create(); // same as ubuf->destroy(); ubuf->create();
// that's it, srb needs no changes whatsoever
\endcode
@@ -338,7 +338,7 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
QRhiCommandBuffer::beginPass() or QRhiCommandBuffer::endPass(). These
functions take care of returning the batch to the pool. Alternatively, a
batch can be "canceled" and returned to the pool without processing by
- calling QRhiResourceUpdateBatch::release().
+ calling QRhiResourceUpdateBatch::destroy().
A typical pattern is thus:
@@ -362,15 +362,15 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
\list
- \li It has no \c build but rather a QRhiSwapChain::buildOrResize().
+ \li It has no \c create() but rather a QRhiSwapChain::createOrResize().
Repeatedly calling this function is \b not the same as calling
- QRhiSwapChain::release() followed by QRhiSwapChain::buildOrResize(). This
+ QRhiSwapChain::destroy() followed by QRhiSwapChain::createOrResize(). This
is because swapchains often have ways to handle the case where buffers need
to be resized in a manner that is more efficient than a brute force
destroying and recreating from scratch.
\li An active QRhiSwapChain must be released by calling
- \l{QRhiSwapChain::release()}{release()}, or by destroying the object, before
+ \l{QRhiSwapChain::destroy()}{destroy()}, or by destroying the object, before
the QWindow's underlying QPlatformWindow, and so the associated native
window object, is destroyed. It should not be postponed because releasing
the swapchain may become problematic (and with some APIs, like Vulkan, is
@@ -585,7 +585,7 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
\value RenderToNonBaseMipLevel Indicates that specifying a mip level other
than 0 is supported when creating a QRhiTextureRenderTarget with a
- QRhiTexture as its color attachment. When not supported, build() will fail
+ QRhiTexture as its color attachment. When not supported, create() will fail
whenever the target mip level is not zero. In practice this feature will be
unsupported with OpenGL ES 2.0, while it will likely be supported everywhere
else.
@@ -1807,23 +1807,23 @@ QRhiResource::QRhiResource(QRhiImplementation *rhi)
\note Resources referenced by commands for the current frame should not be
released until the frame is submitted by QRhi::endFrame().
- \sa release()
+ \sa destroy()
*/
QRhiResource::~QRhiResource()
{
- // release() cannot be called here, it being virtual; it is up to the
+ // destroy() cannot be called here, due to virtuals; it is up to the
// subclasses to do that.
}
/*!
- \fn void QRhiResource::release()
+ \fn void QRhiResource::destroy()
Releases (or requests deferred releasing of) the underlying native graphics
resources. Safe to call multiple times, subsequent invocations will be a
no-op then.
- Once release() is called, the QRhiResource instance can be reused, by
- calling \c build() again. That will then result in creating new native
+ Once destroy() is called, the QRhiResource instance can be reused, by
+ calling \c create() again. That will then result in creating new native
graphics resources underneath.
\note Resources referenced by commands for the current frame should not be
@@ -1832,7 +1832,7 @@ QRhiResource::~QRhiResource()
The QRhiResource destructor also performs the same task, so calling this
function is not necessary before destroying a QRhiResource.
- \sa releaseAndDestroyLater()
+ \sa deleteLater()
*/
/*!
@@ -1843,11 +1843,11 @@ QRhiResource::~QRhiResource()
requirement of not altering QRhiResource objects that are referenced by the
frame being recorded.
- \sa release()
+ \sa destroy()
*/
-void QRhiResource::releaseAndDestroyLater()
+void QRhiResource::deleteLater()
{
- m_rhi->addReleaseAndDestroyLater(this);
+ m_rhi->addDeleteLater(this);
}
/*!
@@ -1962,7 +1962,7 @@ quint64 QRhiResource::globalResourceId() const
Sets the size of the buffer in bytes. The size is normally specified in
QRhi::newBuffer() so this function is only used when the size has to be
changed. As with other setters, the size only takes effect when calling
- build(), and for already built buffers this involves releasing the previous
+ create(), and for already created buffers this involves releasing the previous
native resource and creating new ones under the hood.
Backends may choose to allocate buffers bigger than \a sz in order to
@@ -2022,14 +2022,14 @@ QRhiResource::Type QRhiBuffer::resourceType() const
}
/*!
- \fn bool QRhiBuffer::build()
+ \fn bool QRhiBuffer::create()
Creates the corresponding native graphics resources. If there are already
- resources present due to an earlier build() with no corresponding
- release(), then release() is called implicitly first.
+ resources present due to an earlier create() with no corresponding
+ destroy(), then destroy() is called implicitly first.
\return \c true when successful, \c false when a graphics operation failed.
- Regardless of the return value, calling release() is always safe.
+ Regardless of the return value, calling destroy() is always safe.
*/
/*!
@@ -2095,7 +2095,7 @@ QRhiBuffer::NativeBuffer QRhiBuffer::nativeBuffer()
UsedWithSwapChainOnly flag set. This serves a double purpose: such buffers,
depending on the backend and the underlying APIs, be more efficient, and
QRhi provides automatic sizing behavior to match the color buffers, which
- means calling setPixelSize() and build() are not necessary for such
+ means calling setPixelSize() and create() are not necessary for such
renderbuffers.
*/
@@ -2114,7 +2114,7 @@ QRhiBuffer::NativeBuffer QRhiBuffer::nativeBuffer()
\value UsedWithSwapChainOnly For DepthStencil renderbuffers this indicates
that the renderbuffer is only used in combination with a QRhiSwapChain, and
never in any other way. This provides automatic sizing and resource
- rebuilding, so calling setPixelSize() or build() is not needed whenever
+ rebuilding, so calling setPixelSize() or create() is not needed whenever
this flag is set. This flag value may also trigger backend-specific
behavior, for example with OpenGL, where a separate windowing system
interface API is in use (EGL, GLX, etc.), the flag is especially important
@@ -2144,14 +2144,14 @@ QRhiResource::Type QRhiRenderBuffer::resourceType() const
}
/*!
- \fn bool QRhiRenderBuffer::build()
+ \fn bool QRhiRenderBuffer::create()
Creates the corresponding native graphics resources. If there are already
- resources present due to an earlier build() with no corresponding
- release(), then release() is called implicitly first.
+ resources present due to an earlier create() with no corresponding
+ destroy(), then destroy() is called implicitly first.
\return \c true when successful, \c false when a graphics operation failed.
- Regardless of the return value, calling release() is always safe.
+ Regardless of the return value, calling destroy() is always safe.
*/
/*!
@@ -2171,7 +2171,7 @@ QRhiResource::Type QRhiRenderBuffer::resourceType() const
\enum QRhiTexture::Flag
Flag values to specify how the texture is going to be used. Not honoring
- the flags set before build() and attempting to use the texture in ways that
+ the flags set before create() and attempting to use the texture in ways that
was not declared upfront can lead to unspecified behavior or decreased
performance depending on the backend and the underlying graphics API.
@@ -2304,14 +2304,14 @@ QRhiResource::Type QRhiTexture::resourceType() const
}
/*!
- \fn bool QRhiTexture::build()
+ \fn bool QRhiTexture::create()
Creates the corresponding native graphics resources. If there are already
- resources present due to an earlier build() with no corresponding
- release(), then release() is called implicitly first.
+ resources present due to an earlier create() with no corresponding
+ destroy(), then destroy() is called implicitly first.
\return \c true when successful, \c false when a graphics operation failed.
- Regardless of the return value, calling release() is always safe.
+ Regardless of the return value, calling destroy() is always safe.
*/
/*!
@@ -2319,7 +2319,7 @@ QRhiResource::Type QRhiTexture::resourceType() const
will be empty if exposing the underlying native resources is not supported by
the backend.
- \sa buildFrom()
+ \sa createFrom()
*/
QRhiTexture::NativeTexture QRhiTexture::nativeTexture()
{
@@ -2327,7 +2327,7 @@ QRhiTexture::NativeTexture QRhiTexture::nativeTexture()
}
/*!
- Similar to build() except that no new native textures are created. Instead,
+ Similar to create() except that no new native textures are created. Instead,
the native texture resources specified by \a src is used.
This allows importing an existing native texture object (which must belong
@@ -2336,18 +2336,18 @@ QRhiTexture::NativeTexture QRhiTexture::nativeTexture()
\note format(), pixelSize(), sampleCount(), and flags() must still be set
correctly. Passing incorrect sizes and other values to QRhi::newTexture()
- and then following it with a buildFrom() expecting that the native texture
+ and then following it with a createFrom() expecting that the native texture
object alone is sufficient to deduce such values is \b wrong and will lead
to problems.
- \note QRhiTexture does not take ownership of the texture object. release()
+ \note QRhiTexture does not take ownership of the texture object. destroy()
does not free the object or any associated memory.
The opposite of this operation, exposing a QRhiTexture-created native
texture object to a foreign engine, is possible via nativeTexture().
*/
-bool QRhiTexture::buildFrom(QRhiTexture::NativeTexture src)
+bool QRhiTexture::createFrom(QRhiTexture::NativeTexture src)
{
Q_UNUSED(src);
return false;
@@ -2550,11 +2550,11 @@ QRhiResource::Type QRhiRenderTarget::resourceType() const
\badcode
texture = rhi->newTexture(QRhiTexture::RGBA8, size, 1, QRhiTexture::RenderTarget);
- texture->build();
+ texture->create();
rt = rhi->newTextureRenderTarget({ texture });
rp = rt->newCompatibleRenderPassDescriptor();
rt->setRenderPassDescriptor(rt);
- rt->build();
+ rt->create();
// rt can now be used with beginPass()
\endcode
*/
@@ -2622,21 +2622,21 @@ QRhiResource::Type QRhiTextureRenderTarget::resourceType() const
QRhiTextureRenderTarget intances.
\note resources, such as QRhiTexture instances, referenced in description()
- must already be built
+ must already have create() called on them.
- \sa build()
+ \sa create()
*/
/*!
- \fn bool QRhiTextureRenderTarget::build()
+ \fn bool QRhiTextureRenderTarget::create()
Creates the corresponding native graphics resources. If there are already
- resources present due to an earlier build() with no corresponding
- release(), then release() is called implicitly first.
+ resources present due to an earlier create() with no corresponding
+ destroy(), then destroy() is called implicitly first.
- \note renderPassDescriptor() must be set before calling build(). To obtain
+ \note renderPassDescriptor() must be set before calling create(). To obtain
a QRhiRenderPassDescriptor compatible with the render target, call
- newCompatibleRenderPassDescriptor() before build() but after setting all
+ newCompatibleRenderPassDescriptor() before create() but after setting all
other parameters, such as description() and flags(). To save resources,
reuse the same QRhiRenderPassDescriptor with multiple
QRhiTextureRenderTarget instances, whenever possible. Sharing the same
@@ -2645,10 +2645,10 @@ QRhiResource::Type QRhiTextureRenderTarget::resourceType() const
the same flags.
\note resources, such as QRhiTexture instances, referenced in description()
- must already be built
+ must already have create() called on them.
\return \c true when successful, \c false when a graphics operation failed.
- Regardless of the return value, calling release() is always safe.
+ Regardless of the return value, calling destroy() is always safe.
*/
/*!
@@ -2681,12 +2681,12 @@ QRhiResource::Type QRhiTextureRenderTarget::resourceType() const
QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, ubuf),
QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, texture, sampler)
});
- srb->build();
+ srb->create();
...
ps = rhi->newGraphicsPipeline();
...
ps->setShaderResourceBindings(srb);
- ps->build();
+ ps->create();
...
cb->setGraphicsPipeline(ps);
cb->setShaderResources(); // binds srb
@@ -2705,7 +2705,7 @@ QRhiResource::Type QRhiTextureRenderTarget::resourceType() const
This is why QRhiCommandBuffer::setShaderResources() allows specifying a \a
srb argument. As long as the layouts (so the number of bindings and the
binding points) match between two QRhiShaderResourceBindings, they can both
- be used with the same pipeline, assuming the pipeline was built with one of
+ be used with the same pipeline, assuming the pipeline was created with one of
them in the first place.
\badcode
@@ -2744,7 +2744,7 @@ QRhiResource::Type QRhiShaderResourceBindings::resourceType() const
then safely be passed to QRhiCommandBuffer::setShaderResources(), and so
be used with the pipeline in place of this QRhiShaderResourceBindings.
- This function can be called before build() as well. The bindings must
+ This function can be called before create() as well. The bindings must
already be set via setBindings() however.
*/
bool QRhiShaderResourceBindings::isLayoutCompatible(const QRhiShaderResourceBindings *other) const
@@ -3298,9 +3298,10 @@ QDebug operator<<(QDebug dbg, const QRhiShaderResourceBindings &srb)
stage, and there must be a vertex stage.
\note Setting the shader resource bindings is mandatory. The referenced
- QRhiShaderResourceBindings must already be built by the time build() is
- called. Associating with a QRhiShaderResourceBindings that has no bindings
- is also valid, as long as no shader in any stage expects any resources.
+ QRhiShaderResourceBindings must already have create() called on it by the
+ time create() is called. Associating with a QRhiShaderResourceBindings that
+ has no bindings is also valid, as long as no shader in any stage expects
+ any resources.
\note Setting the render pass descriptor is mandatory. To obtain a
QRhiRenderPassDescriptor that can be passed to setRenderPassDescriptor(),
@@ -3482,14 +3483,14 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
}
/*!
- \fn bool QRhiGraphicsPipeline::build()
+ \fn bool QRhiGraphicsPipeline::create()
Creates the corresponding native graphics resources. If there are already
- resources present due to an earlier build() with no corresponding
- release(), then release() is called implicitly first.
+ resources present due to an earlier create() with no corresponding
+ destroy(), then destroy() is called implicitly first.
\return \c true when successful, \c false when a graphics operation failed.
- Regardless of the return value, calling release() is always safe.
+ Regardless of the return value, calling destroy() is always safe.
*/
/*!
@@ -3544,7 +3545,7 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
void resizeSwapChain()
{
- hasSwapChain = sc->buildOrResize();
+ hasSwapChain = sc->createOrResize();
}
void render()
@@ -3577,7 +3578,7 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
void releaseSwapChain()
{
if (hasSwapChain) {
- sc->release();
+ sc->destroy();
hasSwapChain = false;
}
}
@@ -3724,7 +3725,7 @@ QRhiResource::Type QRhiSwapChain::resourceType() const
\fn QSize QRhiSwapChain::currentPixelSize() const
\return the size with which the swapchain was last successfully built. Use
- this to decide if buildOrResize() needs to be called again: if
+ this to decide if createOrResize() needs to be called again: if
\c{currentPixelSize() != surfacePixelSize()} then the swapchain needs to be
resized.
@@ -3759,7 +3760,7 @@ QRhiResource::Type QRhiSwapChain::resourceType() const
(such as, viewports) on the size reported from QRhiSwapChain, and never on
the size queried from QWindow.
- \note Can also be called before buildOrResize(), if at least window() is
+ \note Can also be called before createOrResize(), if at least window() is
already set) This in combination with currentPixelSize() allows to detect
when a swapchain needs to be resized. However, watch out for the fact that
the size of the underlying native object (surface, layer, or similar) is
@@ -3768,7 +3769,7 @@ QRhiResource::Type QRhiSwapChain::resourceType() const
Therefore, using this function to determine pixel sizes for graphics
resources that are used in a frame is strongly discouraged. Rely on
currentPixelSize() instead which returns a size that is atomic and will not
- change between buildOrResize() invocations.
+ change between createOrResize() invocations.
\note For depth-stencil buffers used in combination with the swapchain's
color buffers, it is strongly recommended to rely on the automatic sizing
@@ -3803,19 +3804,19 @@ QRhiResource::Type QRhiSwapChain::resourceType() const
*/
/*!
- \fn bool QRhiSwapChain::buildOrResize()
+ \fn bool QRhiSwapChain::createOrResize()
Creates the swapchain if not already done and resizes the swapchain buffers
to match the current size of the targeted surface. Call this whenever the
size of the target surface is different than before.
- \note call release() only when the swapchain needs to be released
+ \note call destroy() only when the swapchain needs to be released
completely, typically upon
QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed. To perform resizing, just
- call buildOrResize().
+ call createOrResize().
\return \c true when successful, \c false when a graphics operation failed.
- Regardless of the return value, calling release() is always safe.
+ Regardless of the return value, calling destroy() is always safe.
*/
/*!
@@ -3825,8 +3826,8 @@ QRhiResource::Type QRhiSwapChain::resourceType() const
\brief Compute pipeline state resource.
\note Setting the shader resource bindings is mandatory. The referenced
- QRhiShaderResourceBindings must already be built by the time build() is
- called.
+ QRhiShaderResourceBindings must already have created() called on it by the
+ time create() is called.
\note Setting the shader is mandatory.
*/
@@ -4210,8 +4211,8 @@ QRhi::~QRhi()
if (!d)
return;
- qDeleteAll(d->pendingReleaseAndDestroyResources);
- d->pendingReleaseAndDestroyResources.clear();
+ qDeleteAll(d->pendingDeleteResources);
+ d->pendingDeleteResources.clear();
runCleanup();
@@ -4396,7 +4397,7 @@ QRhiResourceUpdateBatch::~QRhiResourceUpdateBatch()
\return the batch to the pool. This should only be used when the batch is
not passed to one of QRhiCommandBuffer::beginPass(),
QRhiCommandBuffer::endPass(), or QRhiCommandBuffer::resourceUpdate()
- because these implicitly call release().
+ because these implicitly call destroy().
\note QRhiResourceUpdateBatch instances must never by \c deleted by
applications.
@@ -4410,7 +4411,7 @@ void QRhiResourceUpdateBatch::release()
Copies all queued operations from the \a other batch into this one.
\note \a other is not changed in any way, typically it will still need a
- release()
+ destroy()
This allows for a convenient pattern where resource updates that are
already known during the initialization step are collected into a batch
@@ -4433,7 +4434,7 @@ void QRhiResourceUpdateBatch::release()
QRhiResourceUpdateBatch *resUpdates = rhi->nextResourceUpdateBatch();
if (initialUpdates) {
resUpdates->merge(initialUpdates);
- initialUpdates->release();
+ initialUpdates->destroy();
initialUpdates = nullptr;
}
resUpdates->updateDynamicBuffer(...);
@@ -4645,7 +4646,7 @@ void QRhiResourceUpdateBatch::generateMips(QRhiTexture *tex, int layer)
destroyed. Instead, the batch is returned the pool for reuse by passing
it to QRhiCommandBuffer::beginPass(), QRhiCommandBuffer::endPass(), or
QRhiCommandBuffer::resourceUpdate(), or by calling
- QRhiResourceUpdateBatch::release() on it.
+ QRhiResourceUpdateBatch::destroy() on it.
\note Can be called outside beginFrame() - endFrame() as well since a batch
instance just collects data on its own, it does not perform any operations.
@@ -4791,11 +4792,11 @@ void QRhiCommandBuffer::setGraphicsPipeline(QRhiGraphicsPipeline *ps)
\l{QRhiShaderResourceBindings::isLayoutCompatible()}{layout-compatible},
meaning the layout (number of bindings, the type and binding number of each
binding) must fully match the QRhiShaderResourceBindings that was
- associated with the pipeline at the time of calling the pipeline's build().
+ associated with the pipeline at the time of calling the pipeline's create().
There are cases when a seemingly unnecessary setShaderResources() call is
mandatory: when rebuilding a resource referenced from \a srb, for example
- changing the size of a QRhiBuffer followed by a QRhiBuffer::build(), this
+ changing the size of a QRhiBuffer followed by a QRhiBuffer::create(), this
is the place where associated native objects (such as descriptor sets in
case of Vulkan) are updated to refer to the current native resources that
back the QRhiBuffer, QRhiTexture, QRhiSampler objects referenced from \a
@@ -5397,9 +5398,9 @@ void QRhi::releaseCachedResources()
\return true if the graphics device was lost.
The loss of the device is typically detected in beginFrame(), endFrame() or
- QRhiSwapChain::buildOrResize(), depending on the backend and the underlying
+ QRhiSwapChain::createOrResize(), depending on the backend and the underlying
native APIs. The most common is endFrame() because that is where presenting
- happens. With some backends QRhiSwapChain::buildOrResize() can also fail
+ happens. With some backends QRhiSwapChain::createOrResize() can also fail
due to a device loss. Therefore this function is provided as a generic way
to check if a device loss was detected by a previous operation.
@@ -5443,7 +5444,7 @@ bool QRhi::isDeviceLost() const
/*!
\return a new graphics pipeline resource.
- \sa QRhiResource::release()
+ \sa QRhiResource::destroy()
*/
QRhiGraphicsPipeline *QRhi::newGraphicsPipeline()
{
@@ -5456,7 +5457,7 @@ QRhiGraphicsPipeline *QRhi::newGraphicsPipeline()
\note Compute is only available when the \l{QRhi::Compute}{Compute} feature
is reported as supported.
- \sa QRhiResource::release()
+ \sa QRhiResource::destroy()
*/
QRhiComputePipeline *QRhi::newComputePipeline()
{
@@ -5466,7 +5467,7 @@ QRhiComputePipeline *QRhi::newComputePipeline()
/*!
\return a new shader resource binding collection resource.
- \sa QRhiResource::release()
+ \sa QRhiResource::destroy()
*/
QRhiShaderResourceBindings *QRhi::newShaderResourceBindings()
{
@@ -5485,7 +5486,7 @@ QRhiShaderResourceBindings *QRhi::newShaderResourceBindings()
the value of \a size. QRhiBuffer::size() will always report back the value
that was requested in \a size.
- \sa QRhiResource::release()
+ \sa QRhiResource::destroy()
*/
QRhiBuffer *QRhi::newBuffer(QRhiBuffer::Type type,
QRhiBuffer::UsageFlags usage,
@@ -5512,7 +5513,7 @@ QRhiBuffer *QRhi::newBuffer(QRhiBuffer::Type type,
break later on due to attempting to set up RGBA8->RGBA32F multisample
resolve in the color attachment(s) of the QRhiTextureRenderTarget.
- \sa QRhiResource::release()
+ \sa QRhiResource::destroy()
*/
QRhiRenderBuffer *QRhi::newRenderBuffer(QRhiRenderBuffer::Type type,
const QSize &pixelSize,
@@ -5532,7 +5533,7 @@ QRhiRenderBuffer *QRhi::newRenderBuffer(QRhiRenderBuffer::Type type,
compatible format, while the native texture may (but is not guaranteed to,
in case of OpenGL at least) use this format internally.
- \sa QRhiResource::release()
+ \sa QRhiResource::destroy()
*/
QRhiTexture *QRhi::newTexture(QRhiTexture::Format format,
const QSize &pixelSize,
@@ -5547,7 +5548,7 @@ QRhiTexture *QRhi::newTexture(QRhiTexture::Format format,
minification filter \a minFilter, mipmapping mode \a mipmapMode, and the
addressing (wrap) modes \a addressU, \a addressV, and \a addressW.
- \sa QRhiResource::release()
+ \sa QRhiResource::destroy()
*/
QRhiSampler *QRhi::newSampler(QRhiSampler::Filter magFilter,
QRhiSampler::Filter minFilter,
@@ -5563,7 +5564,7 @@ QRhiSampler *QRhi::newSampler(QRhiSampler::Filter magFilter,
\return a new texture render target with color and depth/stencil
attachments given in \a desc, and with the specified \a flags.
- \sa QRhiResource::release()
+ \sa QRhiResource::destroy()
*/
QRhiTextureRenderTarget *QRhi::newTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
@@ -5575,7 +5576,7 @@ QRhiTextureRenderTarget *QRhi::newTextureRenderTarget(const QRhiTextureRenderTar
/*!
\return a new swapchain.
- \sa QRhiResource::release(), QRhiSwapChain::buildOrResize()
+ \sa QRhiResource::destroy(), QRhiSwapChain::createOrResize()
*/
QRhiSwapChain *QRhi::newSwapChain()
{
@@ -5598,10 +5599,10 @@ QRhiSwapChain *QRhi::newSwapChain()
\li Create a swapchain.
- \li Call QRhiSwapChain::buildOrResize() whenever the surface size is
+ \li Call QRhiSwapChain::createOrResize() whenever the surface size is
different than before.
- \li Call QRhiSwapChain::release() on
+ \li Call QRhiSwapChain::destroy() on
QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed.
\li Then on every frame:
@@ -5623,7 +5624,7 @@ QRhiSwapChain *QRhi::newSwapChain()
value on failure. Some of these should be treated as soft, "try again
later" type of errors: When QRhi::FrameOpSwapChainOutOfDate is returned,
the swapchain is to be resized or updated by calling
- QRhiSwapChain::buildOrResize(). The application should then attempt to
+ QRhiSwapChain::createOrResize(). The application should then attempt to
generate a new frame. QRhi::FrameOpDeviceLost means the graphics device is
lost but this may also be recoverable by releasing all resources, including
the QRhi itself, and then recreating all resources. See isDeviceLost() for
@@ -5658,7 +5659,7 @@ QRhi::FrameOpResult QRhi::beginFrame(QRhiSwapChain *swapChain, BeginFrameFlags f
value on failure. Some of these should be treated as soft, "try again
later" type of errors: When QRhi::FrameOpSwapChainOutOfDate is returned,
the swapchain is to be resized or updated by calling
- QRhiSwapChain::buildOrResize(). The application should then attempt to
+ QRhiSwapChain::createOrResize(). The application should then attempt to
generate a new frame. QRhi::FrameOpDeviceLost means the graphics device is
lost but this may also be recoverable by releasing all resources, including
the QRhi itself, and then recreating all resources. See isDeviceLost() for
@@ -5673,10 +5674,10 @@ QRhi::FrameOpResult QRhi::endFrame(QRhiSwapChain *swapChain, EndFrameFlags flags
QRhi::FrameOpResult r = d->inFrame ? d->endFrame(swapChain, flags) : FrameOpSuccess;
d->inFrame = false;
- // releaseAndDestroyLater is a high level QRhi concept the backends know
+ // deleteLater is a high level QRhi concept the backends know
// nothing about - handle it here.
- qDeleteAll(d->pendingReleaseAndDestroyResources);
- d->pendingReleaseAndDestroyResources.clear();
+ qDeleteAll(d->pendingDeleteResources);
+ d->pendingDeleteResources.clear();
return r;
}
@@ -5800,8 +5801,8 @@ QRhi::FrameOpResult QRhi::endOffscreenFrame(EndFrameFlags flags)
QRhi::FrameOpResult r = d->inFrame ? d->endOffscreenFrame(flags) : FrameOpSuccess;
d->inFrame = false;
- qDeleteAll(d->pendingReleaseAndDestroyResources);
- d->pendingReleaseAndDestroyResources.clear();
+ qDeleteAll(d->pendingDeleteResources);
+ d->pendingDeleteResources.clear();
return r;
}
diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h
index a031ea4f4b..bd476c3927 100644
--- a/src/gui/rhi/qrhi_p.h
+++ b/src/gui/rhi/qrhi_p.h
@@ -658,8 +658,9 @@ public:
virtual Type resourceType() const = 0;
- virtual void release() = 0;
- void releaseAndDestroyLater();
+ virtual void destroy() = 0;
+
+ void deleteLater();
QByteArray name() const;
void setName(const QByteArray &name);
@@ -708,7 +709,7 @@ public:
int size() const { return m_size; }
void setSize(int sz) { m_size = sz; }
- virtual bool build() = 0;
+ virtual bool create() = 0;
virtual NativeBuffer nativeBuffer();
@@ -801,9 +802,9 @@ public:
int sampleCount() const { return m_sampleCount; }
void setSampleCount(int s) { m_sampleCount = s; }
- virtual bool build() = 0;
+ virtual bool create() = 0;
virtual NativeTexture nativeTexture();
- virtual bool buildFrom(NativeTexture src);
+ virtual bool createFrom(NativeTexture src);
virtual void setNativeLayout(int layout);
protected:
@@ -866,7 +867,7 @@ public:
CompareOp textureCompareOp() const { return m_compareOp; }
void setTextureCompareOp(CompareOp op) { m_compareOp = op; }
- virtual bool build() = 0;
+ virtual bool create() = 0;
protected:
QRhiSampler(QRhiImplementation *rhi,
@@ -908,7 +909,7 @@ public:
Flags flags() const { return m_flags; }
void setFlags(Flags h) { m_flags = h; }
- virtual bool build() = 0;
+ virtual bool create() = 0;
virtual QRhiTexture::Format backingFormat() const = 0;
@@ -972,7 +973,7 @@ public:
virtual QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() = 0;
- virtual bool build() = 0;
+ virtual bool create() = 0;
protected:
QRhiTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc_, Flags flags_);
@@ -1001,7 +1002,7 @@ public:
bool isLayoutCompatible(const QRhiShaderResourceBindings *other) const;
- virtual bool build() = 0;
+ virtual bool create() = 0;
protected:
QRhiShaderResourceBindings(QRhiImplementation *rhi);
@@ -1202,7 +1203,7 @@ public:
QRhiRenderPassDescriptor *renderPassDescriptor() const { return m_renderPassDesc; }
void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc) { m_renderPassDesc = desc; }
- virtual bool build() = 0;
+ virtual bool create() = 0;
protected:
QRhiGraphicsPipeline(QRhiImplementation *rhi);
@@ -1269,7 +1270,7 @@ public:
virtual QRhiRenderTarget *currentFrameRenderTarget() = 0;
virtual QSize surfacePixelSize() = 0;
virtual QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() = 0;
- virtual bool buildOrResize() = 0;
+ virtual bool createOrResize() = 0;
protected:
QRhiSwapChain(QRhiImplementation *rhi);
@@ -1287,7 +1288,7 @@ class Q_GUI_EXPORT QRhiComputePipeline : public QRhiResource
{
public:
QRhiResource::Type resourceType() const override;
- virtual bool build() = 0;
+ virtual bool create() = 0;
QRhiShaderStage shaderStage() const { return m_shaderStage; }
void setShaderStage(const QRhiShaderStage &stage) { m_shaderStage = stage; }
diff --git a/src/gui/rhi/qrhi_p_p.h b/src/gui/rhi/qrhi_p_p.h
index 1706ab131c..9efad4ba25 100644
--- a/src/gui/rhi/qrhi_p_p.h
+++ b/src/gui/rhi/qrhi_p_p.h
@@ -196,10 +196,10 @@ public:
return resources;
}
- void addReleaseAndDestroyLater(QRhiResource *res)
+ void addDeleteLater(QRhiResource *res)
{
if (inFrame)
- pendingReleaseAndDestroyResources.insert(res);
+ pendingDeleteResources.insert(res);
else
delete res;
}
@@ -227,7 +227,7 @@ private:
QVarLengthArray<QRhiResourceUpdateBatch *, 4> resUpdPool;
QBitArray resUpdPoolMap;
QSet<QRhiResource *> resources;
- QSet<QRhiResource *> pendingReleaseAndDestroyResources;
+ QSet<QRhiResource *> pendingDeleteResources;
QVector<QRhi::CleanupCallback> cleanupCallbacks;
friend class QRhi;
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp
index 726da3df86..5b7ad10a2f 100644
--- a/src/gui/rhi/qrhid3d11.cpp
+++ b/src/gui/rhi/qrhid3d11.cpp
@@ -2508,10 +2508,10 @@ QD3D11Buffer::QD3D11Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage,
QD3D11Buffer::~QD3D11Buffer()
{
- release();
+ destroy();
}
-void QD3D11Buffer::release()
+void QD3D11Buffer::destroy()
{
if (!buffer)
return;
@@ -2546,10 +2546,10 @@ static inline uint toD3DBufferUsage(QRhiBuffer::UsageFlags usage)
return uint(u);
}
-bool QD3D11Buffer::build()
+bool QD3D11Buffer::create()
{
if (buffer)
- release();
+ destroy();
if (m_usage.testFlag(QRhiBuffer::UniformBuffer) && m_type != Dynamic) {
qWarning("UniformBuffer must always be combined with Dynamic on D3D11");
@@ -2637,10 +2637,10 @@ QD3D11RenderBuffer::QD3D11RenderBuffer(QRhiImplementation *rhi, Type type, const
QD3D11RenderBuffer::~QD3D11RenderBuffer()
{
- release();
+ destroy();
}
-void QD3D11RenderBuffer::release()
+void QD3D11RenderBuffer::destroy()
{
if (!tex)
return;
@@ -2664,10 +2664,10 @@ void QD3D11RenderBuffer::release()
rhiD->unregisterResource(this);
}
-bool QD3D11RenderBuffer::build()
+bool QD3D11RenderBuffer::create()
{
if (tex)
- release();
+ destroy();
if (m_pixelSize.isEmpty())
return false;
@@ -2755,10 +2755,10 @@ QD3D11Texture::QD3D11Texture(QRhiImplementation *rhi, Format format, const QSize
QD3D11Texture::~QD3D11Texture()
{
- release();
+ destroy();
}
-void QD3D11Texture::release()
+void QD3D11Texture::destroy()
{
if (!tex)
return;
@@ -2812,10 +2812,10 @@ static inline DXGI_FORMAT toD3DDepthTextureDSVFormat(QRhiTexture::Format format)
}
}
-bool QD3D11Texture::prepareBuild(QSize *adjustedSize)
+bool QD3D11Texture::prepareCreate(QSize *adjustedSize)
{
if (tex)
- release();
+ destroy();
const QSize size = m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize;
const bool isDepth = isDepthTextureFormat(m_format);
@@ -2847,7 +2847,7 @@ bool QD3D11Texture::prepareBuild(QSize *adjustedSize)
return true;
}
-bool QD3D11Texture::finishBuild()
+bool QD3D11Texture::finishCreate()
{
QRHI_RES_RHI(QRhiD3D11);
const bool isDepth = isDepthTextureFormat(m_format);
@@ -2878,10 +2878,10 @@ bool QD3D11Texture::finishBuild()
return true;
}
-bool QD3D11Texture::build()
+bool QD3D11Texture::create()
{
QSize size;
- if (!prepareBuild(&size))
+ if (!prepareCreate(&size))
return false;
const bool isDepth = isDepthTextureFormat(m_format);
@@ -2925,7 +2925,7 @@ bool QD3D11Texture::build()
return false;
}
- if (!finishBuild())
+ if (!finishCreate())
return false;
if (!m_objectName.isEmpty())
@@ -2939,18 +2939,18 @@ bool QD3D11Texture::build()
return true;
}
-bool QD3D11Texture::buildFrom(QRhiTexture::NativeTexture src)
+bool QD3D11Texture::createFrom(QRhiTexture::NativeTexture src)
{
ID3D11Texture2D *srcTex = reinterpret_cast<ID3D11Texture2D *>(src.object);
if (srcTex == nullptr)
return false;
- if (!prepareBuild())
+ if (!prepareCreate())
return false;
tex = srcTex;
- if (!finishBuild())
+ if (!finishCreate())
return false;
QRHI_PROF;
@@ -3006,10 +3006,10 @@ QD3D11Sampler::QD3D11Sampler(QRhiImplementation *rhi, Filter magFilter, Filter m
QD3D11Sampler::~QD3D11Sampler()
{
- release();
+ destroy();
}
-void QD3D11Sampler::release()
+void QD3D11Sampler::destroy()
{
if (!samplerState)
return;
@@ -3093,10 +3093,10 @@ static inline D3D11_COMPARISON_FUNC toD3DTextureComparisonFunc(QRhiSampler::Comp
}
}
-bool QD3D11Sampler::build()
+bool QD3D11Sampler::create()
{
if (samplerState)
- release();
+ destroy();
D3D11_SAMPLER_DESC desc;
memset(&desc, 0, sizeof(desc));
@@ -3130,10 +3130,10 @@ QD3D11RenderPassDescriptor::QD3D11RenderPassDescriptor(QRhiImplementation *rhi)
QD3D11RenderPassDescriptor::~QD3D11RenderPassDescriptor()
{
- release();
+ destroy();
}
-void QD3D11RenderPassDescriptor::release()
+void QD3D11RenderPassDescriptor::destroy()
{
// nothing to do here
}
@@ -3152,10 +3152,10 @@ QD3D11ReferenceRenderTarget::QD3D11ReferenceRenderTarget(QRhiImplementation *rhi
QD3D11ReferenceRenderTarget::~QD3D11ReferenceRenderTarget()
{
- release();
+ destroy();
}
-void QD3D11ReferenceRenderTarget::release()
+void QD3D11ReferenceRenderTarget::destroy()
{
// nothing to do here
}
@@ -3189,10 +3189,10 @@ QD3D11TextureRenderTarget::QD3D11TextureRenderTarget(QRhiImplementation *rhi,
QD3D11TextureRenderTarget::~QD3D11TextureRenderTarget()
{
- release();
+ destroy();
}
-void QD3D11TextureRenderTarget::release()
+void QD3D11TextureRenderTarget::destroy()
{
QRHI_RES_RHI(QRhiD3D11);
@@ -3221,10 +3221,10 @@ QRhiRenderPassDescriptor *QD3D11TextureRenderTarget::newCompatibleRenderPassDesc
return new QD3D11RenderPassDescriptor(m_rhi);
}
-bool QD3D11TextureRenderTarget::build()
+bool QD3D11TextureRenderTarget::create()
{
if (rtv[0] || dsv)
- release();
+ destroy();
const bool hasColorAttachments = m_desc.cbeginColorAttachments() != m_desc.cendColorAttachments();
Q_ASSERT(hasColorAttachments || m_desc.depthTexture());
@@ -3345,19 +3345,19 @@ QD3D11ShaderResourceBindings::QD3D11ShaderResourceBindings(QRhiImplementation *r
QD3D11ShaderResourceBindings::~QD3D11ShaderResourceBindings()
{
- release();
+ destroy();
}
-void QD3D11ShaderResourceBindings::release()
+void QD3D11ShaderResourceBindings::destroy()
{
sortedBindings.clear();
boundResourceData.clear();
}
-bool QD3D11ShaderResourceBindings::build()
+bool QD3D11ShaderResourceBindings::create()
{
if (!sortedBindings.isEmpty())
- release();
+ destroy();
std::copy(m_bindings.cbegin(), m_bindings.cend(), std::back_inserter(sortedBindings));
std::sort(sortedBindings.begin(), sortedBindings.end(),
@@ -3382,10 +3382,10 @@ QD3D11GraphicsPipeline::QD3D11GraphicsPipeline(QRhiImplementation *rhi)
QD3D11GraphicsPipeline::~QD3D11GraphicsPipeline()
{
- release();
+ destroy();
}
-void QD3D11GraphicsPipeline::release()
+void QD3D11GraphicsPipeline::destroy()
{
QRHI_RES_RHI(QRhiD3D11);
@@ -3703,10 +3703,10 @@ static QByteArray compileHlslShaderSource(const QShader &shader, QShader::Varian
return result;
}
-bool QD3D11GraphicsPipeline::build()
+bool QD3D11GraphicsPipeline::create()
{
if (dsState)
- release();
+ destroy();
QRHI_RES_RHI(QRhiD3D11);
if (!rhiD->sanityCheckGraphicsPipeline(this))
@@ -3888,10 +3888,10 @@ QD3D11ComputePipeline::QD3D11ComputePipeline(QRhiImplementation *rhi)
QD3D11ComputePipeline::~QD3D11ComputePipeline()
{
- release();
+ destroy();
}
-void QD3D11ComputePipeline::release()
+void QD3D11ComputePipeline::destroy()
{
QRHI_RES_RHI(QRhiD3D11);
@@ -3905,10 +3905,10 @@ void QD3D11ComputePipeline::release()
rhiD->unregisterResource(this);
}
-bool QD3D11ComputePipeline::build()
+bool QD3D11ComputePipeline::create()
{
if (cs.shader)
- release();
+ destroy();
QRHI_RES_RHI(QRhiD3D11);
@@ -3955,10 +3955,10 @@ QD3D11CommandBuffer::QD3D11CommandBuffer(QRhiImplementation *rhi)
QD3D11CommandBuffer::~QD3D11CommandBuffer()
{
- release();
+ destroy();
}
-void QD3D11CommandBuffer::release()
+void QD3D11CommandBuffer::destroy()
{
// nothing to do here
}
@@ -3982,7 +3982,7 @@ QD3D11SwapChain::QD3D11SwapChain(QRhiImplementation *rhi)
QD3D11SwapChain::~QD3D11SwapChain()
{
- release();
+ destroy();
}
void QD3D11SwapChain::releaseBuffers()
@@ -4007,7 +4007,7 @@ void QD3D11SwapChain::releaseBuffers()
}
}
-void QD3D11SwapChain::release()
+void QD3D11SwapChain::destroy()
{
if (!swapChain)
return;
@@ -4095,17 +4095,17 @@ bool QD3D11SwapChain::newColorBuffer(const QSize &size, DXGI_FORMAT format, DXGI
return true;
}
-bool QD3D11SwapChain::buildOrResize()
+bool QD3D11SwapChain::createOrResize()
{
// Can be called multiple times due to window resizes - that is not the
- // same as a simple release+build (as with other resources). Just need to
+ // same as a simple destroy+create (as with other resources). Just need to
// resize the buffers then.
const bool needsRegistration = !window || window != m_window;
// except if the window actually changes
if (window && window != m_window)
- release();
+ destroy();
window = m_window;
m_currentPixelSize = surfacePixelSize();
@@ -4252,7 +4252,7 @@ bool QD3D11SwapChain::buildOrResize()
if (m_depthStencil && m_depthStencil->pixelSize() != pixelSize) {
if (m_depthStencil->flags().testFlag(QRhiRenderBuffer::UsedWithSwapChainOnly)) {
m_depthStencil->setPixelSize(pixelSize);
- if (!m_depthStencil->build())
+ if (!m_depthStencil->create())
qWarning("Failed to rebuild swapchain's associated depth-stencil buffer for size %dx%d",
pixelSize.width(), pixelSize.height());
} else {
diff --git a/src/gui/rhi/qrhid3d11_p_p.h b/src/gui/rhi/qrhid3d11_p_p.h
index 2cb59b32b5..5c0936c062 100644
--- a/src/gui/rhi/qrhid3d11_p_p.h
+++ b/src/gui/rhi/qrhid3d11_p_p.h
@@ -62,8 +62,8 @@ struct QD3D11Buffer : public QRhiBuffer
{
QD3D11Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size);
~QD3D11Buffer();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QRhiBuffer::NativeBuffer nativeBuffer() override;
ID3D11UnorderedAccessView *unorderedAccessView();
@@ -82,8 +82,8 @@ struct QD3D11RenderBuffer : public QRhiRenderBuffer
int sampleCount, QRhiRenderBuffer::Flags flags,
QRhiTexture::Format backingFormatHint);
~QD3D11RenderBuffer();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QRhiTexture::Format backingFormat() const override;
ID3D11Texture2D *tex = nullptr;
@@ -99,13 +99,13 @@ struct QD3D11Texture : public QRhiTexture
QD3D11Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
int sampleCount, Flags flags);
~QD3D11Texture();
- void release() override;
- bool build() override;
- bool buildFrom(NativeTexture src) override;
+ void destroy() override;
+ bool create() override;
+ bool createFrom(NativeTexture src) override;
NativeTexture nativeTexture() override;
- bool prepareBuild(QSize *adjustedSize = nullptr);
- bool finishBuild();
+ bool prepareCreate(QSize *adjustedSize = nullptr);
+ bool finishCreate();
ID3D11UnorderedAccessView *unorderedAccessViewForLevel(int level);
ID3D11Texture2D *tex = nullptr;
@@ -124,8 +124,8 @@ struct QD3D11Sampler : public QRhiSampler
QD3D11Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
AddressMode u, AddressMode v, AddressMode w);
~QD3D11Sampler();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
ID3D11SamplerState *samplerState = nullptr;
uint generation = 0;
@@ -136,7 +136,7 @@ struct QD3D11RenderPassDescriptor : public QRhiRenderPassDescriptor
{
QD3D11RenderPassDescriptor(QRhiImplementation *rhi);
~QD3D11RenderPassDescriptor();
- void release() override;
+ void destroy() override;
bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
};
@@ -164,7 +164,7 @@ struct QD3D11ReferenceRenderTarget : public QRhiRenderTarget
{
QD3D11ReferenceRenderTarget(QRhiImplementation *rhi);
~QD3D11ReferenceRenderTarget();
- void release() override;
+ void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
@@ -177,14 +177,14 @@ struct QD3D11TextureRenderTarget : public QRhiTextureRenderTarget
{
QD3D11TextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
~QD3D11TextureRenderTarget();
- void release() override;
+ void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
int sampleCount() const override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool build() override;
+ bool create() override;
QD3D11RenderTargetData d;
bool ownsRtv[QD3D11RenderTargetData::MAX_COLOR_ATTACHMENTS];
@@ -198,8 +198,8 @@ struct QD3D11ShaderResourceBindings : public QRhiShaderResourceBindings
{
QD3D11ShaderResourceBindings(QRhiImplementation *rhi);
~QD3D11ShaderResourceBindings();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
uint generation = 0;
@@ -269,8 +269,8 @@ struct QD3D11GraphicsPipeline : public QRhiGraphicsPipeline
{
QD3D11GraphicsPipeline(QRhiImplementation *rhi);
~QD3D11GraphicsPipeline();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
ID3D11DepthStencilState *dsState = nullptr;
ID3D11BlendState *blendState = nullptr;
@@ -293,8 +293,8 @@ struct QD3D11ComputePipeline : public QRhiComputePipeline
{
QD3D11ComputePipeline(QRhiImplementation *rhi);
~QD3D11ComputePipeline();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
struct {
ID3D11ComputeShader *shader = nullptr;
@@ -310,7 +310,7 @@ struct QD3D11CommandBuffer : public QRhiCommandBuffer
{
QD3D11CommandBuffer(QRhiImplementation *rhi);
~QD3D11CommandBuffer();
- void release() override;
+ void destroy() override;
struct Command {
enum Cmd {
@@ -516,7 +516,7 @@ struct QD3D11SwapChain : public QRhiSwapChain
{
QD3D11SwapChain(QRhiImplementation *rhi);
~QD3D11SwapChain();
- void release() override;
+ void destroy() override;
QRhiCommandBuffer *currentFrameCommandBuffer() override;
QRhiRenderTarget *currentFrameRenderTarget() override;
@@ -524,7 +524,7 @@ struct QD3D11SwapChain : public QRhiSwapChain
QSize surfacePixelSize() override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool buildOrResize() override;
+ bool createOrResize() override;
void releaseBuffers();
bool newColorBuffer(const QSize &size, DXGI_FORMAT format, DXGI_SAMPLE_DESC sampleDesc,
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp
index eb27ca5f57..b59e6d98b1 100644
--- a/src/gui/rhi/qrhigles2.cpp
+++ b/src/gui/rhi/qrhigles2.cpp
@@ -1526,7 +1526,7 @@ void QRhiGles2::enqueueSubresUpload(QGles2Texture *texD, QGles2CommandBuffer *cb
cbD->commands.append(cmd);
} else if (!rawData.isEmpty() && isCompressed) {
if (!texD->compressedAtlasBuilt && (texD->flags() & QRhiTexture::UsedAsCompressedAtlas)) {
- // Build on first upload since glCompressedTexImage2D cannot take nullptr data
+ // Create on first upload since glCompressedTexImage2D cannot take nullptr data
quint32 byteSize = 0;
compressedFormatInfo(texD->m_format, texD->m_pixelSize, nullptr, &byteSize, nullptr);
QByteArray zeroBuf(byteSize, 0);
@@ -3514,10 +3514,10 @@ QGles2Buffer::QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage,
QGles2Buffer::~QGles2Buffer()
{
- release();
+ destroy();
}
-void QGles2Buffer::release()
+void QGles2Buffer::destroy()
{
if (!buffer)
return;
@@ -3536,10 +3536,10 @@ void QGles2Buffer::release()
rhiD->unregisterResource(this);
}
-bool QGles2Buffer::build()
+bool QGles2Buffer::create()
{
if (buffer)
- release();
+ destroy();
QRHI_RES_RHI(QRhiGles2);
QRHI_PROF;
@@ -3593,10 +3593,10 @@ QGles2RenderBuffer::QGles2RenderBuffer(QRhiImplementation *rhi, Type type, const
QGles2RenderBuffer::~QGles2RenderBuffer()
{
- release();
+ destroy();
}
-void QGles2RenderBuffer::release()
+void QGles2RenderBuffer::destroy()
{
if (!renderbuffer)
return;
@@ -3617,10 +3617,10 @@ void QGles2RenderBuffer::release()
rhiD->unregisterResource(this);
}
-bool QGles2RenderBuffer::build()
+bool QGles2RenderBuffer::create()
{
if (renderbuffer)
- release();
+ destroy();
QRHI_RES_RHI(QRhiGles2);
QRHI_PROF;
@@ -3719,10 +3719,10 @@ QGles2Texture::QGles2Texture(QRhiImplementation *rhi, Format format, const QSize
QGles2Texture::~QGles2Texture()
{
- release();
+ destroy();
}
-void QGles2Texture::release()
+void QGles2Texture::destroy()
{
if (!texture)
return;
@@ -3744,10 +3744,10 @@ void QGles2Texture::release()
rhiD->unregisterResource(this);
}
-bool QGles2Texture::prepareBuild(QSize *adjustedSize)
+bool QGles2Texture::prepareCreate(QSize *adjustedSize)
{
if (texture)
- release();
+ destroy();
QRHI_RES_RHI(QRhiGles2);
if (!rhiD->ensureContext())
@@ -3790,10 +3790,10 @@ bool QGles2Texture::prepareBuild(QSize *adjustedSize)
return true;
}
-bool QGles2Texture::build()
+bool QGles2Texture::create()
{
QSize size;
- if (!prepareBuild(&size))
+ if (!prepareCreate(&size))
return false;
QRHI_RES_RHI(QRhiGles2);
@@ -3843,13 +3843,13 @@ bool QGles2Texture::build()
return true;
}
-bool QGles2Texture::buildFrom(QRhiTexture::NativeTexture src)
+bool QGles2Texture::createFrom(QRhiTexture::NativeTexture src)
{
const uint textureId = uint(src.object);
if (textureId == 0)
return false;
- if (!prepareBuild())
+ if (!prepareCreate())
return false;
texture = textureId;
@@ -3880,15 +3880,15 @@ QGles2Sampler::QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter m
QGles2Sampler::~QGles2Sampler()
{
- release();
+ destroy();
}
-void QGles2Sampler::release()
+void QGles2Sampler::destroy()
{
// nothing to do here
}
-bool QGles2Sampler::build()
+bool QGles2Sampler::create()
{
d.glminfilter = toGlMinFilter(m_minFilter, m_mipmapMode);
d.glmagfilter = toGlMagFilter(m_magFilter);
@@ -3909,10 +3909,10 @@ QGles2RenderPassDescriptor::QGles2RenderPassDescriptor(QRhiImplementation *rhi)
QGles2RenderPassDescriptor::~QGles2RenderPassDescriptor()
{
- release();
+ destroy();
}
-void QGles2RenderPassDescriptor::release()
+void QGles2RenderPassDescriptor::destroy()
{
// nothing to do here
}
@@ -3931,10 +3931,10 @@ QGles2ReferenceRenderTarget::QGles2ReferenceRenderTarget(QRhiImplementation *rhi
QGles2ReferenceRenderTarget::~QGles2ReferenceRenderTarget()
{
- release();
+ destroy();
}
-void QGles2ReferenceRenderTarget::release()
+void QGles2ReferenceRenderTarget::destroy()
{
// nothing to do here
}
@@ -3964,10 +3964,10 @@ QGles2TextureRenderTarget::QGles2TextureRenderTarget(QRhiImplementation *rhi,
QGles2TextureRenderTarget::~QGles2TextureRenderTarget()
{
- release();
+ destroy();
}
-void QGles2TextureRenderTarget::release()
+void QGles2TextureRenderTarget::destroy()
{
if (!framebuffer)
return;
@@ -3990,12 +3990,12 @@ QRhiRenderPassDescriptor *QGles2TextureRenderTarget::newCompatibleRenderPassDesc
return new QGles2RenderPassDescriptor(m_rhi);
}
-bool QGles2TextureRenderTarget::build()
+bool QGles2TextureRenderTarget::create()
{
QRHI_RES_RHI(QRhiGles2);
if (framebuffer)
- release();
+ destroy();
const bool hasColorAttachments = m_desc.cbeginColorAttachments() != m_desc.cendColorAttachments();
Q_ASSERT(hasColorAttachments || m_desc.depthTexture());
@@ -4114,15 +4114,15 @@ QGles2ShaderResourceBindings::QGles2ShaderResourceBindings(QRhiImplementation *r
QGles2ShaderResourceBindings::~QGles2ShaderResourceBindings()
{
- release();
+ destroy();
}
-void QGles2ShaderResourceBindings::release()
+void QGles2ShaderResourceBindings::destroy()
{
// nothing to do here
}
-bool QGles2ShaderResourceBindings::build()
+bool QGles2ShaderResourceBindings::create()
{
generation += 1;
return true;
@@ -4135,10 +4135,10 @@ QGles2GraphicsPipeline::QGles2GraphicsPipeline(QRhiImplementation *rhi)
QGles2GraphicsPipeline::~QGles2GraphicsPipeline()
{
- release();
+ destroy();
}
-void QGles2GraphicsPipeline::release()
+void QGles2GraphicsPipeline::destroy()
{
if (!program)
return;
@@ -4158,12 +4158,12 @@ void QGles2GraphicsPipeline::release()
rhiD->unregisterResource(this);
}
-bool QGles2GraphicsPipeline::build()
+bool QGles2GraphicsPipeline::create()
{
QRHI_RES_RHI(QRhiGles2);
if (program)
- release();
+ destroy();
if (!rhiD->ensureContext())
return false;
@@ -4236,10 +4236,10 @@ QGles2ComputePipeline::QGles2ComputePipeline(QRhiImplementation *rhi)
QGles2ComputePipeline::~QGles2ComputePipeline()
{
- release();
+ destroy();
}
-void QGles2ComputePipeline::release()
+void QGles2ComputePipeline::destroy()
{
if (!program)
return;
@@ -4259,12 +4259,12 @@ void QGles2ComputePipeline::release()
rhiD->unregisterResource(this);
}
-bool QGles2ComputePipeline::build()
+bool QGles2ComputePipeline::create()
{
QRHI_RES_RHI(QRhiGles2);
if (program)
- release();
+ destroy();
if (!rhiD->ensureContext())
return false;
@@ -4310,10 +4310,10 @@ QGles2CommandBuffer::QGles2CommandBuffer(QRhiImplementation *rhi)
QGles2CommandBuffer::~QGles2CommandBuffer()
{
- release();
+ destroy();
}
-void QGles2CommandBuffer::release()
+void QGles2CommandBuffer::destroy()
{
// nothing to do here
}
@@ -4327,10 +4327,10 @@ QGles2SwapChain::QGles2SwapChain(QRhiImplementation *rhi)
QGles2SwapChain::~QGles2SwapChain()
{
- release();
+ destroy();
}
-void QGles2SwapChain::release()
+void QGles2SwapChain::destroy()
{
QRHI_PROF;
QRHI_PROF_F(releaseSwapChain(this));
@@ -4357,7 +4357,7 @@ QRhiRenderPassDescriptor *QGles2SwapChain::newCompatibleRenderPassDescriptor()
return new QGles2RenderPassDescriptor(m_rhi);
}
-bool QGles2SwapChain::buildOrResize()
+bool QGles2SwapChain::createOrResize()
{
surface = m_window;
m_currentPixelSize = surfacePixelSize();
@@ -4367,7 +4367,7 @@ bool QGles2SwapChain::buildOrResize()
&& m_depthStencil->pixelSize() != pixelSize)
{
m_depthStencil->setPixelSize(pixelSize);
- m_depthStencil->build();
+ m_depthStencil->create();
}
rt.d.rp = QRHI_RES(QGles2RenderPassDescriptor, m_renderPassDesc);
diff --git a/src/gui/rhi/qrhigles2_p_p.h b/src/gui/rhi/qrhigles2_p_p.h
index 65ac3ccb67..2c393da3b4 100644
--- a/src/gui/rhi/qrhigles2_p_p.h
+++ b/src/gui/rhi/qrhigles2_p_p.h
@@ -62,8 +62,8 @@ struct QGles2Buffer : public QRhiBuffer
{
QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size);
~QGles2Buffer();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QRhiBuffer::NativeBuffer nativeBuffer() override;
GLuint buffer = 0;
@@ -92,8 +92,8 @@ struct QGles2RenderBuffer : public QRhiRenderBuffer
int sampleCount, QRhiRenderBuffer::Flags flags,
QRhiTexture::Format backingFormatHint);
~QGles2RenderBuffer();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QRhiTexture::Format backingFormat() const override;
GLuint renderbuffer = 0;
@@ -132,12 +132,12 @@ struct QGles2Texture : public QRhiTexture
QGles2Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
int sampleCount, Flags flags);
~QGles2Texture();
- void release() override;
- bool build() override;
- bool buildFrom(NativeTexture src) override;
+ void destroy() override;
+ bool create() override;
+ bool createFrom(NativeTexture src) override;
NativeTexture nativeTexture() override;
- bool prepareBuild(QSize *adjustedSize = nullptr);
+ bool prepareCreate(QSize *adjustedSize = nullptr);
GLuint texture = 0;
bool owns = true;
@@ -175,8 +175,8 @@ struct QGles2Sampler : public QRhiSampler
QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
AddressMode u, AddressMode v, AddressMode w);
~QGles2Sampler();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QGles2SamplerData d;
uint generation = 0;
@@ -187,7 +187,7 @@ struct QGles2RenderPassDescriptor : public QRhiRenderPassDescriptor
{
QGles2RenderPassDescriptor(QRhiImplementation *rhi);
~QGles2RenderPassDescriptor();
- void release() override;
+ void destroy() override;
bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
};
@@ -208,7 +208,7 @@ struct QGles2ReferenceRenderTarget : public QRhiRenderTarget
{
QGles2ReferenceRenderTarget(QRhiImplementation *rhi);
~QGles2ReferenceRenderTarget();
- void release() override;
+ void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
@@ -221,14 +221,14 @@ struct QGles2TextureRenderTarget : public QRhiTextureRenderTarget
{
QGles2TextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
~QGles2TextureRenderTarget();
- void release() override;
+ void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
int sampleCount() const override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool build() override;
+ bool create() override;
QGles2RenderTargetData d;
GLuint framebuffer = 0;
@@ -239,8 +239,8 @@ struct QGles2ShaderResourceBindings : public QRhiShaderResourceBindings
{
QGles2ShaderResourceBindings(QRhiImplementation *rhi);
~QGles2ShaderResourceBindings();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
uint generation = 0;
friend class QRhiGles2;
@@ -270,8 +270,8 @@ struct QGles2GraphicsPipeline : public QRhiGraphicsPipeline
{
QGles2GraphicsPipeline(QRhiImplementation *rhi);
~QGles2GraphicsPipeline();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
GLuint program = 0;
GLenum drawMode = GL_TRIANGLES;
@@ -285,8 +285,8 @@ struct QGles2ComputePipeline : public QRhiComputePipeline
{
QGles2ComputePipeline(QRhiImplementation *rhi);
~QGles2ComputePipeline();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
GLuint program = 0;
QVector<QGles2UniformDescription> uniforms;
@@ -299,7 +299,7 @@ struct QGles2CommandBuffer : public QRhiCommandBuffer
{
QGles2CommandBuffer(QRhiImplementation *rhi);
~QGles2CommandBuffer();
- void release() override;
+ void destroy() override;
struct Command {
enum Cmd {
@@ -662,7 +662,7 @@ struct QGles2SwapChain : public QRhiSwapChain
{
QGles2SwapChain(QRhiImplementation *rhi);
~QGles2SwapChain();
- void release() override;
+ void destroy() override;
QRhiCommandBuffer *currentFrameCommandBuffer() override;
QRhiRenderTarget *currentFrameRenderTarget() override;
@@ -670,7 +670,7 @@ struct QGles2SwapChain : public QRhiSwapChain
QSize surfacePixelSize() override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool buildOrResize() override;
+ bool createOrResize() override;
QSurface *surface = nullptr;
QSize pixelSize;
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm
index a003d4815d..b249dc55cc 100644
--- a/src/gui/rhi/qrhimetal.mm
+++ b/src/gui/rhi/qrhimetal.mm
@@ -136,7 +136,7 @@ struct QMetalShader
std::array<uint, 3> localSize;
QShader::NativeResourceBindingMap nativeResourceBindingMap;
- void release() {
+ void destroy() {
nativeResourceBindingMap.clear();
[lib release];
lib = nil;
@@ -425,7 +425,7 @@ void QRhiMetal::destroy()
finishActiveReadbacks(true);
for (QMetalShader &s : d->shaderCache)
- s.release();
+ s.destroy();
d->shaderCache.clear();
if (@available(macOS 10.13, iOS 11.0, *)) {
@@ -612,7 +612,7 @@ bool QRhiMetal::makeThreadLocalNativeContextCurrent()
void QRhiMetal::releaseCachedResources()
{
for (QMetalShader &s : d->shaderCache)
- s.release();
+ s.destroy();
d->shaderCache.clear();
}
@@ -2141,11 +2141,11 @@ QMetalBuffer::QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage,
QMetalBuffer::~QMetalBuffer()
{
- release();
+ destroy();
delete d;
}
-void QMetalBuffer::release()
+void QMetalBuffer::destroy()
{
if (!d->buf[0])
return;
@@ -2167,10 +2167,10 @@ void QMetalBuffer::release()
rhiD->unregisterResource(this);
}
-bool QMetalBuffer::build()
+bool QMetalBuffer::create()
{
if (d->buf[0])
- release();
+ destroy();
if (m_usage.testFlag(QRhiBuffer::StorageBuffer) && m_type == Dynamic) {
qWarning("StorageBuffer cannot be combined with Dynamic");
@@ -2383,11 +2383,11 @@ QMetalRenderBuffer::QMetalRenderBuffer(QRhiImplementation *rhi, Type type, const
QMetalRenderBuffer::~QMetalRenderBuffer()
{
- release();
+ destroy();
delete d;
}
-void QMetalRenderBuffer::release()
+void QMetalRenderBuffer::destroy()
{
if (!d->tex)
return;
@@ -2406,10 +2406,10 @@ void QMetalRenderBuffer::release()
rhiD->unregisterResource(this);
}
-bool QMetalRenderBuffer::build()
+bool QMetalRenderBuffer::create()
{
if (d->tex)
- release();
+ destroy();
if (m_pixelSize.isEmpty())
return false;
@@ -2490,11 +2490,11 @@ QMetalTexture::QMetalTexture(QRhiImplementation *rhi, Format format, const QSize
QMetalTexture::~QMetalTexture()
{
- release();
+ destroy();
delete d;
}
-void QMetalTexture::release()
+void QMetalTexture::destroy()
{
if (!d->tex)
return;
@@ -2523,10 +2523,10 @@ void QMetalTexture::release()
rhiD->unregisterResource(this);
}
-bool QMetalTexture::prepareBuild(QSize *adjustedSize)
+bool QMetalTexture::prepareCreate(QSize *adjustedSize)
{
if (d->tex)
- release();
+ destroy();
const QSize size = m_pixelSize.isEmpty() ? QSize(1, 1) : m_pixelSize;
const bool isCube = m_flags.testFlag(CubeMap);
@@ -2553,10 +2553,10 @@ bool QMetalTexture::prepareBuild(QSize *adjustedSize)
return true;
}
-bool QMetalTexture::build()
+bool QMetalTexture::create()
{
QSize size;
- if (!prepareBuild(&size))
+ if (!prepareCreate(&size))
return false;
MTLTextureDescriptor *desc = [[MTLTextureDescriptor alloc] init];
@@ -2598,13 +2598,13 @@ bool QMetalTexture::build()
return true;
}
-bool QMetalTexture::buildFrom(QRhiTexture::NativeTexture src)
+bool QMetalTexture::createFrom(QRhiTexture::NativeTexture src)
{
id<MTLTexture> tex = id<MTLTexture>(src.object);
if (tex == 0)
return false;
- if (!prepareBuild())
+ if (!prepareCreate())
return false;
d->tex = tex;
@@ -2650,11 +2650,11 @@ QMetalSampler::QMetalSampler(QRhiImplementation *rhi, Filter magFilter, Filter m
QMetalSampler::~QMetalSampler()
{
- release();
+ destroy();
delete d;
}
-void QMetalSampler::release()
+void QMetalSampler::destroy()
{
if (!d->samplerState)
return;
@@ -2739,10 +2739,10 @@ static inline MTLCompareFunction toMetalTextureCompareFunction(QRhiSampler::Comp
}
}
-bool QMetalSampler::build()
+bool QMetalSampler::create()
{
if (d->samplerState)
- release();
+ destroy();
MTLSamplerDescriptor *desc = [[MTLSamplerDescriptor alloc] init];
desc.minFilter = toMetalFilter(m_minFilter);
@@ -2772,10 +2772,10 @@ QMetalRenderPassDescriptor::QMetalRenderPassDescriptor(QRhiImplementation *rhi)
QMetalRenderPassDescriptor::~QMetalRenderPassDescriptor()
{
- release();
+ destroy();
}
-void QMetalRenderPassDescriptor::release()
+void QMetalRenderPassDescriptor::destroy()
{
// nothing to do here
}
@@ -2814,11 +2814,11 @@ QMetalReferenceRenderTarget::QMetalReferenceRenderTarget(QRhiImplementation *rhi
QMetalReferenceRenderTarget::~QMetalReferenceRenderTarget()
{
- release();
+ destroy();
delete d;
}
-void QMetalReferenceRenderTarget::release()
+void QMetalReferenceRenderTarget::destroy()
{
// nothing to do here
}
@@ -2848,11 +2848,11 @@ QMetalTextureRenderTarget::QMetalTextureRenderTarget(QRhiImplementation *rhi,
QMetalTextureRenderTarget::~QMetalTextureRenderTarget()
{
- release();
+ destroy();
delete d;
}
-void QMetalTextureRenderTarget::release()
+void QMetalTextureRenderTarget::destroy()
{
// nothing to do here
}
@@ -2879,7 +2879,7 @@ QRhiRenderPassDescriptor *QMetalTextureRenderTarget::newCompatibleRenderPassDesc
return rpD;
}
-bool QMetalTextureRenderTarget::build()
+bool QMetalTextureRenderTarget::create()
{
QRHI_RES_RHI(QRhiMetal);
const bool hasColorAttachments = m_desc.cbeginColorAttachments() != m_desc.cendColorAttachments();
@@ -2970,19 +2970,19 @@ QMetalShaderResourceBindings::QMetalShaderResourceBindings(QRhiImplementation *r
QMetalShaderResourceBindings::~QMetalShaderResourceBindings()
{
- release();
+ destroy();
}
-void QMetalShaderResourceBindings::release()
+void QMetalShaderResourceBindings::destroy()
{
sortedBindings.clear();
maxBinding = -1;
}
-bool QMetalShaderResourceBindings::build()
+bool QMetalShaderResourceBindings::create()
{
if (!sortedBindings.isEmpty())
- release();
+ destroy();
std::copy(m_bindings.cbegin(), m_bindings.cend(), std::back_inserter(sortedBindings));
std::sort(sortedBindings.begin(), sortedBindings.end(),
@@ -3058,16 +3058,16 @@ QMetalGraphicsPipeline::QMetalGraphicsPipeline(QRhiImplementation *rhi)
QMetalGraphicsPipeline::~QMetalGraphicsPipeline()
{
- release();
+ destroy();
delete d;
}
-void QMetalGraphicsPipeline::release()
+void QMetalGraphicsPipeline::destroy()
{
QRHI_RES_RHI(QRhiMetal);
- d->vs.release();
- d->fs.release();
+ d->vs.destroy();
+ d->fs.destroy();
[d->ds release];
d->ds = nil;
@@ -3347,10 +3347,10 @@ id<MTLFunction> QRhiMetalData::createMSLShaderFunction(id<MTLLibrary> lib, const
return f;
}
-bool QMetalGraphicsPipeline::build()
+bool QMetalGraphicsPipeline::create()
{
if (d->ps)
- release();
+ destroy();
QRHI_RES_RHI(QRhiMetal);
if (!rhiD->sanityCheckGraphicsPipeline(this))
@@ -3428,7 +3428,7 @@ bool QMetalGraphicsPipeline::build()
if (rhiD->d->shaderCache.count() >= QRhiMetal::MAX_SHADER_CACHE_ENTRIES) {
// Use the simplest strategy: too many cached shaders -> drop them all.
for (QMetalShader &s : rhiD->d->shaderCache)
- s.release();
+ s.destroy();
rhiD->d->shaderCache.clear();
}
switch (shaderStage.type()) {
@@ -3554,15 +3554,15 @@ QMetalComputePipeline::QMetalComputePipeline(QRhiImplementation *rhi)
QMetalComputePipeline::~QMetalComputePipeline()
{
- release();
+ destroy();
delete d;
}
-void QMetalComputePipeline::release()
+void QMetalComputePipeline::destroy()
{
QRHI_RES_RHI(QRhiMetal);
- d->cs.release();
+ d->cs.destroy();
if (!d->ps)
return;
@@ -3573,10 +3573,10 @@ void QMetalComputePipeline::release()
rhiD->unregisterResource(this);
}
-bool QMetalComputePipeline::build()
+bool QMetalComputePipeline::create()
{
if (d->ps)
- release();
+ destroy();
QRHI_RES_RHI(QRhiMetal);
@@ -3608,7 +3608,7 @@ bool QMetalComputePipeline::build()
if (rhiD->d->shaderCache.count() >= QRhiMetal::MAX_SHADER_CACHE_ENTRIES) {
for (QMetalShader &s : rhiD->d->shaderCache)
- s.release();
+ s.destroy();
rhiD->d->shaderCache.clear();
}
rhiD->d->shaderCache.insert(m_shaderStage, d->cs);
@@ -3642,11 +3642,11 @@ QMetalCommandBuffer::QMetalCommandBuffer(QRhiImplementation *rhi)
QMetalCommandBuffer::~QMetalCommandBuffer()
{
- release();
+ destroy();
delete d;
}
-void QMetalCommandBuffer::release()
+void QMetalCommandBuffer::destroy()
{
// nothing to do here, we do not own the MTL cb object
}
@@ -3708,11 +3708,11 @@ QMetalSwapChain::QMetalSwapChain(QRhiImplementation *rhi)
QMetalSwapChain::~QMetalSwapChain()
{
- release();
+ destroy();
delete d;
}
-void QMetalSwapChain::release()
+void QMetalSwapChain::destroy()
{
#ifdef TARGET_IPHONE_SIMULATOR
if (@available(ios 13.0, *)) {
@@ -3799,7 +3799,7 @@ void QMetalSwapChain::chooseFormats()
d->rhiColorFormat = QRhiTexture::BGRA8;
}
-bool QMetalSwapChain::buildOrResize()
+bool QMetalSwapChain::createOrResize()
{
#ifdef TARGET_IPHONE_SIMULATOR
if (@available(ios 13.0, *)) {
@@ -3810,8 +3810,8 @@ bool QMetalSwapChain::buildOrResize()
const bool needsRegistration = !window || window != m_window;
if (window && window != m_window)
- release();
- // else no release(), this is intentional
+ destroy();
+ // else no destroy(), this is intentional
QRHI_RES_RHI(QRhiMetal);
if (needsRegistration)
@@ -3860,7 +3860,7 @@ bool QMetalSwapChain::buildOrResize()
}
// Now set the layer's drawableSize which will stay set to the same value
- // until the next buildOrResize(), thus ensuring atomicity with regards to
+ // until the next createOrResize(), thus ensuring atomicity with regards to
// the drawable size in frames.
CGSize layerSize = d->layer.bounds.size;
layerSize.width *= d->layer.contentsScale;
@@ -3890,7 +3890,7 @@ bool QMetalSwapChain::buildOrResize()
if (m_depthStencil && m_depthStencil->pixelSize() != pixelSize) {
if (m_depthStencil->flags().testFlag(QRhiRenderBuffer::UsedWithSwapChainOnly)) {
m_depthStencil->setPixelSize(pixelSize);
- if (!m_depthStencil->build())
+ if (!m_depthStencil->create())
qWarning("Failed to rebuild swapchain's associated depth-stencil buffer for size %dx%d",
pixelSize.width(), pixelSize.height());
} else {
diff --git a/src/gui/rhi/qrhimetal_p_p.h b/src/gui/rhi/qrhimetal_p_p.h
index 30f5e8b74e..f3292d0fb3 100644
--- a/src/gui/rhi/qrhimetal_p_p.h
+++ b/src/gui/rhi/qrhimetal_p_p.h
@@ -63,8 +63,8 @@ struct QMetalBuffer : public QRhiBuffer
{
QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size);
~QMetalBuffer();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QRhiBuffer::NativeBuffer nativeBuffer() override;
QMetalBufferData *d;
@@ -82,8 +82,8 @@ struct QMetalRenderBuffer : public QRhiRenderBuffer
int sampleCount, QRhiRenderBuffer::Flags flags,
QRhiTexture::Format backingFormatHint);
~QMetalRenderBuffer();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QRhiTexture::Format backingFormat() const override;
QMetalRenderBufferData *d;
@@ -100,12 +100,12 @@ struct QMetalTexture : public QRhiTexture
QMetalTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
int sampleCount, Flags flags);
~QMetalTexture();
- void release() override;
- bool build() override;
- bool buildFrom(NativeTexture src) override;
+ void destroy() override;
+ bool create() override;
+ bool createFrom(NativeTexture src) override;
NativeTexture nativeTexture() override;
- bool prepareBuild(QSize *adjustedSize = nullptr);
+ bool prepareCreate(QSize *adjustedSize = nullptr);
QMetalTextureData *d;
int mipLevelCount = 0;
@@ -124,8 +124,8 @@ struct QMetalSampler : public QRhiSampler
QMetalSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
AddressMode u, AddressMode v, AddressMode w);
~QMetalSampler();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QMetalSamplerData *d;
uint generation = 0;
@@ -138,7 +138,7 @@ struct QMetalRenderPassDescriptor : public QRhiRenderPassDescriptor
{
QMetalRenderPassDescriptor(QRhiImplementation *rhi);
~QMetalRenderPassDescriptor();
- void release() override;
+ void destroy() override;
bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
// there is no MTLRenderPassDescriptor here as one will be created for each pass in beginPass()
@@ -157,7 +157,7 @@ struct QMetalReferenceRenderTarget : public QRhiRenderTarget
{
QMetalReferenceRenderTarget(QRhiImplementation *rhi);
~QMetalReferenceRenderTarget();
- void release() override;
+ void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
@@ -170,14 +170,14 @@ struct QMetalTextureRenderTarget : public QRhiTextureRenderTarget
{
QMetalTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
~QMetalTextureRenderTarget();
- void release() override;
+ void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
int sampleCount() const override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool build() override;
+ bool create() override;
QMetalRenderTargetData *d;
friend class QRhiMetal;
@@ -187,8 +187,8 @@ struct QMetalShaderResourceBindings : public QRhiShaderResourceBindings
{
QMetalShaderResourceBindings(QRhiImplementation *rhi);
~QMetalShaderResourceBindings();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
int maxBinding = -1;
@@ -234,8 +234,8 @@ struct QMetalGraphicsPipeline : public QRhiGraphicsPipeline
{
QMetalGraphicsPipeline(QRhiImplementation *rhi);
~QMetalGraphicsPipeline();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QMetalGraphicsPipelineData *d;
uint generation = 0;
@@ -249,8 +249,8 @@ struct QMetalComputePipeline : public QRhiComputePipeline
{
QMetalComputePipeline(QRhiImplementation *rhi);
~QMetalComputePipeline();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QMetalComputePipelineData *d;
uint generation = 0;
@@ -265,7 +265,7 @@ struct QMetalCommandBuffer : public QRhiCommandBuffer
{
QMetalCommandBuffer(QRhiImplementation *rhi);
~QMetalCommandBuffer();
- void release() override;
+ void destroy() override;
QMetalCommandBufferData *d = nullptr;
QRhiMetalCommandBufferNativeHandles nativeHandlesStruct;
@@ -307,7 +307,7 @@ struct QMetalSwapChain : public QRhiSwapChain
{
QMetalSwapChain(QRhiImplementation *rhi);
~QMetalSwapChain();
- void release() override;
+ void destroy() override;
QRhiCommandBuffer *currentFrameCommandBuffer() override;
QRhiRenderTarget *currentFrameRenderTarget() override;
@@ -315,7 +315,7 @@ struct QMetalSwapChain : public QRhiSwapChain
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool buildOrResize() override;
+ bool createOrResize() override;
void chooseFormats();
diff --git a/src/gui/rhi/qrhinull.cpp b/src/gui/rhi/qrhinull.cpp
index b1ce9b7599..7511859d31 100644
--- a/src/gui/rhi/qrhinull.cpp
+++ b/src/gui/rhi/qrhinull.cpp
@@ -544,10 +544,10 @@ QNullBuffer::QNullBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, i
QNullBuffer::~QNullBuffer()
{
- release();
+ destroy();
}
-void QNullBuffer::release()
+void QNullBuffer::destroy()
{
data.clear();
@@ -555,7 +555,7 @@ void QNullBuffer::release()
QRHI_PROF_F(releaseBuffer(this));
}
-bool QNullBuffer::build()
+bool QNullBuffer::create()
{
data.fill('\0', m_size);
@@ -573,16 +573,16 @@ QNullRenderBuffer::QNullRenderBuffer(QRhiImplementation *rhi, Type type, const Q
QNullRenderBuffer::~QNullRenderBuffer()
{
- release();
+ destroy();
}
-void QNullRenderBuffer::release()
+void QNullRenderBuffer::destroy()
{
QRHI_PROF;
QRHI_PROF_F(releaseRenderBuffer(this));
}
-bool QNullRenderBuffer::build()
+bool QNullRenderBuffer::create()
{
QRHI_PROF;
QRHI_PROF_F(newRenderBuffer(this, false, false, 1));
@@ -602,16 +602,16 @@ QNullTexture::QNullTexture(QRhiImplementation *rhi, Format format, const QSize &
QNullTexture::~QNullTexture()
{
- release();
+ destroy();
}
-void QNullTexture::release()
+void QNullTexture::destroy()
{
QRHI_PROF;
QRHI_PROF_F(releaseTexture(this));
}
-bool QNullTexture::build()
+bool QNullTexture::create()
{
QRHI_RES_RHI(QRhiNull);
const bool isCube = m_flags.testFlag(CubeMap);
@@ -635,7 +635,7 @@ bool QNullTexture::build()
return true;
}
-bool QNullTexture::buildFrom(QRhiTexture::NativeTexture src)
+bool QNullTexture::createFrom(QRhiTexture::NativeTexture src)
{
Q_UNUSED(src)
QRHI_RES_RHI(QRhiNull);
@@ -656,14 +656,14 @@ QNullSampler::QNullSampler(QRhiImplementation *rhi, Filter magFilter, Filter min
QNullSampler::~QNullSampler()
{
- release();
+ destroy();
}
-void QNullSampler::release()
+void QNullSampler::destroy()
{
}
-bool QNullSampler::build()
+bool QNullSampler::create()
{
return true;
}
@@ -675,10 +675,10 @@ QNullRenderPassDescriptor::QNullRenderPassDescriptor(QRhiImplementation *rhi)
QNullRenderPassDescriptor::~QNullRenderPassDescriptor()
{
- release();
+ destroy();
}
-void QNullRenderPassDescriptor::release()
+void QNullRenderPassDescriptor::destroy()
{
}
@@ -696,10 +696,10 @@ QNullReferenceRenderTarget::QNullReferenceRenderTarget(QRhiImplementation *rhi)
QNullReferenceRenderTarget::~QNullReferenceRenderTarget()
{
- release();
+ destroy();
}
-void QNullReferenceRenderTarget::release()
+void QNullReferenceRenderTarget::destroy()
{
}
@@ -728,10 +728,10 @@ QNullTextureRenderTarget::QNullTextureRenderTarget(QRhiImplementation *rhi,
QNullTextureRenderTarget::~QNullTextureRenderTarget()
{
- release();
+ destroy();
}
-void QNullTextureRenderTarget::release()
+void QNullTextureRenderTarget::destroy()
{
}
@@ -740,7 +740,7 @@ QRhiRenderPassDescriptor *QNullTextureRenderTarget::newCompatibleRenderPassDescr
return new QNullRenderPassDescriptor(m_rhi);
}
-bool QNullTextureRenderTarget::build()
+bool QNullTextureRenderTarget::create()
{
QRHI_RES_RHI(QRhiNull);
d.rp = QRHI_RES(QNullRenderPassDescriptor, m_renderPassDesc);
@@ -779,14 +779,14 @@ QNullShaderResourceBindings::QNullShaderResourceBindings(QRhiImplementation *rhi
QNullShaderResourceBindings::~QNullShaderResourceBindings()
{
- release();
+ destroy();
}
-void QNullShaderResourceBindings::release()
+void QNullShaderResourceBindings::destroy()
{
}
-bool QNullShaderResourceBindings::build()
+bool QNullShaderResourceBindings::create()
{
return true;
}
@@ -798,14 +798,14 @@ QNullGraphicsPipeline::QNullGraphicsPipeline(QRhiImplementation *rhi)
QNullGraphicsPipeline::~QNullGraphicsPipeline()
{
- release();
+ destroy();
}
-void QNullGraphicsPipeline::release()
+void QNullGraphicsPipeline::destroy()
{
}
-bool QNullGraphicsPipeline::build()
+bool QNullGraphicsPipeline::create()
{
QRHI_RES_RHI(QRhiNull);
if (!rhiD->sanityCheckGraphicsPipeline(this))
@@ -821,14 +821,14 @@ QNullComputePipeline::QNullComputePipeline(QRhiImplementation *rhi)
QNullComputePipeline::~QNullComputePipeline()
{
- release();
+ destroy();
}
-void QNullComputePipeline::release()
+void QNullComputePipeline::destroy()
{
}
-bool QNullComputePipeline::build()
+bool QNullComputePipeline::create()
{
return true;
}
@@ -840,10 +840,10 @@ QNullCommandBuffer::QNullCommandBuffer(QRhiImplementation *rhi)
QNullCommandBuffer::~QNullCommandBuffer()
{
- release();
+ destroy();
}
-void QNullCommandBuffer::release()
+void QNullCommandBuffer::destroy()
{
// nothing to do here
}
@@ -857,10 +857,10 @@ QNullSwapChain::QNullSwapChain(QRhiImplementation *rhi)
QNullSwapChain::~QNullSwapChain()
{
- release();
+ destroy();
}
-void QNullSwapChain::release()
+void QNullSwapChain::destroy()
{
QRHI_PROF;
QRHI_PROF_F(releaseSwapChain(this));
@@ -886,7 +886,7 @@ QRhiRenderPassDescriptor *QNullSwapChain::newCompatibleRenderPassDescriptor()
return new QNullRenderPassDescriptor(m_rhi);
}
-bool QNullSwapChain::buildOrResize()
+bool QNullSwapChain::createOrResize()
{
m_currentPixelSize = surfacePixelSize();
rt.d.rp = QRHI_RES(QNullRenderPassDescriptor, m_renderPassDesc);
diff --git a/src/gui/rhi/qrhinull_p_p.h b/src/gui/rhi/qrhinull_p_p.h
index 347da4d71c..3fd8373e11 100644
--- a/src/gui/rhi/qrhinull_p_p.h
+++ b/src/gui/rhi/qrhinull_p_p.h
@@ -57,8 +57,8 @@ struct QNullBuffer : public QRhiBuffer
{
QNullBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size);
~QNullBuffer();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QByteArray data;
};
@@ -69,8 +69,8 @@ struct QNullRenderBuffer : public QRhiRenderBuffer
int sampleCount, QRhiRenderBuffer::Flags flags,
QRhiTexture::Format backingFormatHint);
~QNullRenderBuffer();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QRhiTexture::Format backingFormat() const override;
};
@@ -79,9 +79,9 @@ struct QNullTexture : public QRhiTexture
QNullTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
int sampleCount, Flags flags);
~QNullTexture();
- void release() override;
- bool build() override;
- bool buildFrom(NativeTexture src) override;
+ void destroy() override;
+ bool create() override;
+ bool createFrom(NativeTexture src) override;
QImage image[QRhi::MAX_LAYERS][QRhi::MAX_LEVELS];
};
@@ -91,15 +91,15 @@ struct QNullSampler : public QRhiSampler
QNullSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
AddressMode u, AddressMode v, AddressMode w);
~QNullSampler();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
};
struct QNullRenderPassDescriptor : public QRhiRenderPassDescriptor
{
QNullRenderPassDescriptor(QRhiImplementation *rhi);
~QNullRenderPassDescriptor();
- void release() override;
+ void destroy() override;
bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
};
@@ -116,7 +116,7 @@ struct QNullReferenceRenderTarget : public QRhiRenderTarget
{
QNullReferenceRenderTarget(QRhiImplementation *rhi);
~QNullReferenceRenderTarget();
- void release() override;
+ void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
@@ -129,14 +129,14 @@ struct QNullTextureRenderTarget : public QRhiTextureRenderTarget
{
QNullTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
~QNullTextureRenderTarget();
- void release() override;
+ void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
int sampleCount() const override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool build() override;
+ bool create() override;
QNullRenderTargetData d;
};
@@ -145,38 +145,38 @@ struct QNullShaderResourceBindings : public QRhiShaderResourceBindings
{
QNullShaderResourceBindings(QRhiImplementation *rhi);
~QNullShaderResourceBindings();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
};
struct QNullGraphicsPipeline : public QRhiGraphicsPipeline
{
QNullGraphicsPipeline(QRhiImplementation *rhi);
~QNullGraphicsPipeline();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
};
struct QNullComputePipeline : public QRhiComputePipeline
{
QNullComputePipeline(QRhiImplementation *rhi);
~QNullComputePipeline();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
};
struct QNullCommandBuffer : public QRhiCommandBuffer
{
QNullCommandBuffer(QRhiImplementation *rhi);
~QNullCommandBuffer();
- void release() override;
+ void destroy() override;
};
struct QNullSwapChain : public QRhiSwapChain
{
QNullSwapChain(QRhiImplementation *rhi);
~QNullSwapChain();
- void release() override;
+ void destroy() override;
QRhiCommandBuffer *currentFrameCommandBuffer() override;
QRhiRenderTarget *currentFrameRenderTarget() override;
@@ -184,7 +184,7 @@ struct QNullSwapChain : public QRhiSwapChain
QSize surfacePixelSize() override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool buildOrResize() override;
+ bool createOrResize() override;
QNullReferenceRenderTarget rt;
QNullCommandBuffer cb;
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp
index 2158818556..59898d3839 100644
--- a/src/gui/rhi/qrhivulkan.cpp
+++ b/src/gui/rhi/qrhivulkan.cpp
@@ -5158,10 +5158,10 @@ QVkBuffer::QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int s
QVkBuffer::~QVkBuffer()
{
- release();
+ destroy();
}
-void QVkBuffer::release()
+void QVkBuffer::destroy()
{
if (!buffers[0])
return;
@@ -5192,10 +5192,10 @@ void QVkBuffer::release()
rhiD->unregisterResource(this);
}
-bool QVkBuffer::build()
+bool QVkBuffer::create()
{
if (buffers[0])
- release();
+ destroy();
if (m_usage.testFlag(QRhiBuffer::StorageBuffer) && m_type == Dynamic) {
qWarning("StorageBuffer cannot be combined with Dynamic");
@@ -5283,11 +5283,11 @@ QVkRenderBuffer::QVkRenderBuffer(QRhiImplementation *rhi, Type type, const QSize
QVkRenderBuffer::~QVkRenderBuffer()
{
- release();
+ destroy();
delete backingTexture;
}
-void QVkRenderBuffer::release()
+void QVkRenderBuffer::destroy()
{
if (!memory && !backingTexture)
return;
@@ -5307,7 +5307,7 @@ void QVkRenderBuffer::release()
if (backingTexture) {
Q_ASSERT(backingTexture->lastActiveFrameSlot == -1);
backingTexture->lastActiveFrameSlot = e.lastActiveFrameSlot;
- backingTexture->release();
+ backingTexture->destroy();
}
QRHI_RES_RHI(QRhiVulkan);
@@ -5319,10 +5319,10 @@ void QVkRenderBuffer::release()
rhiD->unregisterResource(this);
}
-bool QVkRenderBuffer::build()
+bool QVkRenderBuffer::create()
{
if (memory || backingTexture)
- release();
+ destroy();
if (m_pixelSize.isEmpty())
return false;
@@ -5344,7 +5344,7 @@ bool QVkRenderBuffer::build()
backingTexture->setSampleCount(m_sampleCount);
}
backingTexture->setName(m_objectName);
- if (!backingTexture->build())
+ if (!backingTexture->create())
return false;
vkformat = backingTexture->vkformat;
QRHI_PROF_F(newRenderBuffer(this, false, false, samples));
@@ -5399,10 +5399,10 @@ QVkTexture::QVkTexture(QRhiImplementation *rhi, Format format, const QSize &pixe
QVkTexture::~QVkTexture()
{
- release();
+ destroy();
}
-void QVkTexture::release()
+void QVkTexture::destroy()
{
if (!image)
return;
@@ -5441,10 +5441,10 @@ void QVkTexture::release()
rhiD->unregisterResource(this);
}
-bool QVkTexture::prepareBuild(QSize *adjustedSize)
+bool QVkTexture::prepareCreate(QSize *adjustedSize)
{
if (image)
- release();
+ destroy();
QRHI_RES_RHI(QRhiVulkan);
vkformat = toVkTextureFormat(m_format, m_flags);
@@ -5488,7 +5488,7 @@ bool QVkTexture::prepareBuild(QSize *adjustedSize)
return true;
}
-bool QVkTexture::finishBuild()
+bool QVkTexture::finishCreate()
{
QRHI_RES_RHI(QRhiVulkan);
@@ -5521,10 +5521,10 @@ bool QVkTexture::finishBuild()
return true;
}
-bool QVkTexture::build()
+bool QVkTexture::create()
{
QSize size;
- if (!prepareBuild(&size))
+ if (!prepareCreate(&size))
return false;
const bool isRenderTarget = m_flags.testFlag(QRhiTexture::RenderTarget);
@@ -5573,7 +5573,7 @@ bool QVkTexture::build()
}
imageAlloc = allocation;
- if (!finishBuild())
+ if (!finishCreate())
return false;
rhiD->setObjectName(uint64_t(image), VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, m_objectName);
@@ -5586,18 +5586,18 @@ bool QVkTexture::build()
return true;
}
-bool QVkTexture::buildFrom(QRhiTexture::NativeTexture src)
+bool QVkTexture::createFrom(QRhiTexture::NativeTexture src)
{
VkImage img = VkImage(src.object);
if (img == 0)
return false;
- if (!prepareBuild())
+ if (!prepareCreate())
return false;
image = img;
- if (!finishBuild())
+ if (!finishCreate())
return false;
QRHI_PROF;
@@ -5666,10 +5666,10 @@ QVkSampler::QVkSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilt
QVkSampler::~QVkSampler()
{
- release();
+ destroy();
}
-void QVkSampler::release()
+void QVkSampler::destroy()
{
if (!sampler)
return;
@@ -5686,10 +5686,10 @@ void QVkSampler::release()
rhiD->unregisterResource(this);
}
-bool QVkSampler::build()
+bool QVkSampler::create()
{
if (sampler)
- release();
+ destroy();
VkSamplerCreateInfo samplerInfo;
memset(&samplerInfo, 0, sizeof(samplerInfo));
@@ -5725,10 +5725,10 @@ QVkRenderPassDescriptor::QVkRenderPassDescriptor(QRhiImplementation *rhi)
QVkRenderPassDescriptor::~QVkRenderPassDescriptor()
{
- release();
+ destroy();
}
-void QVkRenderPassDescriptor::release()
+void QVkRenderPassDescriptor::destroy()
{
if (!rp)
return;
@@ -5820,10 +5820,10 @@ QVkReferenceRenderTarget::QVkReferenceRenderTarget(QRhiImplementation *rhi)
QVkReferenceRenderTarget::~QVkReferenceRenderTarget()
{
- release();
+ destroy();
}
-void QVkReferenceRenderTarget::release()
+void QVkReferenceRenderTarget::destroy()
{
// nothing to do here
}
@@ -5856,10 +5856,10 @@ QVkTextureRenderTarget::QVkTextureRenderTarget(QRhiImplementation *rhi,
QVkTextureRenderTarget::~QVkTextureRenderTarget()
{
- release();
+ destroy();
}
-void QVkTextureRenderTarget::release()
+void QVkTextureRenderTarget::destroy()
{
if (!d.fb)
return;
@@ -5886,7 +5886,7 @@ void QVkTextureRenderTarget::release()
QRhiRenderPassDescriptor *QVkTextureRenderTarget::newCompatibleRenderPassDescriptor()
{
- // not yet built so cannot rely on data computed in build()
+ // not yet built so cannot rely on data computed in create()
QRHI_RES_RHI(QRhiVulkan);
QVkRenderPassDescriptor *rp = new QVkRenderPassDescriptor(m_rhi);
@@ -5907,10 +5907,10 @@ QRhiRenderPassDescriptor *QVkTextureRenderTarget::newCompatibleRenderPassDescrip
return rp;
}
-bool QVkTextureRenderTarget::build()
+bool QVkTextureRenderTarget::create()
{
if (d.fb)
- release();
+ destroy();
const bool hasColorAttachments = m_desc.cbeginColorAttachments() != m_desc.cendColorAttachments();
Q_ASSERT(hasColorAttachments || m_desc.depthTexture());
@@ -6067,10 +6067,10 @@ QVkShaderResourceBindings::QVkShaderResourceBindings(QRhiImplementation *rhi)
QVkShaderResourceBindings::~QVkShaderResourceBindings()
{
- release();
+ destroy();
}
-void QVkShaderResourceBindings::release()
+void QVkShaderResourceBindings::destroy()
{
if (!layout)
return;
@@ -6095,10 +6095,10 @@ void QVkShaderResourceBindings::release()
rhiD->unregisterResource(this);
}
-bool QVkShaderResourceBindings::build()
+bool QVkShaderResourceBindings::create()
{
if (layout)
- release();
+ destroy();
for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
descSets[i] = VK_NULL_HANDLE;
@@ -6165,10 +6165,10 @@ QVkGraphicsPipeline::QVkGraphicsPipeline(QRhiImplementation *rhi)
QVkGraphicsPipeline::~QVkGraphicsPipeline()
{
- release();
+ destroy();
}
-void QVkGraphicsPipeline::release()
+void QVkGraphicsPipeline::destroy()
{
if (!pipeline && !layout)
return;
@@ -6189,10 +6189,10 @@ void QVkGraphicsPipeline::release()
rhiD->unregisterResource(this);
}
-bool QVkGraphicsPipeline::build()
+bool QVkGraphicsPipeline::create()
{
if (pipeline)
- release();
+ destroy();
QRHI_RES_RHI(QRhiVulkan);
if (!rhiD->sanityCheckGraphicsPipeline(this))
@@ -6414,10 +6414,10 @@ QVkComputePipeline::QVkComputePipeline(QRhiImplementation *rhi)
QVkComputePipeline::~QVkComputePipeline()
{
- release();
+ destroy();
}
-void QVkComputePipeline::release()
+void QVkComputePipeline::destroy()
{
if (!pipeline && !layout)
return;
@@ -6438,10 +6438,10 @@ void QVkComputePipeline::release()
rhiD->unregisterResource(this);
}
-bool QVkComputePipeline::build()
+bool QVkComputePipeline::create()
{
if (pipeline)
- release();
+ destroy();
QRHI_RES_RHI(QRhiVulkan);
if (!rhiD->ensurePipelineCache())
@@ -6509,10 +6509,10 @@ QVkCommandBuffer::QVkCommandBuffer(QRhiImplementation *rhi)
QVkCommandBuffer::~QVkCommandBuffer()
{
- release();
+ destroy();
}
-void QVkCommandBuffer::release()
+void QVkCommandBuffer::destroy()
{
// nothing to do here, cb is not owned by us
}
@@ -6542,10 +6542,10 @@ QVkSwapChain::QVkSwapChain(QRhiImplementation *rhi)
QVkSwapChain::~QVkSwapChain()
{
- release();
+ destroy();
}
-void QVkSwapChain::release()
+void QVkSwapChain::destroy()
{
if (sc == VK_NULL_HANDLE)
return;
@@ -6592,7 +6592,7 @@ QSize QVkSwapChain::surfacePixelSize()
QRhiRenderPassDescriptor *QVkSwapChain::newCompatibleRenderPassDescriptor()
{
- // not yet built so cannot rely on data computed in buildOrResize()
+ // not yet built so cannot rely on data computed in createOrResize()
if (!ensureSurface()) // make sure sampleCount and colorFormat reflect what was requested
return nullptr;
@@ -6697,18 +6697,18 @@ bool QVkSwapChain::ensureSurface()
return true;
}
-bool QVkSwapChain::buildOrResize()
+bool QVkSwapChain::createOrResize()
{
QRHI_RES_RHI(QRhiVulkan);
const bool needsRegistration = !window || window != m_window;
// Can be called multiple times due to window resizes - that is not the
- // same as a simple release+build (as with other resources). Thus no
- // release() here. See recreateSwapChain().
+ // same as a simple destroy+create (as with other resources). Thus no
+ // destroy() here. See recreateSwapChain().
// except if the window actually changes
if (window && window != m_window)
- release();
+ destroy();
window = m_window;
m_currentPixelSize = surfacePixelSize();
@@ -6729,7 +6729,7 @@ bool QVkSwapChain::buildOrResize()
if (m_depthStencil && m_depthStencil->pixelSize() != pixelSize) {
if (m_depthStencil->flags().testFlag(QRhiRenderBuffer::UsedWithSwapChainOnly)) {
m_depthStencil->setPixelSize(pixelSize);
- if (!m_depthStencil->build())
+ if (!m_depthStencil->create())
qWarning("Failed to rebuild swapchain's associated depth-stencil buffer for size %dx%d",
pixelSize.width(), pixelSize.height());
} else {
diff --git a/src/gui/rhi/qrhivulkan_p_p.h b/src/gui/rhi/qrhivulkan_p_p.h
index 1b2e4d0ebb..84caa1a627 100644
--- a/src/gui/rhi/qrhivulkan_p_p.h
+++ b/src/gui/rhi/qrhivulkan_p_p.h
@@ -74,8 +74,8 @@ struct QVkBuffer : public QRhiBuffer
{
QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size);
~QVkBuffer();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QRhiBuffer::NativeBuffer nativeBuffer() override;
VkBuffer buffers[QVK_FRAMES_IN_FLIGHT];
@@ -101,8 +101,8 @@ struct QVkRenderBuffer : public QRhiRenderBuffer
int sampleCount, Flags flags,
QRhiTexture::Format backingFormatHint);
~QVkRenderBuffer();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QRhiTexture::Format backingFormat() const override;
VkDeviceMemory memory = VK_NULL_HANDLE;
@@ -120,14 +120,14 @@ struct QVkTexture : public QRhiTexture
QVkTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize,
int sampleCount, Flags flags);
~QVkTexture();
- void release() override;
- bool build() override;
- bool buildFrom(NativeTexture src) override;
+ void destroy() override;
+ bool create() override;
+ bool createFrom(NativeTexture src) override;
NativeTexture nativeTexture() override;
void setNativeLayout(int layout) override;
- bool prepareBuild(QSize *adjustedSize = nullptr);
- bool finishBuild();
+ bool prepareCreate(QSize *adjustedSize = nullptr);
+ bool finishCreate();
VkImageView imageViewForLevel(int level);
VkImage image = VK_NULL_HANDLE;
@@ -159,8 +159,8 @@ struct QVkSampler : public QRhiSampler
QVkSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
AddressMode u, AddressMode v, AddressMode w);
~QVkSampler();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
VkSampler sampler = VK_NULL_HANDLE;
int lastActiveFrameSlot = -1;
@@ -172,7 +172,7 @@ struct QVkRenderPassDescriptor : public QRhiRenderPassDescriptor
{
QVkRenderPassDescriptor(QRhiImplementation *rhi);
~QVkRenderPassDescriptor();
- void release() override;
+ void destroy() override;
bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
const QRhiNativeHandles *nativeHandles() override;
@@ -204,7 +204,7 @@ struct QVkReferenceRenderTarget : public QRhiRenderTarget
{
QVkReferenceRenderTarget(QRhiImplementation *rhi);
~QVkReferenceRenderTarget();
- void release() override;
+ void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
@@ -217,14 +217,14 @@ struct QVkTextureRenderTarget : public QRhiTextureRenderTarget
{
QVkTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
~QVkTextureRenderTarget();
- void release() override;
+ void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
int sampleCount() const override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool build() override;
+ bool create() override;
QVkRenderTargetData d;
VkImageView rtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS];
@@ -237,8 +237,8 @@ struct QVkShaderResourceBindings : public QRhiShaderResourceBindings
{
QVkShaderResourceBindings(QRhiImplementation *rhi);
~QVkShaderResourceBindings();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
int poolIndex = -1;
@@ -290,8 +290,8 @@ struct QVkGraphicsPipeline : public QRhiGraphicsPipeline
{
QVkGraphicsPipeline(QRhiImplementation *rhi);
~QVkGraphicsPipeline();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
VkPipelineLayout layout = VK_NULL_HANDLE;
VkPipeline pipeline = VK_NULL_HANDLE;
@@ -304,8 +304,8 @@ struct QVkComputePipeline : public QRhiComputePipeline
{
QVkComputePipeline(QRhiImplementation *rhi);
~QVkComputePipeline();
- void release() override;
- bool build() override;
+ void destroy() override;
+ bool create() override;
VkPipelineLayout layout = VK_NULL_HANDLE;
VkPipeline pipeline = VK_NULL_HANDLE;
@@ -318,7 +318,7 @@ struct QVkCommandBuffer : public QRhiCommandBuffer
{
QVkCommandBuffer(QRhiImplementation *rhi);
~QVkCommandBuffer();
- void release() override;
+ void destroy() override;
const QRhiNativeHandles *nativeHandles();
@@ -576,7 +576,7 @@ struct QVkSwapChain : public QRhiSwapChain
{
QVkSwapChain(QRhiImplementation *rhi);
~QVkSwapChain();
- void release() override;
+ void destroy() override;
QRhiCommandBuffer *currentFrameCommandBuffer() override;
QRhiRenderTarget *currentFrameRenderTarget() override;
@@ -584,7 +584,7 @@ struct QVkSwapChain : public QRhiSwapChain
QSize surfacePixelSize() override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
- bool buildOrResize() override;
+ bool createOrResize() override;
bool ensureSurface();