From df85fcd2a7a0d4a7f44478314281b96f09025809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Fri, 29 Nov 2024 10:13:03 +0100 Subject: [PATCH] Sync from SUSE:ALP:Source:Standard:1.0 libqt5-qtquick3d revision 4bfcddcc2739344ec9a6c003d8352a6e --- ...anti-aliasing-for-PrincipledMaterial.patch | 41 ++++++++ 0001-assimp-Fix-out-of-bound-access.patch | 24 +++++ 0002-Skip-processing-unknown-uniforms.patch | 75 +++++++++++++++ ...stom-material-effect-shader-variable.patch | 96 +++++++++++++++++++ libqt5-qtquick3d.changes | 19 ++++ libqt5-qtquick3d.spec | 11 ++- 6 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 0001-Fix-progressive-anti-aliasing-for-PrincipledMaterial.patch create mode 100644 0001-assimp-Fix-out-of-bound-access.patch create mode 100644 0002-Skip-processing-unknown-uniforms.patch create mode 100644 0003-Fix-crash-when-a-custom-material-effect-shader-variable.patch diff --git a/0001-Fix-progressive-anti-aliasing-for-PrincipledMaterial.patch b/0001-Fix-progressive-anti-aliasing-for-PrincipledMaterial.patch new file mode 100644 index 0000000..577d400 --- /dev/null +++ b/0001-Fix-progressive-anti-aliasing-for-PrincipledMaterial.patch @@ -0,0 +1,41 @@ +From e951b7202419ae2d1518972a51683d59ee147c81 Mon Sep 17 00:00:00 2001 +From: Tomi Korpipaa +Date: Fri, 24 Mar 2023 08:34:56 +0200 +Subject: [PATCH] Fix progressive anti-aliasing for PrincipledMaterial +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fixes: QTBUG-112263 +Change-Id: Ib1b716bf19ac789a35962b7496e33534bc497ec7 +Reviewed-by: Christian Strømme +--- + src/runtimerender/rendererimpl/qssgrendererimpl.cpp | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/runtimerender/rendererimpl/qssgrendererimpl.cpp b/src/runtimerender/rendererimpl/qssgrendererimpl.cpp +index 155f0f6d6..49af69cb0 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(matObj)->updateDirtyForFrame(); +- else if (matObj->type == QSSGRenderGraphObject::Type::DefaultMaterial) ++ } else if (matObj->type == QSSGRenderGraphObject::Type::DefaultMaterial || ++ matObj->type == QSSGRenderGraphObject::Type::PrincipledMaterial) { + static_cast(matObj)->dirty.updateDirtyForFrame(); ++ } + } + m_materialClearDirty.clear(); + } ++ + void QSSGRendererImpl::endFrame() + { + } +-- +GitLab + diff --git a/0001-assimp-Fix-out-of-bound-access.patch b/0001-assimp-Fix-out-of-bound-access.patch new file mode 100644 index 0000000..ecb0042 --- /dev/null +++ b/0001-assimp-Fix-out-of-bound-access.patch @@ -0,0 +1,24 @@ +From 614911bb3b1bfc3a1799ae2b3cca306270f3fb97 Mon Sep 17 00:00:00 2001 +From: Kim Kulling +Date: Wed, 3 Jul 2024 21:05:53 +0200 +Subject: [PATCH] Fix out of bound access + +--- + code/AssetLib/Ply/PlyLoader.cpp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/3rdparty/assimp/src/code/Ply/PlyLoader.cpp b/src/3rdparty/assimp/src/code/Ply/PlyLoader.cpp +index 3e92339fb4..0c2463f240 100644 +--- a/src/3rdparty/assimp/src/code/Ply/PlyLoader.cpp ++++ b/src/3rdparty/assimp/src/code/Ply/PlyLoader.cpp +@@ -577,6 +577,10 @@ void PLYImporter::LoadFace(const PLY::Element *pcElement, const PLY::ElementInst + if (mGeneratedMesh->mFaces == nullptr) { + mGeneratedMesh->mNumFaces = pcElement->NumOccur; + mGeneratedMesh->mFaces = new aiFace[mGeneratedMesh->mNumFaces]; ++ } else { ++ if (mGeneratedMesh->mNumFaces < pcElement->NumOccur) { ++ throw DeadlyImportError("Invalid .ply file: Too many faces"); ++ } + } + + if (!bIsTriStrip) { diff --git a/0002-Skip-processing-unknown-uniforms.patch b/0002-Skip-processing-unknown-uniforms.patch new file mode 100644 index 0000000..ceea6dd --- /dev/null +++ b/0002-Skip-processing-unknown-uniforms.patch @@ -0,0 +1,75 @@ +From ff3d6efeb62575a5af503ee19db462cc6ff980e2 Mon Sep 17 00:00:00 2001 +From: Inho Lee +Date: Mon, 17 Apr 2023 16:09:57 +0200 +Subject: [PATCH] Skip processing unknown uniforms + +While processing shader uniforms, it can face +vendor specific uniforms. Quick3D will skip +them because they are not interesting in +the pipeline. + +And for GL_TEXTURE_2D_MULTISAMPLE, pnames which +are related with sampler states, are not allowed. +So, they will not be set. + +Fixes: QTBUG-110039 +Change-Id: I2f5b6e0103defbcac6890fd1d0c99dffe78c4b36 +Reviewed-by: Laszlo Agocs +--- + src/render/backends/gl/qssgopenglutil_p.h | 1 - + src/render/qssgrendershaderprogram.cpp | 7 +++++-- + src/render/qssgrendertexturebase.cpp | 2 +- + 3 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/src/render/backends/gl/qssgopenglutil_p.h b/src/render/backends/gl/qssgopenglutil_p.h +index 28b01fa62..66e780c14 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 f6a25c15c..80b8955e7 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 5a191a0ca..b526bb393 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, +-- +GitLab + diff --git a/0003-Fix-crash-when-a-custom-material-effect-shader-variable.patch b/0003-Fix-crash-when-a-custom-material-effect-shader-variable.patch new file mode 100644 index 0000000..70c1cb4 --- /dev/null +++ b/0003-Fix-crash-when-a-custom-material-effect-shader-variable.patch @@ -0,0 +1,96 @@ +From 5720c0da7e4eae5b997923815bbe7ebdfa00a079 Mon Sep 17 00:00:00 2001 +From: Tomi Korpipaa +Date: Thu, 20 Apr 2023 06:58:27 +0300 +Subject: [PATCH] Fix crash when a custom material / effect shader variable + changes + +We ended up deleting valid commands in cases where a shader variable +changed without the custom material or effect being deleted. Just redo +the to-be-deleted command list in updateSpatialNode instead of deleting +it. + +Fixes: QTBUG-112969 +Change-Id: Iec9bc584711325052f27353587632c4399b1fe4d +Reviewed-by: Andy Nichols +--- + src/quick3d/qquick3dcustommaterial.cpp | 24 ++++++++++++++---------- + src/quick3d/qquick3deffect.cpp | 24 ++++++++++++++---------- + 2 files changed, 28 insertions(+), 20 deletions(-) + +diff --git a/src/quick3d/qquick3dcustommaterial.cpp b/src/quick3d/qquick3dcustommaterial.cpp +index a2b1d3905..ed5ac9873 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 7b2681a32..af2208b03 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) { +-- +GitLab + diff --git a/libqt5-qtquick3d.changes b/libqt5-qtquick3d.changes index c7f22b4..6ac55e1 100644 --- a/libqt5-qtquick3d.changes +++ b/libqt5-qtquick3d.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Wed Aug 14 07:45:58 UTC 2024 - Antonio Larrosa + +- Add patch from kde's invent to fix progressive anti-aliasing, + which doesn't work if any object in the scene used a + PrincipledMaterial: + * 0001-Fix-progressive-anti-aliasing-for-PrincipledMaterial.patch +- Add patch from kde's invent to skip processing unknown uniforms, + such as those that are vendor specific: + * 0002-Skip-processing-unknown-uniforms.patch +- Add patch from kde's invent to fix a crash when a custom + material/effect shader variable changes: + * 0003-Fix-crash-when-a-custom-material-effect-shader-variable.patch +- Add patch from assimp's upstream for the 3rdparty library (that + is used on SLE/Leap where there's no system's assimp) to fix a + heap-based buffer overflow in the PLY importer class + (bsc#1228199, CVE-2024-40724): + * 0001-assimp-Fix-out-of-bound-access.patch + ------------------------------------------------------------------- Fri Dec 29 13:30:17 UTC 2023 - Fabian Vogt diff --git a/libqt5-qtquick3d.spec b/libqt5-qtquick3d.spec index db78ce1..52d98a3 100644 --- a/libqt5-qtquick3d.spec +++ b/libqt5-qtquick3d.spec @@ -37,8 +37,17 @@ License: GPL-3.0-or-later Group: Development/Libraries/X11 URL: https://www.qt.io Source: %{tar_version}.tar.xz -# PATCH-FIX-UPSTREAM +# PATCH-FIX-UPSTREAM Fix build with assimp 5.1 Patch0: qt5-quick3d-assimp-5.1.patch +# PATCH-FIX-UPSTREAM 0001-Fix-progressive-anti-aliasing-for-PrincipledMaterial.patch alarrosa@suse.com +Patch1: 0001-Fix-progressive-anti-aliasing-for-PrincipledMaterial.patch +# PATCH-FIX-UPSTREAM 0002-Skip-processing-unknown-uniforms.patch alarrosa@suse.com +Patch2: 0002-Skip-processing-unknown-uniforms.patch +# PATCH-FIX-UPSTREAM 0003-Fix-crash-when-a-custom-material-effect-shader-variable.patch alarrosa@suse.com +Patch3: 0003-Fix-crash-when-a-custom-material-effect-shader-variable.patch +#PATCH-FIX-UPSTREAM 0001-assimp-Fix-out-of-bound-access.patch alarrosa@suse.com -- Fix heap-based buffer overflow in the PLY importer class bsc#1228204 CVE-2024-40724 +Patch4: 0001-assimp-Fix-out-of-bound-access.patch + BuildRequires: fdupes %if %{with system_assimp} BuildRequires: pkgconfig(assimp) >= 5.0.0