diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2024-05-08 08:14:53 +0300 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2024-05-08 08:14:53 +0300 |
commit | c1909714d0bf1314470211808f729337a6a3b1a4 (patch) | |
tree | 33c7527fbac66c8808d7db46cb414c1c5cbdcb8e | |
parent | fbb8186383e7e3389b952c43781755346d5ce371 (diff) | |
parent | 5720c0da7e4eae5b997923815bbe7ebdfa00a079 (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.14' into tqtc/lts-5.15-opensourcev5.15.14-lts-lgpl5.15
Change-Id: I68699c9336886106a939f34d35dc62f8207a0d69
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | src/quick3d/qquick3dcustommaterial.cpp | 24 | ||||
-rw-r--r-- | src/quick3d/qquick3deffect.cpp | 24 | ||||
-rw-r--r-- | src/render/backends/gl/qssgopenglutil_p.h | 1 | ||||
-rw-r--r-- | src/render/qssgrendershaderprogram.cpp | 7 | ||||
-rw-r--r-- | src/render/qssgrendertexturebase.cpp | 2 | ||||
-rw-r--r-- | src/runtimerender/rendererimpl/qssgrendererimpl.cpp | 7 |
7 files changed, 40 insertions, 27 deletions
diff --git a/.qmake.conf b/.qmake.conf index 0134c4cc..edc6ef73 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -3,4 +3,4 @@ load(qt_build_config) CONFIG += warning_clean DEFINES += QT_NO_FOREACH -MODULE_VERSION = 5.15.13 +MODULE_VERSION = 5.15.14 diff --git a/src/quick3d/qquick3dcustommaterial.cpp b/src/quick3d/qquick3dcustommaterial.cpp index 9534146e..e8cc5a27 100644 --- a/src/quick3d/qquick3dcustommaterial.cpp +++ b/src/quick3d/qquick3dcustommaterial.cpp @@ -514,18 +514,22 @@ QSSGRenderGraphObject *QQuick3DCustomMaterial::updateSpatialNode(QSSGRenderGraph // We need to mark the commands that we allocated since they will need to be deallocted when the customMaterial is deleted. // We achieve this by filtering on the command type. - qDeleteAll(customMaterial->commandsToDelete); + // Just redo the list without deleting it, or we end up calling already deleted commands in + // render if a shader variable changes. customMaterial->commandsToDelete.clear(); for (auto command : customMaterial->commands) { - if (command->m_type != dynamic::CommandType::AllocateBuffer && - command->m_type != dynamic::CommandType::ApplyBufferValue && - command->m_type != dynamic::CommandType::ApplyBlitFramebuffer && - command->m_type != dynamic::CommandType::ApplyBlending && - command->m_type != dynamic::CommandType::ApplyRenderState && - command->m_type != dynamic::CommandType::ApplyCullMode && - command->m_type != dynamic::CommandType::ApplyDepthValue && - command->m_type != dynamic::CommandType::ApplyValue) - customMaterial->commandsToDelete.insert(command); + if (command->m_type > dynamic::CommandType::Unknown && + command->m_type < dynamic::CommandType::ApplyCullMode && + command->m_type != dynamic::CommandType::AllocateBuffer && + command->m_type != dynamic::CommandType::ApplyBufferValue && + command->m_type != dynamic::CommandType::ApplyBlitFramebuffer && + command->m_type != dynamic::CommandType::ApplyBlending && + command->m_type != dynamic::CommandType::ApplyRenderState && + command->m_type != dynamic::CommandType::ApplyCullMode && + command->m_type != dynamic::CommandType::ApplyDepthValue && + command->m_type != dynamic::CommandType::ApplyValue) { + customMaterial->commandsToDelete.insert(command); + } } QQuick3DMaterial::updateSpatialNode(customMaterial); diff --git a/src/quick3d/qquick3deffect.cpp b/src/quick3d/qquick3deffect.cpp index 0064795c..49ddb7df 100644 --- a/src/quick3d/qquick3deffect.cpp +++ b/src/quick3d/qquick3deffect.cpp @@ -389,18 +389,22 @@ QSSGRenderGraphObject *QQuick3DEffect::updateSpatialNode(QSSGRenderGraphObject * // We need to mark the commands that we allocated since they will need to be deallocted when the customMaterial is deleted. // We achieve this by filtering on the command type. - qDeleteAll(effectNode->commandsToDelete); + // Just redo the list without deleting it, or we end up calling already deleted commands in + // render if a shader variable changes effectNode->commandsToDelete.clear(); for (auto command : effectNode->commands) { - if (command->m_type != dynamic::CommandType::AllocateBuffer && - command->m_type != dynamic::CommandType::ApplyBufferValue && - command->m_type != dynamic::CommandType::ApplyBlitFramebuffer && - command->m_type != dynamic::CommandType::ApplyBlending && - command->m_type != dynamic::CommandType::ApplyRenderState && - command->m_type != dynamic::CommandType::ApplyCullMode && - command->m_type != dynamic::CommandType::ApplyDepthValue && - command->m_type != dynamic::CommandType::ApplyValue) - effectNode->commandsToDelete.insert(command); + if (command->m_type > dynamic::CommandType::Unknown && + command->m_type < dynamic::CommandType::ApplyCullMode && + command->m_type != dynamic::CommandType::AllocateBuffer && + command->m_type != dynamic::CommandType::ApplyBufferValue && + command->m_type != dynamic::CommandType::ApplyBlitFramebuffer && + command->m_type != dynamic::CommandType::ApplyBlending && + command->m_type != dynamic::CommandType::ApplyRenderState && + command->m_type != dynamic::CommandType::ApplyCullMode && + command->m_type != dynamic::CommandType::ApplyDepthValue && + command->m_type != dynamic::CommandType::ApplyValue) { + effectNode->commandsToDelete.insert(command); + } } if (m_dirtyAttributes & Dirty::PropertyDirty) { diff --git a/src/render/backends/gl/qssgopenglutil_p.h b/src/render/backends/gl/qssgopenglutil_p.h index b8837de8..4d6e5a5d 100644 --- a/src/render/backends/gl/qssgopenglutil_p.h +++ b/src/render/backends/gl/qssgopenglutil_p.h @@ -1796,7 +1796,6 @@ struct GLConversion default: break; } - Q_ASSERT(false); return QSSGRenderShaderDataType::Unknown; } diff --git a/src/render/qssgrendershaderprogram.cpp b/src/render/qssgrendershaderprogram.cpp index 00278633..c351b14f 100644 --- a/src/render/qssgrendershaderprogram.cpp +++ b/src/render/qssgrendershaderprogram.cpp @@ -649,14 +649,17 @@ void QSSGRenderShaderProgram::getShaderParameters() for (int idx = 0; idx != constantCount; ++idx) { location = m_backend->getConstantInfoByID(m_handle, idx, 512, &elementCount, &type, &binding, nameBuf); + if (location == -1 || type == QSSGRenderShaderDataType::Unknown) + continue; + // sampler arrays have different type if (type == QSSGRenderShaderDataType::Texture2D && elementCount > 1) { type = QSSGRenderShaderDataType::Texture2DHandle; } else if (type == QSSGRenderShaderDataType::TextureCube && elementCount > 1) { type = QSSGRenderShaderDataType::TextureCubeHandle; } - if (location != -1) - m_constants.insert(nameBuf, shaderConstantFactory(nameBuf, location, elementCount, type, binding)); + + m_constants.insert(nameBuf, shaderConstantFactory(nameBuf, location, elementCount, type, binding)); } // next query constant buffers info diff --git a/src/render/qssgrendertexturebase.cpp b/src/render/qssgrendertexturebase.cpp index 4d15d2f8..008a1567 100644 --- a/src/render/qssgrendertexturebase.cpp +++ b/src/render/qssgrendertexturebase.cpp @@ -196,7 +196,7 @@ void QSSGRenderTextureBase::setTextureCompareFunc(QSSGRenderTextureCompareOp val void QSSGRenderTextureBase::applyTexParams() { - if (m_samplerParamsDirty) { + if (m_samplerParamsDirty && m_texTarget != QSSGRenderTextureTargetType::Texture2D_MS) { m_backend->updateSampler(m_sampler->handle(), m_texTarget, m_sampler->minFilter, diff --git a/src/runtimerender/rendererimpl/qssgrendererimpl.cpp b/src/runtimerender/rendererimpl/qssgrendererimpl.cpp index 706bfeeb..68ce7b34 100644 --- a/src/runtimerender/rendererimpl/qssgrendererimpl.cpp +++ b/src/runtimerender/rendererimpl/qssgrendererimpl.cpp @@ -345,13 +345,16 @@ void QSSGRendererImpl::beginFrame() m_lastFrameLayers[idx]->resetForFrame(); m_lastFrameLayers.clear(); for (auto *matObj : qAsConst(m_materialClearDirty)) { - if (matObj->type == QSSGRenderGraphObject::Type::CustomMaterial) + if (matObj->type == QSSGRenderGraphObject::Type::CustomMaterial) { static_cast<QSSGRenderCustomMaterial *>(matObj)->updateDirtyForFrame(); - else if (matObj->type == QSSGRenderGraphObject::Type::DefaultMaterial) + } else if (matObj->type == QSSGRenderGraphObject::Type::DefaultMaterial || + matObj->type == QSSGRenderGraphObject::Type::PrincipledMaterial) { static_cast<QSSGRenderDefaultMaterial *>(matObj)->dirty.updateDirtyForFrame(); + } } m_materialClearDirty.clear(); } + void QSSGRendererImpl::endFrame() { } |