diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-06 11:08:21 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-11 23:17:18 +0200 |
commit | aa37e67ef7f5ff22da0ef95fb5221bc1fff9b3ca (patch) | |
tree | be5e1a9733987aed8602eb47618cd1673a594570 /src/gui/rhi/qrhivulkan.cpp | |
parent | fd2685c2f0a219c091e028a98ba6cdd154986fec (diff) |
Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace, with manual
unstaging of the actual definition and documentation in dist/,
src/corelib/doc/ and src/corelib/global/.
Task-number: QTBUG-99313
Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhivulkan.cpp')
-rw-r--r-- | src/gui/rhi/qrhivulkan.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 06e7fbcc38..daf934f1d3 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -544,7 +544,7 @@ bool QRhiVulkan::create(QRhi::Flags flags) if (devExtCount) { QList<VkExtensionProperties> extProps(devExtCount); f->vkEnumerateDeviceExtensionProperties(physDev, nullptr, &devExtCount, extProps.data()); - for (const VkExtensionProperties &p : qAsConst(extProps)) + for (const VkExtensionProperties &p : std::as_const(extProps)) devExts.append({ p.extensionName, p.specVersion }); } qCDebug(QRHI_LOG_INFO, "%d device extensions available", int(devExts.count())); @@ -2071,7 +2071,7 @@ QRhi::FrameOpResult QRhiVulkan::endAndSubmitPrimaryCommandBuffer(VkCommandBuffer void QRhiVulkan::waitCommandCompletion(int frameSlot) { - for (QVkSwapChain *sc : qAsConst(swapchains)) { + for (QVkSwapChain *sc : std::as_const(swapchains)) { const int frameResIndex = sc->bufferCount > 1 ? frameSlot : 0; QVkSwapChain::FrameResources &frame(sc->frameRes[frameResIndex]); if (frame.cmdFenceWaitable) { @@ -3267,7 +3267,7 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat VkDeviceSize stagingSize = 0; for (int layer = 0, maxLayer = u.subresDesc.size(); layer < maxLayer; ++layer) { for (int level = 0; level < QRhi::MAX_MIP_LEVELS; ++level) { - for (const QRhiTextureSubresourceUploadDescription &subresDesc : qAsConst(u.subresDesc[layer][level])) + for (const QRhiTextureSubresourceUploadDescription &subresDesc : std::as_const(u.subresDesc[layer][level])) stagingSize += subresUploadByteSize(subresDesc); } } @@ -3305,7 +3305,7 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat const QList<QRhiTextureSubresourceUploadDescription> &srd(u.subresDesc[layer][level]); if (srd.isEmpty()) continue; - for (const QRhiTextureSubresourceUploadDescription &subresDesc : qAsConst(srd)) { + for (const QRhiTextureSubresourceUploadDescription &subresDesc : std::as_const(srd)) { prepareUploadSubres(utexD, layer, level, subresDesc, &curOfs, mp, ©Infos); } @@ -3608,7 +3608,7 @@ void QRhiVulkan::executeBufferHostWritesForSlot(QVkBuffer *bufD, int slot) } quint32 changeBegin = UINT32_MAX; quint32 changeEnd = 0; - for (const QVkBuffer::DynamicUpdate &u : qAsConst(bufD->pendingDynamicUpdates[slot])) { + for (const QVkBuffer::DynamicUpdate &u : std::as_const(bufD->pendingDynamicUpdates[slot])) { memcpy(static_cast<char *>(p) + u.offset, u.data.constData(), u.data.size()); if (u.offset < changeBegin) changeBegin = u.offset; @@ -4782,7 +4782,7 @@ void QRhiVulkan::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBin // because dynOfs has to be ordered based on the binding numbers, // and neither srb nor dynamicOffsets has any such ordering // requirement. - for (const QRhiShaderResourceBinding &binding : qAsConst(srbD->sortedBindings)) { + for (const QRhiShaderResourceBinding &binding : std::as_const(srbD->sortedBindings)) { const QRhiShaderResourceBinding::Data *b = binding.data(); if (b->type == QRhiShaderResourceBinding::UniformBuffer && b->u.ubuf.hasDynamicOffset) { uint32_t offset = 0; @@ -6764,7 +6764,7 @@ bool QVkShaderResourceBindings::create() hasSlottedResource = false; hasDynamicOffset = false; - for (const QRhiShaderResourceBinding &binding : qAsConst(sortedBindings)) { + for (const QRhiShaderResourceBinding &binding : std::as_const(sortedBindings)) { const QRhiShaderResourceBinding::Data *b = binding.data(); if (b->type == QRhiShaderResourceBinding::UniformBuffer && b->u.ubuf.buf) { if (QRHI_RES(QVkBuffer, b->u.ubuf.buf)->type() == QRhiBuffer::Dynamic) @@ -6775,7 +6775,7 @@ bool QVkShaderResourceBindings::create() } QVarLengthArray<VkDescriptorSetLayoutBinding, 4> vkbindings; - for (const QRhiShaderResourceBinding &binding : qAsConst(sortedBindings)) { + for (const QRhiShaderResourceBinding &binding : std::as_const(sortedBindings)) { const QRhiShaderResourceBinding::Data *b = binding.data(); VkDescriptorSetLayoutBinding vkbinding = {}; vkbinding.binding = uint32_t(b->binding); @@ -7074,7 +7074,7 @@ bool QVkGraphicsPipeline::create() VkPipelineColorBlendStateCreateInfo blendInfo = {}; blendInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; QVarLengthArray<VkPipelineColorBlendAttachmentState, 4> vktargetBlends; - for (const QRhiGraphicsPipeline::TargetBlend &b : qAsConst(m_targetBlends)) { + for (const QRhiGraphicsPipeline::TargetBlend &b : std::as_const(m_targetBlends)) { VkPipelineColorBlendAttachmentState blend = {}; blend.blendEnable = b.enable; blend.srcColorBlendFactor = toVkBlendFactor(b.srcColor); |