summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/declarative/declarative.pro2
-rw-r--r--tests/benchmarks/declarative/qmlshadersplugin/GaussianBlur.qml84
-rw-r--r--tests/benchmarks/declarative/qmlshadersplugin/GaussianDirectionalBlur.qml209
-rw-r--r--tests/benchmarks/declarative/qmlshadersplugin/GaussianDropShadow.qml82
-rwxr-xr-xtests/benchmarks/declarative/qmlshadersplugin/TestGaussianDropShadow.qml107
-rwxr-xr-xtests/benchmarks/declarative/qmlshadersplugin/TestWater.qml60
-rw-r--r--tests/benchmarks/declarative/qmlshadersplugin/Water.qml126
-rw-r--r--tests/benchmarks/declarative/qmlshadersplugin/bg.jpgbin0 -> 10189 bytes
-rwxr-xr-xtests/benchmarks/declarative/qmlshadersplugin/drop_shadow_small.pngbin0 -> 46081 bytes
-rw-r--r--tests/benchmarks/declarative/qmlshadersplugin/qmlshadersplugin.pro23
-rw-r--r--tests/benchmarks/declarative/qmlshadersplugin/sky.jpgbin0 -> 36734 bytes
-rw-r--r--tests/benchmarks/declarative/qmlshadersplugin/tst_performance.cpp110
-rw-r--r--tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro2
-rw-r--r--tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp41
14 files changed, 841 insertions, 5 deletions
diff --git a/tests/benchmarks/declarative/declarative.pro b/tests/benchmarks/declarative/declarative.pro
index cb02a35..73e40b2 100644
--- a/tests/benchmarks/declarative/declarative.pro
+++ b/tests/benchmarks/declarative/declarative.pro
@@ -10,6 +10,6 @@ SUBDIRS += \
script \
qmltime
-contains(QT_CONFIG, opengl): SUBDIRS += painting
+contains(QT_CONFIG, opengl): SUBDIRS += painting qmlshadersplugin
include(../trusted-benchmarks.pri)
diff --git a/tests/benchmarks/declarative/qmlshadersplugin/GaussianBlur.qml b/tests/benchmarks/declarative/qmlshadersplugin/GaussianBlur.qml
new file mode 100644
index 0000000..ee4c029
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlshadersplugin/GaussianBlur.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QML Shaders plugin of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import Qt.labs.shaders 1.0
+
+Item {
+ id: gaussianBlur
+ property variant source: 0
+ property real radius: 8;
+ property real deviation: Math.sqrt(-((radius+1) * (radius+1)) / (2 * Math.log(1.0 / 255.0)))
+ property bool live: true
+
+ ShaderEffectItem {
+ id: cache
+ anchors.fill: parent
+ visible: !gaussianBlur.live
+ property variant source: ShaderEffectSource { sourceItem: verticalBlur; live: false; hideSource: true }
+ }
+
+ GaussianDirectionalBlur {
+ id: verticalBlur
+ anchors.fill: parent
+
+ deltaX: 0.0
+ deltaY: 1.0/parent.height
+
+ source: ShaderEffectSource { sourceItem: horizontalBlur; hideSource: true }
+ deviation: gaussianBlur.deviation
+ radius: gaussianBlur.radius
+ }
+
+ GaussianDirectionalBlur {
+ id: horizontalBlur
+ anchors.fill: parent
+ blending: false
+
+ deltaX: 1.0/parent.width
+ deltaY: 0.0
+
+ source: gaussianBlur.source
+ deviation: gaussianBlur.deviation
+ radius: gaussianBlur.radius
+ }
+
+}
diff --git a/tests/benchmarks/declarative/qmlshadersplugin/GaussianDirectionalBlur.qml b/tests/benchmarks/declarative/qmlshadersplugin/GaussianDirectionalBlur.qml
new file mode 100644
index 0000000..e09dde2
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlshadersplugin/GaussianDirectionalBlur.qml
@@ -0,0 +1,209 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QML Shaders plugin of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import Qt.labs.shaders 1.0
+
+// Note 1. This shader implements gaussian blur without dynamic array access from inside shader loops (Optional feature in OpenGLES 2.0).
+// Note 2. Shader code is generated to avoid ecessive if-else structure in fragment shader. Code re-generation (very slow!) happens if blur radius is changed.
+
+ShaderEffectItem {
+ id: effect
+ property variant source: 0
+ property real deviation: Math.sqrt(-((radius+1) * (radius+1)) / (2 * Math.log(1.0 / 255.0)));
+ property real radius: 8;
+ property real deltaX: 0.0
+ property real deltaY: 0.0
+
+ property real gaussianSum: 0.0
+ property real startIndex: 0.0
+ property real samples: radius * 2
+
+ property variant gwts: []
+ property variant delta: Qt.vector3d(effect.deltaX, effect.deltaY, effect.startIndex);
+ property variant factor_0_2: Qt.vector3d(effect.gwts[0], effect.gwts[1], effect.gwts[2]);
+ property variant factor_3_5: Qt.vector3d(effect.gwts[3],effect.gwts[4],effect.gwts[5]);
+ property variant factor_6_8: Qt.vector3d(effect.gwts[6],effect.gwts[7],effect.gwts[8]);
+ property variant factor_9_11: Qt.vector3d(effect.gwts[9],effect.gwts[10],effect.gwts[11]);
+ property variant factor_12_14: Qt.vector3d(effect.gwts[12],effect.gwts[13],effect.gwts[14]);
+ property variant factor_15_17: Qt.vector3d(effect.gwts[15],effect.gwts[16],effect.gwts[17]);
+ property variant factor_18_20: Qt.vector3d(effect.gwts[18],effect.gwts[19],effect.gwts[20]);
+ property variant factor_21_23: Qt.vector3d(effect.gwts[21],effect.gwts[22],effect.gwts[23]);
+ property variant factor_24_26: Qt.vector3d(effect.gwts[24],effect.gwts[25],effect.gwts[26]);
+ property variant factor_27_29: Qt.vector3d(effect.gwts[27],effect.gwts[28],effect.gwts[29]);
+ property variant factor_30_32: Qt.vector3d(effect.gwts[30],effect.gwts[31],effect.gwts[32]);
+
+ //Gaussian function = h(x):=(1/sqrt(2*3.14159*(D^2))) * %e^(-(x^2)/(2*(D^2)));
+ function gausFunc(x){
+ return (1/Math.sqrt(2*3.1415926*(Math.pow(effect.deviation,2)))) * Math.pow(2.7182818,-((Math.pow(x,2))/(2*(Math.pow(effect.deviation,2)))));
+ }
+
+ function calcGWTS() {
+ var n = new Array(Math.floor(effect.samples));
+ var step
+ for (var i = 0; i < effect.samples; i++) {
+ step = -effect.samples/2 + i + 0.5
+ n[i] = gausFunc(step);
+ }
+ return n;
+ }
+
+ function buildFragmentShader() {
+
+ var shaderSteps = [
+ "gl_FragColor += texture2D(source, texCoord) * factor_0_2.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_0_2.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_0_2.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_3_5.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_3_5.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_3_5.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_6_8.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_6_8.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_6_8.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_9_11.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_9_11.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_9_11.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_12_14.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_12_14.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_12_14.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_15_17.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_15_17.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_15_17.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_18_20.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_18_20.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_18_20.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_21_23.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_21_23.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_21_23.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_24_26.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_24_26.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_24_26.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_27_29.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_27_29.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_27_29.z; texCoord += shift;",
+
+ "gl_FragColor += texture2D(source, texCoord) * factor_30_32.x; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_30_32.y; texCoord += shift;",
+ "gl_FragColor += texture2D(source, texCoord) * factor_30_32.z; texCoord += shift;"
+ ]
+
+ var shader = fragmentShader_begin
+ var samples = effect.samples
+ if (samples > 32) {
+ console.log("GaussianBlur: Maximum of 32 blur samples exceeded!")
+ samples = 32
+ }
+
+ for (var i = 0; i < samples; i++) {
+ shader += shaderSteps[i]
+ }
+
+ shader += fragmentShader_end
+ effect.fragmentShader = shader
+
+ }
+
+ onDeviationChanged:{
+ effect.startIndex = -effect.samples/2 + 0.5
+ effect.gwts = calcGWTS();
+ var sum = 0.0;
+ for (var j = 0; j < effect.samples; j++) {
+ sum += effect.gwts[j];
+ }
+ effect.gaussianSum = sum
+ }
+
+ Component.onCompleted:{
+ effect.startIndex = -effect.samples/2 + 0.5
+ effect.gwts = calcGWTS();
+ var sum = 0.0;
+ for (var j = 0; j < effect.samples; j++) {
+ sum += effect.gwts[j];
+ }
+ effect.gaussianSum = sum
+ buildFragmentShader()
+ }
+
+ onSamplesChanged: {
+ buildFragmentShader()
+ }
+
+ property string fragmentShader_begin:
+ "
+ varying mediump vec2 qt_TexCoord0;
+ uniform sampler2D source;
+ uniform highp vec3 delta;
+ uniform highp vec3 factor_0_2;
+ uniform highp vec3 factor_3_5;
+ uniform highp vec3 factor_6_8;
+ uniform highp vec3 factor_9_11;
+ uniform highp vec3 factor_12_14;
+ uniform highp vec3 factor_15_17;
+ uniform highp vec3 factor_18_20;
+ uniform highp vec3 factor_21_23;
+ uniform highp vec3 factor_24_26;
+ uniform highp vec3 factor_27_29;
+ uniform highp vec3 factor_30_32;
+ uniform highp float gaussianSum;
+
+ void main() {
+ highp vec2 shift = vec2(delta.x, delta.y);
+ highp float index = delta.z;
+ mediump vec2 texCoord = qt_TexCoord0 + (shift * index);
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
+ "
+
+ property string fragmentShader_end:
+ "
+ if (gaussianSum > 0.0)
+ gl_FragColor /= gaussianSum;
+ }
+ "
+}
diff --git a/tests/benchmarks/declarative/qmlshadersplugin/GaussianDropShadow.qml b/tests/benchmarks/declarative/qmlshadersplugin/GaussianDropShadow.qml
new file mode 100644
index 0000000..4e8c8d3
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlshadersplugin/GaussianDropShadow.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QML Shaders plugin of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import Qt.labs.shaders 1.0
+
+Item {
+ id: gaussianDropShadow
+
+ property color shadowColor: Qt.rgba(0.5, 0.5, 0.5, 1.0)
+ property variant source: 0
+ property real radius: 8
+ property real deviation: Math.sqrt(-((radius+1) * (radius+1)) / (2 * Math.log(1.0 / 255.0)))
+ property bool live: true
+
+ GaussianBlur {
+ id: blur
+ anchors.fill: parent
+ radius: gaussianDropShadow.radius
+ deviation: gaussianDropShadow.deviation
+ source: gaussianDropShadow.source
+ live: gaussianDropShadow.live
+ }
+
+ ShaderEffectItem {
+ id: shadow
+ property color shadowColor: gaussianDropShadow.shadowColor
+ property variant source: ShaderEffectSource { sourceItem: blur; hideSource: true }
+ anchors.fill: parent
+
+ fragmentShader:
+ "
+ varying mediump vec2 qt_TexCoord0;
+ uniform sampler2D source;
+ uniform lowp vec4 shadowColor;
+
+ void main() {
+ lowp vec4 sourceColor = texture2D(source, qt_TexCoord0);
+ gl_FragColor = mix(vec4(0), shadowColor, sourceColor.a);
+ }
+ "
+ }
+}
+
diff --git a/tests/benchmarks/declarative/qmlshadersplugin/TestGaussianDropShadow.qml b/tests/benchmarks/declarative/qmlshadersplugin/TestGaussianDropShadow.qml
new file mode 100755
index 0000000..4831758
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlshadersplugin/TestGaussianDropShadow.qml
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QML Shaders plugin of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import Qt.labs.shaders 1.0
+
+Item {
+ id: main
+ width: 360
+ height: 640
+
+ property bool liveShadows: true
+ property real r: 0
+
+ NumberAnimation on r {
+ loops: Animation.Infinite
+ from: 0
+ to: 360
+ duration: 3000
+ }
+
+ Image {
+ id: background
+ width: main.width
+ height: main.height
+ fillMode: Image.Tile
+ source: "bg.jpg"
+ }
+
+ GaussianDropShadow {
+ x: image1.x + 50
+ y: image1.y + 50
+ width: image1.width
+ height: image1.height
+ shadowColor: "#88000000"
+ source: ShaderEffectSource { sourceItem: image1; hideSource: false; sourceRect: Qt.rect(-10, -10, image1.width + 20, image1.height + 20) }
+ radius: 12.0
+ deviation: 12
+ rotation: r
+ }
+
+ Image {
+ id: image1
+ anchors.fill: parent
+ source: "drop_shadow_small.png"
+ smooth: true
+ rotation: r
+ }
+
+ GaussianDropShadow {
+ x: image2.x + 50
+ y: image2.y + 50
+ width: image2.width
+ height: image2.height
+ shadowColor: "#88000000"
+ source: ShaderEffectSource { sourceItem: image2; hideSource: false; sourceRect: Qt.rect(-10, -10, image2.width + 20, image2.height + 20) }
+ radius: 12.0
+ deviation: 12
+ rotation: -r
+ }
+
+ Image {
+ id: image2
+ anchors.fill: parent
+ source: "drop_shadow_small.png"
+ smooth: true
+ rotation: -r
+ }
+}
diff --git a/tests/benchmarks/declarative/qmlshadersplugin/TestWater.qml b/tests/benchmarks/declarative/qmlshadersplugin/TestWater.qml
new file mode 100755
index 0000000..c4fbc2a
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlshadersplugin/TestWater.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QML Shaders plugin of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 1.0
+import Qt.labs.shaders 1.0
+
+Item {
+ width: 360
+ height: 640
+
+ Image {
+ id: image
+ width: parent.width
+ height: parent.height * 0.65
+ source: "sky.jpg"
+ smooth: true
+ }
+ Water {
+ sourceItem: image
+ intensity: 5
+ height: parent.height - image.height
+ }
+}
diff --git a/tests/benchmarks/declarative/qmlshadersplugin/Water.qml b/tests/benchmarks/declarative/qmlshadersplugin/Water.qml
new file mode 100644
index 0000000..6a1ec1c
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlshadersplugin/Water.qml
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QML Shaders plugin of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import Qt.labs.shaders 1.0
+
+Item {
+ id: root
+ property alias sourceItem: effectsource.sourceItem
+ property real intensity: 1
+ property bool waving: true
+ anchors.top: sourceItem.bottom
+ width: sourceItem.width
+ height: sourceItem.height
+
+ ShaderEffectItem {
+ anchors.fill: parent
+ property variant source: effectsource
+ property real f: 0
+ property real f2: 0
+ property alias intensity: root.intensity
+ smooth: true
+
+ ShaderEffectSource {
+ id: effectsource
+ hideSource: false
+ smooth: true
+ }
+
+ fragmentShader:
+ "
+ varying highp vec2 qt_TexCoord0;
+ uniform sampler2D source;
+ uniform lowp float qt_Opacity;
+ uniform highp float f;
+ uniform highp float f2;
+ uniform highp float intensity;
+
+ void main() {
+ const highp float twopi = 3.141592653589 * 2.0;
+
+ highp float distanceFactorToPhase = pow(qt_TexCoord0.y + 0.5, 8.0) * 5.0;
+ highp float ofx = sin(f * twopi + distanceFactorToPhase) / 100.0;
+ highp float ofy = sin(f2 * twopi + distanceFactorToPhase * qt_TexCoord0.x) / 60.0;
+
+ highp float intensityDampingFactor = (qt_TexCoord0.x + 0.1) * (qt_TexCoord0.y + 0.2);
+ highp float distanceFactor = (1.0 - qt_TexCoord0.y) * 4.0 * intensity * intensityDampingFactor;
+
+ ofx *= distanceFactor;
+ ofy *= distanceFactor;
+
+ highp float x = qt_TexCoord0.x + ofx;
+ highp float y = 1.0 - qt_TexCoord0.y + ofy;
+
+ highp float fake = (sin((ofy + ofx) * twopi) + 0.5) * 0.05 * (1.2 - qt_TexCoord0.y) * intensity * intensityDampingFactor;
+
+ highp vec4 pix =
+ texture2D(source, vec2(x, y)) * 0.6 +
+ texture2D(source, vec2(x-fake, y)) * 0.15 +
+ texture2D(source, vec2(x, y-fake)) * 0.15 +
+ texture2D(source, vec2(x+fake, y)) * 0.15 +
+ texture2D(source, vec2(x, y+fake)) * 0.15;
+
+ highp float darken = 0.6 - (ofx - ofy) / 2.0;
+ pix.b *= 1.2 * darken;
+ pix.r *= 0.9 * darken;
+ pix.g *= darken;
+
+ gl_FragColor = qt_Opacity * vec4(pix.r, pix.g, pix.b, 1.0);
+ }
+ "
+
+ NumberAnimation on f {
+ running: root.waving
+ loops: Animation.Infinite
+ from: 0
+ to: 1
+ duration: 2410
+ }
+ NumberAnimation on f2 {
+ running: root.waving
+ loops: Animation.Infinite
+ from: 0
+ to: 1
+ duration: 1754
+ }
+ }
+}
diff --git a/tests/benchmarks/declarative/qmlshadersplugin/bg.jpg b/tests/benchmarks/declarative/qmlshadersplugin/bg.jpg
new file mode 100644
index 0000000..4d22143
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlshadersplugin/bg.jpg
Binary files differ
diff --git a/tests/benchmarks/declarative/qmlshadersplugin/drop_shadow_small.png b/tests/benchmarks/declarative/qmlshadersplugin/drop_shadow_small.png
new file mode 100755
index 0000000..4a9b283
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlshadersplugin/drop_shadow_small.png
Binary files differ
diff --git a/tests/benchmarks/declarative/qmlshadersplugin/qmlshadersplugin.pro b/tests/benchmarks/declarative/qmlshadersplugin/qmlshadersplugin.pro
new file mode 100644
index 0000000..c4f6925
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlshadersplugin/qmlshadersplugin.pro
@@ -0,0 +1,23 @@
+QT += opengl declarative testlib
+
+TARGET = tst_performance
+
+SOURCES += \
+ tst_performance.cpp \
+ ../../../../src/imports/shaders/shadereffectitem.cpp \
+ ../../../../src/imports/shaders/shadereffectsource.cpp \
+ ../../../../src/imports/shaders/shadereffect.cpp \
+ ../../../../src/imports/shaders/shadereffectbuffer.cpp \
+ ../../../../src/imports/shaders/scenegraph/qsggeometry.cpp
+
+HEADERS += \
+ ../../../../src/imports/shaders/shadereffectitem.h \
+ ../../../../src/imports/shaders/shadereffectsource.h \
+ ../../../../src/imports/shaders/shadereffect.h \
+ ../../../../src/imports/shaders/shadereffectbuffer.h \
+ ../../../../src/imports/shaders/scenegraph/qsggeometry.h
+
+OTHER_FILES += \
+ *.qml \
+ *.png \
+ *.jpg
diff --git a/tests/benchmarks/declarative/qmlshadersplugin/sky.jpg b/tests/benchmarks/declarative/qmlshadersplugin/sky.jpg
new file mode 100644
index 0000000..8fc19ed
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlshadersplugin/sky.jpg
Binary files differ
diff --git a/tests/benchmarks/declarative/qmlshadersplugin/tst_performance.cpp b/tests/benchmarks/declarative/qmlshadersplugin/tst_performance.cpp
new file mode 100644
index 0000000..728334a
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlshadersplugin/tst_performance.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QML Shaders plugin of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/qtest.h>
+#include <QtDeclarative>
+#include "../../../../src/imports/shaders/shadereffectitem.h"
+#include "../../../../src/imports/shaders/shadereffectsource.h"
+//#include "../../../src/shadereffect.h"
+
+class BenchmarkItem : public QDeclarativeItem
+{
+ Q_OBJECT
+
+public:
+ BenchmarkItem( QDeclarativeItem * parent = 0 ) : QDeclarativeItem(parent)
+ , m_frameCount(0)
+ {
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
+ }
+
+ void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
+ QDeclarativeItem::paint(painter, option, widget);
+ if (timer.restart() > 7) m_frameCount++;
+ }
+
+ int frameCount() { return m_frameCount; }
+
+private:
+ int m_frameCount;
+ QTime timer;
+};
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QDeclarativeView view;
+ view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
+ view.setAttribute(Qt::WA_OpaquePaintEvent);
+ view.setAttribute(Qt::WA_NoSystemBackground);
+ view.setResizeMode(QDeclarativeView::SizeViewToRootObject);
+
+ qmlRegisterType<ShaderEffectItem>("Qt.labs.shaders", 1, 0, "ShaderEffectItem");
+ qmlRegisterType<ShaderEffectSource>("Qt.labs.shaders", 1, 0, "ShaderEffectSource");
+
+ QGLFormat format = QGLFormat::defaultFormat();
+ format.setSampleBuffers(false);
+ format.setSwapInterval(1);
+
+ QGLWidget* glWidget = new QGLWidget(format);
+ glWidget->setAutoFillBackground(false);
+ view.setViewport(glWidget);
+ view.show();
+
+ view.setSource(QUrl::fromLocalFile("TestWater.qml"));
+ BenchmarkItem *benchmarkItem;
+
+ qDebug() << "Sea Water benchmark:";
+ benchmarkItem = new BenchmarkItem(dynamic_cast<QDeclarativeItem *>(view.rootObject()));
+ QTest::qWait(5000);
+ qDebug() << "Rendered " << benchmarkItem->frameCount() << " frames in 5 seconds";
+ qDebug() << "Average " << benchmarkItem->frameCount() / 5.0 << " frames per second";
+
+ qDebug() << "Gaussian drop shadow benchmark:";
+ view.setSource(QUrl::fromLocalFile("TestGaussianDropShadow.qml"));
+ benchmarkItem = new BenchmarkItem(dynamic_cast<QDeclarativeItem *>(view.rootObject()));
+ QTest::qWait(5000);
+ qDebug() << "Rendered " << benchmarkItem->frameCount() << " frames in 5 seconds";
+ qDebug() << "Average " << benchmarkItem->frameCount() / 5.0 << " frames per second";
+}
+
+#include "tst_performance.moc"
diff --git a/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro
index e5b9346..4bdfcb7 100644
--- a/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro
+++ b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro
@@ -11,3 +11,5 @@ CONFIG += release
# Input
SOURCES += tst_qtcpserver.cpp
+
+symbian:TARGET.CAPABILITY += NetworkServices \ No newline at end of file
diff --git a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp
index f81853b..f06c4eb 100644
--- a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp
@@ -54,6 +54,10 @@
#include <qplatformdefs.h>
#include <qhostinfo.h>
+#include <QNetworkConfiguration>
+#include <QNetworkConfigurationManager>
+#include <QNetworkSession>
+
#include <QNetworkProxy>
Q_DECLARE_METATYPE(QNetworkProxy)
Q_DECLARE_METATYPE(QList<QNetworkProxy>)
@@ -75,16 +79,42 @@ public:
public slots:
void initTestCase_data();
void init();
+ void initTestCase();
void cleanup();
private slots:
void ipv4LoopbackPerformanceTest();
void ipv6LoopbackPerformanceTest();
void ipv4PerformanceTest();
+private:
+#ifndef QT_NO_BEARERMANAGEMENT
+ QNetworkConfigurationManager *netConfMan;
+ QNetworkConfiguration networkConfiguration;
+ QSharedPointer<QNetworkSession> networkSession;
+#endif
};
tst_QTcpServer::tst_QTcpServer()
{
- Q_SET_DEFAULT_IAP
+}
+
+void tst_QTcpServer::initTestCase()
+{
+#ifndef QT_NO_BEARERMANAGEMENT
+ netConfMan = new QNetworkConfigurationManager(this);
+ netConfMan->updateConfigurations();
+ connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
+ networkConfiguration = netConfMan->defaultConfiguration();
+ if (networkConfiguration.isValid()) {
+ networkSession = QSharedPointer<QNetworkSession>(new QNetworkSession(networkConfiguration));
+ if (!networkSession->isOpen()) {
+ networkSession->open();
+ QVERIFY(networkSession->waitForOpened(30000));
+ }
+ } else {
+ QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired));
+ }
+#endif
}
tst_QTcpServer::~tst_QTcpServer()
@@ -98,6 +128,7 @@ void tst_QTcpServer::initTestCase_data()
QTest::newRow("WithoutProxy") << false << 0;
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
+ QTest::newRow("WithHttpProxy") << true << int(QNetworkProxy::HttpProxy);
}
void tst_QTcpServer::init()
@@ -179,9 +210,6 @@ void tst_QTcpServer::ipv6LoopbackPerformanceTest()
QSKIP("WinCE WM: Not yet supported", SkipAll);
#endif
-#if defined(Q_OS_SYMBIAN)
- QSKIP("Symbian: IPv6 is not yet supported", SkipAll);
-#endif
QTcpServer server;
if (!server.listen(QHostAddress::LocalHostIPv6, 0)) {
QVERIFY(server.serverError() == QAbstractSocket::UnsupportedSocketOperationError);
@@ -236,6 +264,11 @@ void tst_QTcpServer::ipv4PerformanceTest()
QTcpServer server;
QVERIFY(server.listen(probeSocket.localAddress(), 0));
+ QFETCH_GLOBAL(int, proxyType);
+ //For http proxy, only the active connection can be proxied and not the server socket
+ if (proxyType == QNetworkProxy::HttpProxy)
+ QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128));
+
QTcpSocket clientA;
clientA.connectToHost(server.serverAddress(), server.serverPort());
QVERIFY(clientA.waitForConnected(5000));