From 56977990e04efa051b1ebd4ce9274d6b69c7bd0c Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 27 May 2020 17:44:49 +0200 Subject: 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 --- tests/auto/gui/rhi/qrhi/tst_qrhi.cpp | 228 +++++++++++++++++------------------ 1 file changed, 114 insertions(+), 114 deletions(-) (limited to 'tests/auto/gui/rhi') diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp index 41057a15ab..f1e11c4b23 100644 --- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp +++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp @@ -434,12 +434,12 @@ void tst_QRhi::nativeHandles() QVERIFY(!mtlHandles->encoder); QScopedPointer tex(rhi->newTexture(QRhiTexture::RGBA8, QSize(512, 512), 1, QRhiTexture::RenderTarget)); - QVERIFY(tex->build()); + QVERIFY(tex->create()); QScopedPointer rt(rhi->newTextureRenderTarget({ tex.data() })); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); QVERIFY(rpDesc); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); cb->beginPass(rt.data(), Qt::red, { 1.0f, 0 }); QVERIFY(static_cast(cb->nativeHandles())->encoder); cb->endPass(); @@ -456,12 +456,12 @@ void tst_QRhi::nativeHandles() // QRhiRenderPassDescriptor::nativeHandles() { QScopedPointer tex(rhi->newTexture(QRhiTexture::RGBA8, QSize(512, 512), 1, QRhiTexture::RenderTarget)); - QVERIFY(tex->build()); + QVERIFY(tex->create()); QScopedPointer rt(rhi->newTextureRenderTarget({ tex.data() })); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); QVERIFY(rpDesc); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); const QRhiNativeHandles *rpHandles = rpDesc->nativeHandles(); switch (impl) { @@ -509,7 +509,7 @@ void tst_QRhi::nativeTexture() QSKIP("QRhi could not be created, skipping testing native texture"); QScopedPointer tex(rhi->newTexture(QRhiTexture::RGBA8, QSize(512, 256))); - QVERIFY(tex->build()); + QVERIFY(tex->create()); const QRhiTexture::NativeTexture nativeTex = tex->nativeTexture(); @@ -573,7 +573,7 @@ void tst_QRhi::nativeBuffer() const QRhiBuffer::UsageFlags usages[3] = { QRhiBuffer::VertexBuffer, QRhiBuffer::IndexBuffer, QRhiBuffer::UniformBuffer }; for (int typeUsageIdx = 0; typeUsageIdx < 3; ++typeUsageIdx) { QScopedPointer buf(rhi->newBuffer(types[typeUsageIdx], usages[typeUsageIdx], 256)); - QVERIFY(buf->build()); + QVERIFY(buf->create()); const QRhiBuffer::NativeBuffer nativeBuf = buf->nativeBuffer(); QVERIFY(nativeBuf.slotCount <= rhi->resourceLimit(QRhi::FramesInFlight)); @@ -673,7 +673,7 @@ void tst_QRhi::resourceUpdateBatchBuffer() // dynamic buffer, updates, readback { QScopedPointer dynamicBuffer(rhi->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, bufferSize)); - QVERIFY(dynamicBuffer->build()); + QVERIFY(dynamicBuffer->create()); QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch(); QVERIFY(batch); @@ -700,7 +700,7 @@ void tst_QRhi::resourceUpdateBatchBuffer() // static buffer, updates, readback { QScopedPointer dynamicBuffer(rhi->newBuffer(QRhiBuffer::Static, QRhiBuffer::VertexBuffer, bufferSize)); - QVERIFY(dynamicBuffer->build()); + QVERIFY(dynamicBuffer->create()); QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch(); QVERIFY(batch); @@ -786,7 +786,7 @@ void tst_QRhi::resourceUpdateBatchRGBATextureUpload() { QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, image.size(), 1, QRhiTexture::UsedAsTransferSource)); - QVERIFY(texture->build()); + QVERIFY(texture->create()); QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch(); batch->uploadTexture(texture.data(), image); @@ -813,7 +813,7 @@ void tst_QRhi::resourceUpdateBatchRGBATextureUpload() { QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, image.size(), 1, QRhiTexture::UsedAsTransferSource)); - QVERIFY(texture->build()); + QVERIFY(texture->create()); QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch(); @@ -845,7 +845,7 @@ void tst_QRhi::resourceUpdateBatchRGBATextureUpload() const QSize fullSize(copySize.width() + gap, copySize.height() + gap); QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, fullSize, 1, QRhiTexture::UsedAsTransferSource)); - QVERIFY(texture->build()); + QVERIFY(texture->create()); QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch(); @@ -894,7 +894,7 @@ void tst_QRhi::resourceUpdateBatchRGBATextureUpload() const QSize fullSize(copySize.width() + gap, copySize.height() + gap); QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, fullSize, 1, QRhiTexture::UsedAsTransferSource)); - QVERIFY(texture->build()); + QVERIFY(texture->create()); QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch(); @@ -945,7 +945,7 @@ void tst_QRhi::resourceUpdateBatchRGBATextureUpload() QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, inputImage.size(), 1, QRhiTexture::UsedAsTransferSource)); - QVERIFY(texture->build()); + QVERIFY(texture->create()); QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch(); batch->uploadTexture(texture.data(), inputImage); @@ -989,19 +989,19 @@ void tst_QRhi::resourceUpdateBatchRGBATextureCopy() QScopedPointer redTexture(rhi->newTexture(QRhiTexture::RGBA8, red.size(), 1, QRhiTexture::UsedAsTransferSource)); - QVERIFY(redTexture->build()); + QVERIFY(redTexture->create()); batch->uploadTexture(redTexture.data(), red); QScopedPointer greenTexture(rhi->newTexture(QRhiTexture::RGBA8, green.size(), 1, QRhiTexture::UsedAsTransferSource)); - QVERIFY(greenTexture->build()); + QVERIFY(greenTexture->create()); batch->uploadTexture(greenTexture.data(), green); // 1. simple copy red -> texture; 2. subimage copy green -> texture; 3. partial subimage copy green -> texture { QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, red.size(), 1, QRhiTexture::UsedAsTransferSource)); - QVERIFY(texture->build()); + QVERIFY(texture->create()); // 1. batch->copyTexture(texture.data(), redTexture.data()); @@ -1087,7 +1087,7 @@ void tst_QRhi::resourceUpdateBatchRGBATextureMip() | QRhiTexture::MipMapped | QRhiTexture::UsedWithGenerateMips; QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, red.size(), 1, textureFlags)); - QVERIFY(texture->build()); + QVERIFY(texture->create()); QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch(); batch->uploadTexture(texture.data(), red); @@ -1154,18 +1154,18 @@ void tst_QRhi::invalidPipeline() QSKIP("QRhi could not be created, skipping testing empty shader"); QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, QSize(256, 256), 1, QRhiTexture::RenderTarget)); - QVERIFY(texture->build()); + QVERIFY(texture->create()); QScopedPointer rt(rhi->newTextureRenderTarget({ texture.data() })); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); QRhiCommandBuffer *cb = nullptr; QVERIFY(rhi->beginOffscreenFrame(&cb) == QRhi::FrameOpSuccess); QVERIFY(cb); QScopedPointer srb(rhi->newShaderResourceBindings()); - QVERIFY(srb->build()); + QVERIFY(srb->create()); QRhiVertexInputLayout inputLayout; inputLayout.setBindings({ { 2 * sizeof(float) } }); @@ -1176,7 +1176,7 @@ void tst_QRhi::invalidPipeline() pipeline->setVertexInputLayout(inputLayout); pipeline->setShaderResourceBindings(srb.data()); pipeline->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(!pipeline->build()); + QVERIFY(!pipeline->create()); QShader vs; QShader fs; @@ -1187,7 +1187,7 @@ void tst_QRhi::invalidPipeline() pipeline->setVertexInputLayout(inputLayout); pipeline->setShaderResourceBindings(srb.data()); pipeline->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(!pipeline->build()); + QVERIFY(!pipeline->create()); vs = loadShader(":/data/simple.vert.qsb"); QVERIFY(vs.isValid()); @@ -1200,28 +1200,28 @@ void tst_QRhi::invalidPipeline() pipeline->setVertexInputLayout(inputLayout); pipeline->setShaderResourceBindings(srb.data()); pipeline->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(!pipeline->build()); + QVERIFY(!pipeline->create()); // no vertex inputs pipeline.reset(rhi->newGraphicsPipeline()); pipeline->setShaderStages({ { QRhiShaderStage::Vertex, vs }, { QRhiShaderStage::Fragment, fs } }); pipeline->setRenderPassDescriptor(rpDesc.data()); pipeline->setShaderResourceBindings(srb.data()); - QVERIFY(!pipeline->build()); + QVERIFY(!pipeline->create()); // no renderpass descriptor pipeline.reset(rhi->newGraphicsPipeline()); pipeline->setShaderStages({ { QRhiShaderStage::Vertex, vs }, { QRhiShaderStage::Fragment, fs } }); pipeline->setVertexInputLayout(inputLayout); pipeline->setShaderResourceBindings(srb.data()); - QVERIFY(!pipeline->build()); + QVERIFY(!pipeline->create()); // no shader resource bindings pipeline.reset(rhi->newGraphicsPipeline()); pipeline->setShaderStages({ { QRhiShaderStage::Vertex, vs }, { QRhiShaderStage::Fragment, fs } }); pipeline->setVertexInputLayout(inputLayout); pipeline->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(!pipeline->build()); + QVERIFY(!pipeline->create()); // correct pipeline.reset(rhi->newGraphicsPipeline()); @@ -1229,7 +1229,7 @@ void tst_QRhi::invalidPipeline() pipeline->setVertexInputLayout(inputLayout); pipeline->setRenderPassDescriptor(rpDesc.data()); pipeline->setShaderResourceBindings(srb.data()); - QVERIFY(pipeline->build()); + QVERIFY(pipeline->create()); } void tst_QRhi::renderToTextureSimple_data() @@ -1249,12 +1249,12 @@ void tst_QRhi::renderToTextureSimple() const QSize outputSize(1920, 1080); QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, outputSize, 1, QRhiTexture::RenderTarget | QRhiTexture::UsedAsTransferSource)); - QVERIFY(texture->build()); + QVERIFY(texture->create()); QScopedPointer rt(rhi->newTextureRenderTarget({ texture.data() })); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); QRhiCommandBuffer *cb = nullptr; QVERIFY(rhi->beginOffscreenFrame(&cb) == QRhi::FrameOpSuccess); @@ -1268,11 +1268,11 @@ void tst_QRhi::renderToTextureSimple() 0.0f, 1.0f }; QScopedPointer vbuf(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertices))); - QVERIFY(vbuf->build()); + QVERIFY(vbuf->create()); updates->uploadStaticBuffer(vbuf.data(), vertices); QScopedPointer srb(rhi->newShaderResourceBindings()); - QVERIFY(srb->build()); + QVERIFY(srb->create()); QScopedPointer pipeline(rhi->newGraphicsPipeline()); QShader vs = loadShader(":/data/simple.vert.qsb"); @@ -1287,7 +1287,7 @@ void tst_QRhi::renderToTextureSimple() pipeline->setShaderResourceBindings(srb.data()); pipeline->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(pipeline->build()); + QVERIFY(pipeline->create()); cb->beginPass(rt.data(), Qt::blue, { 1.0f, 0 }, updates); cb->setGraphicsPipeline(pipeline.data()); @@ -1369,7 +1369,7 @@ void tst_QRhi::renderToTextureMip() QRhiTexture::RenderTarget | QRhiTexture::UsedAsTransferSource | QRhiTexture::MipMapped)); - QVERIFY(texture->build()); + QVERIFY(texture->create()); QRhiColorAttachment colorAtt(texture.data()); colorAtt.setLevel(LEVEL); @@ -1377,7 +1377,7 @@ void tst_QRhi::renderToTextureMip() QScopedPointer rt(rhi->newTextureRenderTarget(rtDesc)); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); QCOMPARE(rt->pixelSize(), rhi->sizeForMipLevel(LEVEL, baseLevelSize)); const QSize mipSize(baseLevelSize.width() >> LEVEL, baseLevelSize.height() >> LEVEL); @@ -1395,11 +1395,11 @@ void tst_QRhi::renderToTextureMip() 0.0f, 1.0f }; QScopedPointer vbuf(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertices))); - QVERIFY(vbuf->build()); + QVERIFY(vbuf->create()); updates->uploadStaticBuffer(vbuf.data(), vertices); QScopedPointer srb(rhi->newShaderResourceBindings()); - QVERIFY(srb->build()); + QVERIFY(srb->create()); QScopedPointer pipeline(rhi->newGraphicsPipeline()); QShader vs = loadShader(":/data/simple.vert.qsb"); @@ -1414,7 +1414,7 @@ void tst_QRhi::renderToTextureMip() pipeline->setShaderResourceBindings(srb.data()); pipeline->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(pipeline->build()); + QVERIFY(pipeline->create()); cb->beginPass(rt.data(), Qt::blue, { 1.0f, 0 }, updates); cb->setGraphicsPipeline(pipeline.data()); @@ -1489,7 +1489,7 @@ void tst_QRhi::renderToTextureCubemapFace() QRhiTexture::RenderTarget | QRhiTexture::UsedAsTransferSource | QRhiTexture::CubeMap)); // will be a cubemap, so 6 layers - QVERIFY(texture->build()); + QVERIFY(texture->create()); const int LAYER = 1; // render into the layer for face -X const int BAD_LAYER = 2; // +Y @@ -1500,7 +1500,7 @@ void tst_QRhi::renderToTextureCubemapFace() QScopedPointer rt(rhi->newTextureRenderTarget(rtDesc)); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); QCOMPARE(rt->pixelSize(), texture->pixelSize()); QCOMPARE(rt->pixelSize(), outputSize); @@ -1517,11 +1517,11 @@ void tst_QRhi::renderToTextureCubemapFace() 0.0f, 1.0f }; QScopedPointer vbuf(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertices))); - QVERIFY(vbuf->build()); + QVERIFY(vbuf->create()); updates->uploadStaticBuffer(vbuf.data(), vertices); QScopedPointer srb(rhi->newShaderResourceBindings()); - QVERIFY(srb->build()); + QVERIFY(srb->create()); QScopedPointer pipeline(rhi->newGraphicsPipeline()); QShader vs = loadShader(":/data/simple.vert.qsb"); @@ -1536,7 +1536,7 @@ void tst_QRhi::renderToTextureCubemapFace() pipeline->setShaderResourceBindings(srb.data()); pipeline->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(pipeline->build()); + QVERIFY(pipeline->create()); cb->beginPass(rt.data(), Qt::blue, { 1.0f, 0 }, updates); cb->setGraphicsPipeline(pipeline.data()); @@ -1627,12 +1627,12 @@ void tst_QRhi::renderToTextureTexturedQuad() QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, inputImage.size(), 1, QRhiTexture::RenderTarget | QRhiTexture::UsedAsTransferSource)); - QVERIFY(texture->build()); + QVERIFY(texture->create()); QScopedPointer rt(rhi->newTextureRenderTarget({ texture.data() })); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); QRhiCommandBuffer *cb = nullptr; QVERIFY(rhi->beginOffscreenFrame(&cb) == QRhi::FrameOpSuccess); @@ -1647,22 +1647,22 @@ void tst_QRhi::renderToTextureTexturedQuad() 1.0f, 1.0f, 1.0f, 1.0f }; QScopedPointer vbuf(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(verticesUvs))); - QVERIFY(vbuf->build()); + QVERIFY(vbuf->create()); updates->uploadStaticBuffer(vbuf.data(), verticesUvs); QScopedPointer inputTexture(rhi->newTexture(QRhiTexture::RGBA8, inputImage.size())); - QVERIFY(inputTexture->build()); + QVERIFY(inputTexture->create()); updates->uploadTexture(inputTexture.data(), inputImage); QScopedPointer sampler(rhi->newSampler(QRhiSampler::Nearest, QRhiSampler::Nearest, QRhiSampler::None, QRhiSampler::ClampToEdge, QRhiSampler::ClampToEdge)); - QVERIFY(sampler->build()); + QVERIFY(sampler->create()); QScopedPointer srb(rhi->newShaderResourceBindings()); srb->setBindings({ QRhiShaderResourceBinding::sampledTexture(0, QRhiShaderResourceBinding::FragmentStage, inputTexture.data(), sampler.data()) }); - QVERIFY(srb->build()); + QVERIFY(srb->create()); QScopedPointer pipeline(rhi->newGraphicsPipeline()); pipeline->setTopology(QRhiGraphicsPipeline::TriangleStrip); @@ -1681,7 +1681,7 @@ void tst_QRhi::renderToTextureTexturedQuad() pipeline->setShaderResourceBindings(srb.data()); pipeline->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(pipeline->build()); + QVERIFY(pipeline->create()); cb->beginPass(rt.data(), Qt::black, { 1.0f, 0 }, updates); cb->setGraphicsPipeline(pipeline.data()); @@ -1756,12 +1756,12 @@ void tst_QRhi::renderToTextureArrayOfTexturedQuad() QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, inputImage.size(), 1, QRhiTexture::RenderTarget | QRhiTexture::UsedAsTransferSource)); - QVERIFY(texture->build()); + QVERIFY(texture->create()); QScopedPointer rt(rhi->newTextureRenderTarget({ texture.data() })); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); QRhiCommandBuffer *cb = nullptr; QVERIFY(rhi->beginOffscreenFrame(&cb) == QRhi::FrameOpSuccess); @@ -1776,33 +1776,33 @@ void tst_QRhi::renderToTextureArrayOfTexturedQuad() 1.0f, 1.0f, 1.0f, 1.0f }; QScopedPointer vbuf(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(verticesUvs))); - QVERIFY(vbuf->build()); + QVERIFY(vbuf->create()); updates->uploadStaticBuffer(vbuf.data(), verticesUvs); // In this test we pass 3 textures (and samplers) to the fragment shader in // form of an array of combined image samplers. QScopedPointer inputTexture(rhi->newTexture(QRhiTexture::RGBA8, inputImage.size())); - QVERIFY(inputTexture->build()); + QVERIFY(inputTexture->create()); updates->uploadTexture(inputTexture.data(), inputImage); QImage redImage(inputImage.size(), QImage::Format_RGBA8888); redImage.fill(Qt::red); QScopedPointer redTexture(rhi->newTexture(QRhiTexture::RGBA8, inputImage.size())); - QVERIFY(redTexture->build()); + QVERIFY(redTexture->create()); updates->uploadTexture(redTexture.data(), redImage); QImage greenImage(inputImage.size(), QImage::Format_RGBA8888); greenImage.fill(Qt::green); QScopedPointer greenTexture(rhi->newTexture(QRhiTexture::RGBA8, inputImage.size())); - QVERIFY(greenTexture->build()); + QVERIFY(greenTexture->create()); updates->uploadTexture(greenTexture.data(), greenImage); QScopedPointer sampler(rhi->newSampler(QRhiSampler::Nearest, QRhiSampler::Nearest, QRhiSampler::None, QRhiSampler::ClampToEdge, QRhiSampler::ClampToEdge)); - QVERIFY(sampler->build()); + QVERIFY(sampler->create()); QScopedPointer srb(rhi->newShaderResourceBindings()); QRhiShaderResourceBinding::TextureAndSampler texSamplers[3] = { @@ -1813,7 +1813,7 @@ void tst_QRhi::renderToTextureArrayOfTexturedQuad() srb->setBindings({ QRhiShaderResourceBinding::sampledTextures(0, QRhiShaderResourceBinding::FragmentStage, 3, texSamplers) }); - QVERIFY(srb->build()); + QVERIFY(srb->create()); QScopedPointer pipeline(rhi->newGraphicsPipeline()); pipeline->setTopology(QRhiGraphicsPipeline::TriangleStrip); @@ -1832,7 +1832,7 @@ void tst_QRhi::renderToTextureArrayOfTexturedQuad() pipeline->setShaderResourceBindings(srb.data()); pipeline->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(pipeline->build()); + QVERIFY(pipeline->create()); cb->beginPass(rt.data(), Qt::black, { 1.0f, 0 }, updates); cb->setGraphicsPipeline(pipeline.data()); @@ -1897,12 +1897,12 @@ void tst_QRhi::renderToTextureTexturedQuadAndUniformBuffer() QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, inputImage.size(), 1, QRhiTexture::RenderTarget | QRhiTexture::UsedAsTransferSource)); - QVERIFY(texture->build()); + QVERIFY(texture->create()); QScopedPointer rt(rhi->newTextureRenderTarget({ texture.data() })); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); QRhiCommandBuffer *cb = nullptr; QVERIFY(rhi->beginOffscreenFrame(&cb) == QRhi::FrameOpSuccess); @@ -1917,7 +1917,7 @@ void tst_QRhi::renderToTextureTexturedQuadAndUniformBuffer() 1.0f, 1.0f, 1.0f, 1.0f }; QScopedPointer vbuf(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(verticesUvs))); - QVERIFY(vbuf->build()); + QVERIFY(vbuf->create()); updates->uploadStaticBuffer(vbuf.data(), verticesUvs); // There will be two renderpasses. One renders with no transformation and @@ -1929,7 +1929,7 @@ void tst_QRhi::renderToTextureTexturedQuadAndUniformBuffer() const int UBUF_SIZE = secondUbufOffset + UNIFORM_BLOCK_SIZE; QScopedPointer ubuf(rhi->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, UBUF_SIZE)); - QVERIFY(ubuf->build()); + QVERIFY(ubuf->create()); QMatrix4x4 matrix; updates->updateDynamicBuffer(ubuf.data(), 0, 64, matrix.constData()); @@ -1942,12 +1942,12 @@ void tst_QRhi::renderToTextureTexturedQuadAndUniformBuffer() updates->updateDynamicBuffer(ubuf.data(), secondUbufOffset + 64, 4, &opacity); QScopedPointer inputTexture(rhi->newTexture(QRhiTexture::RGBA8, inputImage.size())); - QVERIFY(inputTexture->build()); + QVERIFY(inputTexture->create()); updates->uploadTexture(inputTexture.data(), inputImage); QScopedPointer sampler(rhi->newSampler(QRhiSampler::Nearest, QRhiSampler::Nearest, QRhiSampler::None, QRhiSampler::ClampToEdge, QRhiSampler::ClampToEdge)); - QVERIFY(sampler->build()); + QVERIFY(sampler->create()); const QRhiShaderResourceBinding::StageFlags commonVisibility = QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage; QScopedPointer srb0(rhi->newShaderResourceBindings()); @@ -1955,14 +1955,14 @@ void tst_QRhi::renderToTextureTexturedQuadAndUniformBuffer() QRhiShaderResourceBinding::uniformBuffer(0, commonVisibility, ubuf.data(), 0, UNIFORM_BLOCK_SIZE), QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, inputTexture.data(), sampler.data()) }); - QVERIFY(srb0->build()); + QVERIFY(srb0->create()); QScopedPointer srb1(rhi->newShaderResourceBindings()); srb1->setBindings({ QRhiShaderResourceBinding::uniformBuffer(0, commonVisibility, ubuf.data(), secondUbufOffset, UNIFORM_BLOCK_SIZE), QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, inputTexture.data(), sampler.data()) }); - QVERIFY(srb1->build()); + QVERIFY(srb1->create()); QVERIFY(srb1->isLayoutCompatible(srb0.data())); // hence no need for a second pipeline QScopedPointer pipeline(rhi->newGraphicsPipeline()); @@ -1990,7 +1990,7 @@ void tst_QRhi::renderToTextureTexturedQuadAndUniformBuffer() pipeline->setShaderResourceBindings(srb0.data()); pipeline->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(pipeline->build()); + QVERIFY(pipeline->create()); cb->beginPass(rt.data(), Qt::black, { 1.0f, 0 }, updates); cb->setGraphicsPipeline(pipeline.data()); @@ -2137,7 +2137,7 @@ void tst_QRhi::renderToWindowSimple() swapChain->setFlags(QRhiSwapChain::UsedAsTransferSource); QScopedPointer rpDesc(swapChain->newCompatibleRenderPassDescriptor()); swapChain->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(swapChain->buildOrResize()); + QVERIFY(swapChain->createOrResize()); QRhiResourceUpdateBatch *updates = rhi->nextResourceUpdateBatch(); @@ -2147,11 +2147,11 @@ void tst_QRhi::renderToWindowSimple() 0.0f, 1.0f }; QScopedPointer vbuf(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertices))); - QVERIFY(vbuf->build()); + QVERIFY(vbuf->create()); updates->uploadStaticBuffer(vbuf.data(), vertices); QScopedPointer srb(rhi->newShaderResourceBindings()); - QVERIFY(srb->build()); + QVERIFY(srb->create()); QScopedPointer pipeline(rhi->newGraphicsPipeline()); QShader vs = loadShader(":/data/simple.vert.qsb"); @@ -2166,7 +2166,7 @@ void tst_QRhi::renderToWindowSimple() pipeline->setShaderResourceBindings(srb.data()); pipeline->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(pipeline->build()); + QVERIFY(pipeline->create()); const int asyncReadbackFrames = rhi->resourceLimit(QRhi::MaxAsyncReadbackFrames); // one frame issues the readback, then we do MaxAsyncReadbackFrames more to ensure the readback completes @@ -2277,10 +2277,10 @@ void tst_QRhi::finishWithinSwapchainFrame() swapChain->setFlags(QRhiSwapChain::UsedAsTransferSource); QScopedPointer rpDesc(swapChain->newCompatibleRenderPassDescriptor()); swapChain->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(swapChain->buildOrResize()); + QVERIFY(swapChain->createOrResize()); QScopedPointer srb(rhi->newShaderResourceBindings()); - QVERIFY(srb->build()); + QVERIFY(srb->create()); QScopedPointer pipeline(rhi->newGraphicsPipeline()); QShader vs = loadShader(":/data/simple.vert.qsb"); @@ -2294,7 +2294,7 @@ void tst_QRhi::finishWithinSwapchainFrame() pipeline->setVertexInputLayout(inputLayout); pipeline->setShaderResourceBindings(srb.data()); pipeline->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(pipeline->build()); + QVERIFY(pipeline->create()); static const float vertices[] = { -1.0f, -1.0f, @@ -2302,7 +2302,7 @@ void tst_QRhi::finishWithinSwapchainFrame() 0.0f, 1.0f }; QScopedPointer vbuf(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertices))); - QVERIFY(vbuf->build()); + QVERIFY(vbuf->create()); // exercise begin/endExternal() just a little bit, hence ExternalContentsInPass QVERIFY(rhi->beginFrame(swapChain.data(), QRhi::ExternalContentsInPass) == QRhi::FrameOpSuccess); @@ -2373,25 +2373,25 @@ void tst_QRhi::srbLayoutCompatibility() QSKIP("QRhi could not be created, skipping testing texture resource updates"); QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, QSize(512, 512))); - QVERIFY(texture->build()); + QVERIFY(texture->create()); QScopedPointer sampler(rhi->newSampler(QRhiSampler::Nearest, QRhiSampler::Nearest, QRhiSampler::None, QRhiSampler::ClampToEdge, QRhiSampler::ClampToEdge)); - QVERIFY(sampler->build()); + QVERIFY(sampler->create()); QScopedPointer otherSampler(rhi->newSampler(QRhiSampler::Nearest, QRhiSampler::Nearest, QRhiSampler::None, QRhiSampler::ClampToEdge, QRhiSampler::ClampToEdge)); - QVERIFY(otherSampler->build()); + QVERIFY(otherSampler->create()); QScopedPointer buf(rhi->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, 1024)); - QVERIFY(buf->build()); + QVERIFY(buf->create()); QScopedPointer otherBuf(rhi->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, 256)); - QVERIFY(otherBuf->build()); + QVERIFY(otherBuf->create()); // empty (compatible) { QScopedPointer srb1(rhi->newShaderResourceBindings()); - QVERIFY(srb1->build()); + QVERIFY(srb1->create()); QScopedPointer srb2(rhi->newShaderResourceBindings()); - QVERIFY(srb2->build()); + QVERIFY(srb2->create()); QVERIFY(srb1->isLayoutCompatible(srb2.data())); QVERIFY(srb2->isLayoutCompatible(srb1.data())); @@ -2400,13 +2400,13 @@ void tst_QRhi::srbLayoutCompatibility() // different count (not compatible) { QScopedPointer srb1(rhi->newShaderResourceBindings()); - QVERIFY(srb1->build()); + QVERIFY(srb1->create()); QScopedPointer srb2(rhi->newShaderResourceBindings()); srb2->setBindings({ QRhiShaderResourceBinding::sampledTexture(0, QRhiShaderResourceBinding::FragmentStage, texture.data(), sampler.data()) }); - QVERIFY(srb2->build()); + QVERIFY(srb2->create()); QVERIFY(!srb1->isLayoutCompatible(srb2.data())); QVERIFY(!srb2->isLayoutCompatible(srb1.data())); @@ -2419,14 +2419,14 @@ void tst_QRhi::srbLayoutCompatibility() QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage, buf.data()), QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, texture.data(), sampler.data()) }); - QVERIFY(srb1->build()); + QVERIFY(srb1->create()); QScopedPointer srb2(rhi->newShaderResourceBindings()); srb2->setBindings({ QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage, buf.data()), QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, texture.data(), sampler.data()) }); - QVERIFY(srb2->build()); + QVERIFY(srb2->create()); QVERIFY(srb1->isLayoutCompatible(srb2.data())); QVERIFY(srb2->isLayoutCompatible(srb1.data())); @@ -2438,13 +2438,13 @@ void tst_QRhi::srbLayoutCompatibility() srb1->setBindings({ QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, buf.data()), }); - QVERIFY(srb1->build()); + QVERIFY(srb1->create()); QScopedPointer srb2(rhi->newShaderResourceBindings()); srb2->setBindings({ QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage, buf.data()), }); - QVERIFY(srb2->build()); + QVERIFY(srb2->create()); QVERIFY(!srb1->isLayoutCompatible(srb2.data())); QVERIFY(!srb2->isLayoutCompatible(srb1.data())); @@ -2456,13 +2456,13 @@ void tst_QRhi::srbLayoutCompatibility() srb1->setBindings({ QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage, buf.data()), }); - QVERIFY(srb1->build()); + QVERIFY(srb1->create()); QScopedPointer srb2(rhi->newShaderResourceBindings()); srb2->setBindings({ QRhiShaderResourceBinding::uniformBuffer(1, QRhiShaderResourceBinding::VertexStage, buf.data()), }); - QVERIFY(srb2->build()); + QVERIFY(srb2->create()); QVERIFY(!srb1->isLayoutCompatible(srb2.data())); QVERIFY(!srb2->isLayoutCompatible(srb1.data())); @@ -2475,14 +2475,14 @@ void tst_QRhi::srbLayoutCompatibility() QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage, buf.data(), rhi->ubufAligned(1), 128), QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, texture.data(), sampler.data()) }); - QVERIFY(srb1->build()); + QVERIFY(srb1->create()); QScopedPointer srb2(rhi->newShaderResourceBindings()); srb2->setBindings({ QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage, buf.data()), QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, texture.data(), sampler.data()) }); - QVERIFY(srb2->build()); + QVERIFY(srb2->create()); QVERIFY(srb1->isLayoutCompatible(srb2.data())); QVERIFY(srb2->isLayoutCompatible(srb1.data())); @@ -2495,14 +2495,14 @@ void tst_QRhi::srbLayoutCompatibility() QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage, otherBuf.data()), QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, texture.data(), otherSampler.data()) }); - QVERIFY(srb1->build()); + QVERIFY(srb1->create()); QScopedPointer srb2(rhi->newShaderResourceBindings()); srb2->setBindings({ QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage, buf.data()), QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, texture.data(), sampler.data()) }); - QVERIFY(srb2->build()); + QVERIFY(srb2->create()); QVERIFY(srb1->isLayoutCompatible(srb2.data())); QVERIFY(srb2->isLayoutCompatible(srb1.data())); @@ -2532,24 +2532,24 @@ void tst_QRhi::renderPassDescriptorCompatibility() // tex and tex2 have the same format QScopedPointer tex(rhi->newTexture(QRhiTexture::RGBA8, QSize(512, 512), 1, QRhiTexture::RenderTarget)); - QVERIFY(tex->build()); + QVERIFY(tex->create()); QScopedPointer tex2(rhi->newTexture(QRhiTexture::RGBA8, QSize(512, 512), 1, QRhiTexture::RenderTarget)); - QVERIFY(tex2->build()); + QVERIFY(tex2->create()); QScopedPointer ds(rhi->newRenderBuffer(QRhiRenderBuffer::DepthStencil, QSize(512, 512))); - QVERIFY(ds->build()); + QVERIFY(ds->create()); // two texture rendertargets with tex and tex2 as color0 (compatible) { QScopedPointer rt(rhi->newTextureRenderTarget({ tex.data() })); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); QScopedPointer rt2(rhi->newTextureRenderTarget({ tex2.data() })); QScopedPointer rpDesc2(rt2->newCompatibleRenderPassDescriptor()); rt2->setRenderPassDescriptor(rpDesc2.data()); - QVERIFY(rt2->build()); + QVERIFY(rt2->create()); QVERIFY(rpDesc->isCompatible(rpDesc2.data())); QVERIFY(rpDesc2->isCompatible(rpDesc.data())); @@ -2561,12 +2561,12 @@ void tst_QRhi::renderPassDescriptorCompatibility() QScopedPointer rt(rhi->newTextureRenderTarget(desc)); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); QScopedPointer rt2(rhi->newTextureRenderTarget(desc)); QScopedPointer rpDesc2(rt2->newCompatibleRenderPassDescriptor()); rt2->setRenderPassDescriptor(rpDesc2.data()); - QVERIFY(rt2->build()); + QVERIFY(rt2->create()); QVERIFY(rpDesc->isCompatible(rpDesc2.data())); QVERIFY(rpDesc2->isCompatible(rpDesc.data())); @@ -2577,12 +2577,12 @@ void tst_QRhi::renderPassDescriptorCompatibility() QScopedPointer rt(rhi->newTextureRenderTarget({ { tex.data() }, ds.data() })); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); QScopedPointer rt2(rhi->newTextureRenderTarget({ tex.data() })); QScopedPointer rpDesc2(rt2->newCompatibleRenderPassDescriptor()); rt2->setRenderPassDescriptor(rpDesc2.data()); - QVERIFY(rt2->build()); + QVERIFY(rt2->create()); if (impl == QRhi::Vulkan || impl == QRhi::Metal) { QVERIFY(!rpDesc->isCompatible(rpDesc2.data())); @@ -2594,23 +2594,23 @@ void tst_QRhi::renderPassDescriptorCompatibility() // resolve attachments (compatible) { QScopedPointer msaaRenderBuffer(rhi->newRenderBuffer(QRhiRenderBuffer::Color, QSize(512, 512), 4)); - QVERIFY(msaaRenderBuffer->build()); + QVERIFY(msaaRenderBuffer->create()); QScopedPointer msaaRenderBuffer2(rhi->newRenderBuffer(QRhiRenderBuffer::Color, QSize(512, 512), 4)); - QVERIFY(msaaRenderBuffer2->build()); + QVERIFY(msaaRenderBuffer2->create()); QRhiColorAttachment colorAtt(msaaRenderBuffer.data()); // color0, multisample colorAtt.setResolveTexture(tex.data()); // resolved into a non-msaa texture QScopedPointer rt(rhi->newTextureRenderTarget({ colorAtt })); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); QRhiColorAttachment colorAtt2(msaaRenderBuffer2.data()); // color0, multisample colorAtt2.setResolveTexture(tex2.data()); // resolved into a non-msaa texture QScopedPointer rt2(rhi->newTextureRenderTarget({ colorAtt2 })); QScopedPointer rpDesc2(rt2->newCompatibleRenderPassDescriptor()); rt2->setRenderPassDescriptor(rpDesc2.data()); - QVERIFY(rt2->build()); + QVERIFY(rt2->create()); QVERIFY(rpDesc->isCompatible(rpDesc2.data())); QVERIFY(rpDesc2->isCompatible(rpDesc.data())); @@ -2619,22 +2619,22 @@ void tst_QRhi::renderPassDescriptorCompatibility() // missing resolve for one of them (not compatible) { QScopedPointer msaaRenderBuffer(rhi->newRenderBuffer(QRhiRenderBuffer::Color, QSize(512, 512), 4)); - QVERIFY(msaaRenderBuffer->build()); + QVERIFY(msaaRenderBuffer->create()); QScopedPointer msaaRenderBuffer2(rhi->newRenderBuffer(QRhiRenderBuffer::Color, QSize(512, 512), 4)); - QVERIFY(msaaRenderBuffer2->build()); + QVERIFY(msaaRenderBuffer2->create()); QRhiColorAttachment colorAtt(msaaRenderBuffer.data()); // color0, multisample colorAtt.setResolveTexture(tex.data()); // resolved into a non-msaa texture QScopedPointer rt(rhi->newTextureRenderTarget({ colorAtt })); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); QRhiColorAttachment colorAtt2(msaaRenderBuffer2.data()); // color0, multisample QScopedPointer rt2(rhi->newTextureRenderTarget({ colorAtt2 })); QScopedPointer rpDesc2(rt2->newCompatibleRenderPassDescriptor()); rt2->setRenderPassDescriptor(rpDesc2.data()); - QVERIFY(rt2->build()); + QVERIFY(rt2->create()); if (impl == QRhi::Vulkan) { // no Metal here QVERIFY(!rpDesc->isCompatible(rpDesc2.data())); @@ -2647,19 +2647,19 @@ void tst_QRhi::renderPassDescriptorCompatibility() if (rhi->isTextureFormatSupported(QRhiTexture::RGBA32F)) { QScopedPointer tex3(rhi->newTexture(QRhiTexture::RGBA32F, QSize(512, 512), 1, QRhiTexture::RenderTarget)); - QVERIFY(tex3->build()); + QVERIFY(tex3->create()); // different texture formats (not compatible) { QScopedPointer rt(rhi->newTextureRenderTarget({ tex.data() })); QScopedPointer rpDesc(rt->newCompatibleRenderPassDescriptor()); rt->setRenderPassDescriptor(rpDesc.data()); - QVERIFY(rt->build()); + QVERIFY(rt->create()); QScopedPointer rt2(rhi->newTextureRenderTarget({ tex3.data() })); QScopedPointer rpDesc2(rt2->newCompatibleRenderPassDescriptor()); rt2->setRenderPassDescriptor(rpDesc2.data()); - QVERIFY(rt2->build()); + QVERIFY(rt2->create()); if (impl == QRhi::Vulkan || impl == QRhi::Metal) { QVERIFY(!rpDesc->isCompatible(rpDesc2.data())); -- cgit v1.2.3