diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-07-23 03:02:27 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-07-23 03:02:27 +0200 |
commit | e8563dbbb56194d48256af984813a98c56e0bb79 (patch) | |
tree | 08d8c9a79f7d7b1d8f94ad0dc3244a4b87166295 /tests | |
parent | bd09583403b27dedb3d6a7c7c737b0c1a49432e1 (diff) | |
parent | 1bb43d7be48813ba318bc2613d020dc8a3b71746 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I2a66e9344b72524431885bdf5f59fcaedb94c718
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/render/qrenderstate/tst_qrenderstate.cpp | 8 | ||||
-rw-r--r-- | tests/manual/manual.pro | 3 | ||||
-rw-r--r-- | tests/manual/qtbug-76766/FrameGraph.qml | 140 | ||||
-rw-r--r-- | tests/manual/qtbug-76766/Material1.qml | 93 | ||||
-rw-r--r-- | tests/manual/qtbug-76766/Material2.qml | 105 | ||||
-rw-r--r-- | tests/manual/qtbug-76766/PostProcess.qml | 117 | ||||
-rw-r--r-- | tests/manual/qtbug-76766/SceneRoot.qml | 176 | ||||
-rw-r--r-- | tests/manual/qtbug-76766/expected_output.png | bin | 0 -> 22639 bytes | |||
-rw-r--r-- | tests/manual/qtbug-76766/main.cpp | 74 | ||||
-rw-r--r-- | tests/manual/qtbug-76766/main.qml | 76 | ||||
-rw-r--r-- | tests/manual/qtbug-76766/qml.qrc | 11 | ||||
-rw-r--r-- | tests/manual/qtbug-76766/qtbug-76766.pro | 10 | ||||
-rw-r--r-- | tests/manual/qtbug-76766/shaders.qrc | 6 | ||||
-rw-r--r-- | tests/manual/qtbug-76766/shaders/shader.frag | 11 | ||||
-rw-r--r-- | tests/manual/qtbug-76766/shaders/shader.vert | 36 |
15 files changed, 861 insertions, 5 deletions
diff --git a/tests/auto/render/qrenderstate/tst_qrenderstate.cpp b/tests/auto/render/qrenderstate/tst_qrenderstate.cpp index 6e90f4ce1..dc2a9b242 100644 --- a/tests/auto/render/qrenderstate/tst_qrenderstate.cpp +++ b/tests/auto/render/qrenderstate/tst_qrenderstate.cpp @@ -183,8 +183,8 @@ private Q_SLOTS: // THEN RenderStateNode *backend1 = createBackendNode(frontend1); RenderStateNode *backend2 = createBackendNode(frontend2); - QVERIFY(backend1->mask() == mask); - QVERIFY(backend2->mask() == mask); + QVERIFY(backend1->type() == mask); + QVERIFY(backend2->type() == mask); QVERIFY(backend1->impl() != backend2->impl()); // WHEN @@ -268,8 +268,8 @@ private Q_SLOTS: // THEN RenderStateNode *backend1 = createBackendNode(frontend1); RenderStateNode *backend2 = createBackendNode(frontend2); - QVERIFY(backend1->mask() == mask); - QVERIFY(backend2->mask() == mask); + QVERIFY(backend1->type() == mask); + QVERIFY(backend2->type() == mask); QVERIFY(backend1->impl() != backend2->impl()); // WHEN diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro index 6a1839561..8554d4aba 100644 --- a/tests/manual/manual.pro +++ b/tests/manual/manual.pro @@ -61,7 +61,8 @@ SUBDIRS += \ raycasting-qml \ shared_texture_image \ texture_property_updates \ - qtbug-72236 + qtbug-72236 \ + qtbug-76766 qtHaveModule(multimedia): { SUBDIRS += \ diff --git a/tests/manual/qtbug-76766/FrameGraph.qml b/tests/manual/qtbug-76766/FrameGraph.qml new file mode 100644 index 000000000..0b096bc19 --- /dev/null +++ b/tests/manual/qtbug-76766/FrameGraph.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt3D.Core 2.9 +import Qt3D.Render 2.9 + +RenderSurfaceSelector { + id: surfaceSelector + + readonly property Layer layer: Layer { + recursive: true + } + + property alias camera: cameraSelector.camera + property alias clearColor: clearBuffers.clearColor + property alias fbo : renderToFboSelector.target + + Viewport { + normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0) + + // 1st: render scene to texture + RenderTargetSelector { + id : renderToFboSelector + + RenderStateSet { + renderStates: [ + MultiSampleAntiAliasing {}, + DepthTest { + depthFunction: DepthTest.Less + }, + CullFace{ + mode: CullFace.Back + } + ] + + ClearBuffers { + id: clearBuffers + buffers: ClearBuffers.ColorDepthBuffer + NoDraw {} + } + + CameraSelector { + id: cameraSelector + + LayerFilter { + layers: [layer] + filterMode: LayerFilter.DiscardAllMatchingLayers + TechniqueFilter { + RenderPassFilter { + matchAny: FilterKey { name: "pass"; value: 0 } + } + SortPolicy { + sortTypes: [SortPolicy.BackToFront] + RenderPassFilter { + matchAny: FilterKey { name: "pass"; value: 1 } + } + } + } + } + + RenderStateSet { + renderStates: [ + DepthTest { + depthFunction: DepthTest.Always + } + ] + LayerFilter { + layers: [layer] + filterMode: LayerFilter.AcceptAnyMatchingLayers + TechniqueFilter { + RenderPassFilter { + matchAny: FilterKey { name: "pass"; value: 0 } + } + SortPolicy { + sortTypes: [SortPolicy.BackToFront] + RenderPassFilter { + matchAny: FilterKey { name: "pass"; value: 1 } + } + } + } + } + } + } + } + } + + RenderStateSet { + renderStates: [ + DepthTest {depthFunction: DepthTest.Always}, + BlendEquation {}, + BlendEquationArguments { + sourceRgb: BlendEquationArguments.One + sourceAlpha: BlendEquationArguments.One + destinationRgb: BlendEquationArguments.Zero + destinationAlpha: BlendEquationArguments.Zero + } + ] + + RenderPassFilter { + matchAny : FilterKey { name : "pass"; value : "final" } + } + } + } +} diff --git a/tests/manual/qtbug-76766/Material1.qml b/tests/manual/qtbug-76766/Material1.qml new file mode 100644 index 000000000..069d99c74 --- /dev/null +++ b/tests/manual/qtbug-76766/Material1.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt3D.Core 2.0 +import Qt3D.Render 2.0 + +Material { + id: root + + property color color: Qt.rgba(0.15, 0.35, 0.50, 1.0) + + parameters: [ + Parameter { name: "color"; value: Qt.vector3d(root.color.r, root.color.g, root.color.b) } + ] + + + effect: Effect { + property string vertex: "qrc:/shaders/shader.vert" + property string fragment: "qrc:/shaders/shader.frag" + + FilterKey { + id: forward + name: "renderingStyle" + value: "forward" + } + + ShaderProgram { + id: gl3Shader + vertexShaderCode: loadSource(parent.vertex) + fragmentShaderCode: loadSource(parent.fragment) + } + + techniques: [ + // OpenGL 3.1 + Technique { + filterKeys: [ forward ] + graphicsApiFilter { + api: GraphicsApiFilter.OpenGL + profile: GraphicsApiFilter.CoreProfile + majorVersion: 3 + minorVersion: 3 + } + renderPasses: RenderPass { + filterKeys: [ + FilterKey { + name: "pass" + value: 0 + } + ] + shaderProgram: gl3Shader + } + } + ] + } +} + + diff --git a/tests/manual/qtbug-76766/Material2.qml b/tests/manual/qtbug-76766/Material2.qml new file mode 100644 index 000000000..0af0ecb6c --- /dev/null +++ b/tests/manual/qtbug-76766/Material2.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt3D.Core 2.0 +import Qt3D.Render 2.0 + +Material { + id: root + + property color color: Qt.rgba(0.15, 0.35, 0.50, 1.0) + + parameters: [ + Parameter { name: "color"; value: Qt.vector3d(root.color.r, root.color.g, root.color.b) } + ] + + + effect: Effect { + property string vertex: "qrc:/shaders/shader.vert" + property string fragment: "qrc:/shaders/shader.frag" + + FilterKey { + id: forward + name: "renderingStyle" + value: "forward" + } + + ShaderProgram { + id: gl3Shader + vertexShaderCode: loadSource(parent.vertex) + fragmentShaderCode: loadSource(parent.fragment) + } + + techniques: [ + // OpenGL 3.1 + Technique { + filterKeys: [ forward ] + graphicsApiFilter { + api: GraphicsApiFilter.OpenGL + profile: GraphicsApiFilter.CoreProfile + majorVersion: 3 + minorVersion: 3 + } + renderPasses: [ + RenderPass { + filterKeys: [ + FilterKey { + name: "pass" + value: 1 + } + ] + shaderProgram: gl3Shader + renderStates: [ + NoDepthMask {}, + BlendEquation {}, + BlendEquationArguments { + sourceRgb: BlendEquationArguments.One + destinationRgb: BlendEquationArguments.One + sourceAlpha: BlendEquationArguments.Zero + destinationAlpha: BlendEquationArguments.One + } + ] + } + ] + } + ] + } +} + + diff --git a/tests/manual/qtbug-76766/PostProcess.qml b/tests/manual/qtbug-76766/PostProcess.qml new file mode 100644 index 000000000..cd4c9c0c6 --- /dev/null +++ b/tests/manual/qtbug-76766/PostProcess.qml @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt3D.Core 2.9 +import Qt3D.Render 2.9 +import Qt3D.Extras 2.0 + +Entity { + id: root + + property Texture colorTexture + readonly property int samples : colorTexture ? colorTexture.samples : 1 + + Effect { + id: materialEffect + techniques : [ + // OpenGL 3.2 + Technique { + graphicsApiFilter { + api : GraphicsApiFilter.OpenGL + profile : GraphicsApiFilter.CoreProfile + minorVersion : 3 + majorVersion : 2 + } + + renderPasses : RenderPass { + filterKeys : FilterKey { name : "pass"; value : "final" } + + shaderProgram : ShaderProgram { + vertexShaderCode: + "#version 150 core + + in vec3 vertexPosition; + out vec2 texCoords; + + void main() { + texCoords = vec2(0.5) + vec2(0.5) * vertexPosition.xz; + gl_Position = vec4(vertexPosition.x, vertexPosition.z, 0.0, 1.0); + }" + fragmentShaderCode: + "#version 150 core + + uniform sampler2DMS source; + + in vec2 texCoords; + out vec4 fragColor; + + void main() { + vec4 c = vec4(0.0); + c += texelFetch(source, ivec2(gl_FragCoord), 0); + fragColor = vec4(c.rgb / max(c.a, 0.01), c.a); + }" + } + } + } + ] + } + + Material { + id: materialWithoutTexture + + parameters: [ + Parameter { name: "source"; value: colorTexture }, + Parameter { name: "samples"; value: root.samples } + ] + + effect: materialEffect + } + + PlaneMesh { + id: planeMesh + width: 2.0 + height: 2.0 + meshResolution: Qt.size(2, 2) + } + + components : [ + planeMesh, + materialWithoutTexture + ] +} diff --git a/tests/manual/qtbug-76766/SceneRoot.qml b/tests/manual/qtbug-76766/SceneRoot.qml new file mode 100644 index 000000000..6e34633b1 --- /dev/null +++ b/tests/manual/qtbug-76766/SceneRoot.qml @@ -0,0 +1,176 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt3D.Core 2.0 +import Qt3D.Render 2.0 +import Qt3D.Extras 2.0 +import Qt3D.Input 2.0 +import QtQuick 2.0 as QQ2 +import QtQuick 2.12 + + +Entity { + id: sceneRoot + + Camera { + id: camera + projectionType: CameraLens.OrthographicProjection + left: -2 + right: 2 + top: 2 + bottom: -2 + nearPlane: 0.1 + farPlane: 1000.0 + position: Qt.vector3d(0.0, 0.0, 1.0) + upVector: Qt.vector3d(0.0, 1.0, 0.0) + viewCenter: Qt.vector3d(0.0, 0.0, 0.0) + } + + RenderTarget { + id: renderTargetFBO + attachments : [ + RenderTargetOutput { + attachmentPoint : RenderTargetOutput.Color0 + texture : Texture2DMultisample { + id : colorAttachment + width : scene3d.width + height : scene3d.height + format : Texture.RGBA8_UNorm + generateMipMaps : false + samples: 1 + } + }, + RenderTargetOutput { + attachmentPoint : RenderTargetOutput.Depth + texture : Texture2DMultisample { + width : scene3d.width + height : scene3d.height + format : Texture.D32F + generateMipMaps : false + samples: 1 + } + } + ] + } + + components: [ + RenderSettings { + activeFrameGraph: FrameGraph { + id: framegraph + camera: camera + fbo: renderTargetFBO + } + renderPolicy: RenderSettings.Always + } + ] + + Entity { + id: firstPassEntities + + Entity { + components: [ + Transform { + translation: Qt.vector3d(0,0,-2) + }, + Material1 { + color: "red" + }, + SphereMesh { + } + ] + } + + + Entity { + components: [ + Transform { + translation: Qt.vector3d(1,0,-1) + }, + Material2 { + color: "green" + }, + SphereMesh { + } + ] + } + } + + Entity { + id: secondPassEntities + components: [framegraph.layer] + + Entity { + components: [ + Transform { + translation: Qt.vector3d(0,0,-4) + scale: 0.5 + }, + Material1 { + ColorAnimation on color { + from: "black" + to: "purple" + duration: 2000 + loops: Animation.Infinite + } + }, + SphereMesh { + } + ] + } + + + Entity { + components: [ + Transform { + translation: Qt.vector3d(1,0,-3) + scale: 0.5 + }, + Material2 { + color: "orange" + }, + SphereMesh { + } + ] + } + } + + PostProcess { + colorTexture: colorAttachment + } +} diff --git a/tests/manual/qtbug-76766/expected_output.png b/tests/manual/qtbug-76766/expected_output.png Binary files differnew file mode 100644 index 000000000..8f642e843 --- /dev/null +++ b/tests/manual/qtbug-76766/expected_output.png diff --git a/tests/manual/qtbug-76766/main.cpp b/tests/manual/qtbug-76766/main.cpp new file mode 100644 index 000000000..f9d49846a --- /dev/null +++ b/tests/manual/qtbug-76766/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQuickView> +#include <QOpenGLContext> + +void setSurfaceFormat() +{ + QSurfaceFormat format; +#ifdef QT_OPENGL_ES_2 + format.setRenderableType(QSurfaceFormat::OpenGLES); +#else + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { + format.setVersion(4, 3); + format.setProfile(QSurfaceFormat::CoreProfile); + } +#endif + format.setDepthBufferSize(24); + format.setSamples(4); + format.setStencilBufferSize(8); + QSurfaceFormat::setDefaultFormat(format); +} + +int main(int argc, char **argv) +{ + QGuiApplication app(argc, argv); + setSurfaceFormat(); + + QQuickView view; + + view.resize(1920, 1080); + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.setSource(QUrl("qrc:/main.qml")); + view.show(); + + return app.exec(); +} diff --git a/tests/manual/qtbug-76766/main.qml b/tests/manual/qtbug-76766/main.qml new file mode 100644 index 000000000..9b8f4b691 --- /dev/null +++ b/tests/manual/qtbug-76766/main.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 +import QtQuick.Scene3D 2.12 +import Qt3D.Render 2.12 + +Item { + anchors.fill: parent + + Scene3D { + id: scene3d + anchors.fill: parent + focus: true + cameraAspectRatioMode: Scene3D.AutomaticAspectRatio + + SceneRoot { + id: root + } + } + + Image { + width: 400 + fillMode: Image.PreserveAspectFit + source: "qrc:/expected_output.png" + Text { + anchors.centerIn: parent + color: "white" + text: "This is the expected output" + } + Rectangle { + anchors.fill: parent + color: "transparent" + border { + color: "white" + width: 2 + } + } + } +} diff --git a/tests/manual/qtbug-76766/qml.qrc b/tests/manual/qtbug-76766/qml.qrc new file mode 100644 index 000000000..b1f8c2c21 --- /dev/null +++ b/tests/manual/qtbug-76766/qml.qrc @@ -0,0 +1,11 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>SceneRoot.qml</file> + <file>FrameGraph.qml</file> + <file>PostProcess.qml</file> + <file>Material1.qml</file> + <file>Material2.qml</file> + <file>expected_output.png</file> + </qresource> +</RCC> diff --git a/tests/manual/qtbug-76766/qtbug-76766.pro b/tests/manual/qtbug-76766/qtbug-76766.pro new file mode 100644 index 000000000..f332d7d57 --- /dev/null +++ b/tests/manual/qtbug-76766/qtbug-76766.pro @@ -0,0 +1,10 @@ +TEMPLATE = app + +QT += qml quick +CONFIG += c++11 + +SOURCES += main.cpp + +RESOURCES += qml.qrc \ + shaders.qrc + diff --git a/tests/manual/qtbug-76766/shaders.qrc b/tests/manual/qtbug-76766/shaders.qrc new file mode 100644 index 000000000..665814e55 --- /dev/null +++ b/tests/manual/qtbug-76766/shaders.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>shaders/shader.frag</file> + <file>shaders/shader.vert</file> + </qresource> +</RCC> diff --git a/tests/manual/qtbug-76766/shaders/shader.frag b/tests/manual/qtbug-76766/shaders/shader.frag new file mode 100644 index 000000000..92d304640 --- /dev/null +++ b/tests/manual/qtbug-76766/shaders/shader.frag @@ -0,0 +1,11 @@ +#version 150 core + +uniform vec3 color; + +out vec4 fragColor; + +void main() +{ + fragColor = vec4(color,1.0); +} + diff --git a/tests/manual/qtbug-76766/shaders/shader.vert b/tests/manual/qtbug-76766/shaders/shader.vert new file mode 100644 index 000000000..fa836855d --- /dev/null +++ b/tests/manual/qtbug-76766/shaders/shader.vert @@ -0,0 +1,36 @@ +#version 150 core + +in vec3 vertexPosition; +in vec3 vertexNormal; +in vec2 vertexTexCoord; +in vec4 vertexTangent; + +out vec3 worldPosition; +out vec3 worldNormal; +out vec4 worldTangent; +out vec2 texCoord; + +uniform mat4 modelMatrix; +uniform mat3 modelNormalMatrix; +uniform mat4 mvp; + +void main() +{ + // Scale texture coordinates for for fragment shader + texCoord = vertexTexCoord; + + // Transform position, normal, and tangent to world coords + worldPosition = vec3(modelMatrix * vec4(vertexPosition, 1.0)); + worldNormal = normalize(modelNormalMatrix * vertexNormal); + worldTangent.xyz = normalize(vec3(modelMatrix * vec4(vertexTangent.xyz, 0.0))); + worldTangent.w = vertexTangent.w; + + // Calculate animated vertex positions + + float sinPos = (vertexPosition.z)+(vertexPosition.x); + float sinPos2 = (vertexPosition.y/2)+(vertexPosition.z); + vec3 vertMod = vec3(vertexPosition.x,vertexPosition.y,vertexPosition.z); + + // Calculate vertex position in clip coordinates + gl_Position = mvp * vec4(vertexPosition, 1.0); +} |