Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
5.15.13
-
Windows 10 22H2, MSVC 2019 x64
-
5720c0da7 (tqtc/lts-5.15)
Description
Code
shader.frag
in vec2 uvs; out vec4 fragColor; void main() { fragColor = vec4(0, exampleProperty, 0, 1); }
MyCustomMaterial.qml
import QtQuick 2.15 import QtQuick3D 1.15 import QtQuick3D.Materials 1.15 CustomMaterial { property real exampleProperty: 0.5 shaderInfo: ShaderInfo { version: "330" type: "GLSL" } Shader { id: vertShader stage: Shader.Vertex shader: "shader.vert" } Shader { id: fragShader stage: Shader.Fragment shader: "shader.frag" // shader.frag uses the value of exampleProperty } passes: [ Pass { shaders: [ vertShader, fragShader ] } ] }
main.qml
import QtQuick 2.15 import QtQuick3D 1.15 import QtQuick.Window 2.15 Window { id: window width: 1280 height: 720 visible: true color: "navy" title: "Qt Quick 3D 5.15 Assertion" View3D { anchors.fill: parent camera: camera PerspectiveCamera { id: camera position: Qt.vector3d(0, 100, 150) eulerRotation.x: -30 } Model { source: "#Sphere" scale: Qt.vector3d(1, 1, 1) materials: [ MyCustomMaterial { id: myMaterial } ] } } Timer { repeat: true interval: 250 running: true onTriggered: myMaterial.exampleProperty = Math.random() // This causes a crash } }
Expected outcome (Qt 5.15.11)
The green circle on screen periodically changes "luminosity"
Actual outcome (Qt 5.15.12/5.15.13)
We get an assertion in QSSGMaterialSystem::doRenderCustomMaterial for falling into the default switch() case:
https://github.com/qt/qtquick3d/blob/v5.15.9-lts-lgpl/src/runtimerender/qssgrendercustommaterialsystem.cpp#L1557 Ignoring the assertion leads to a crash.