diff options
author | Kim Gronholm <kim.1.gronholm@nokia.com> | 2011-05-06 15:23:21 +0300 |
---|---|---|
committer | Kim Gronholm <kim.1.gronholm@nokia.com> | 2011-05-06 15:23:21 +0300 |
commit | b66d3e10dd7ef8204ec077b3f81106f77a4a6bbf (patch) | |
tree | 004691335cb562af2c6565c21243ecd476f5d439 | |
parent | 516a1127509f53f956e990d6930c404263e19e18 (diff) | |
parent | e2491edd35680f0f12c5d2961c3f8523f2b3c0b2 (diff) |
Merge branch 'master' of gitorious.org:qt-labs/qml1-shadersplugin
-rw-r--r-- | src/shadereffectitem.cpp | 22 | ||||
-rw-r--r-- | src/shadereffectitem.h | 1 | ||||
-rwxr-xr-x | tests/manual/performance/TestGaussianDropShadow.qml | 2 | ||||
-rwxr-xr-x | tests/manual/performance/TestWater.qml | 2 | ||||
-rw-r--r-- | tests/manual/performance/bg.jpg | bin | 0 -> 10189 bytes | |||
-rw-r--r-- | tests/manual/performance/sky.jpg | bin | 0 -> 36734 bytes |
6 files changed, 18 insertions, 9 deletions
diff --git a/src/shadereffectitem.cpp b/src/shadereffectitem.cpp index 64b59bd..4d09327 100644 --- a/src/shadereffectitem.cpp +++ b/src/shadereffectitem.cpp @@ -211,6 +211,7 @@ ShaderEffectItem::ShaderEffectItem(QDeclarativeItem *parent) , m_checkedViewportUpdateMode(false) , m_checkedOpenGL(false) , m_mirrored(false) + , m_defaultVertexShader(true) { setFlag(QGraphicsItem::ItemHasNoContents, false); connect(this, SIGNAL(visibleChanged()), this, SLOT(handleVisibilityChange())); @@ -288,6 +289,7 @@ void ShaderEffectItem::setVertexShader(const QString &code) return; m_vertex_code = code; + m_defaultVertexShader = false; if (isComponentComplete()) { reset(); updateProperties(); @@ -423,16 +425,22 @@ void ShaderEffectItem::renderEffect(QPainter *painter, const QMatrix4x4 &matrix) bindGeometry(); - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_GREATER); - glDepthMask(true); + // Optimization, disable depth test when we know we don't need it. + if (m_defaultVertexShader) { + glDepthMask(false); + glDisable(GL_DEPTH_TEST); + } else { + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_GREATER); + glDepthMask(true); #if defined(QT_OPENGL_ES) - glClearDepthf(0); + glClearDepthf(0); #else - glClearDepth(0); + glClearDepth(0); #endif - glClearColor(0, 0, 0, 0); - glClear(GL_DEPTH_BUFFER_BIT); + glClearColor(0, 0, 0, 0); + glClear(GL_DEPTH_BUFFER_BIT); + } if (m_blending){ glEnable(GL_BLEND); diff --git a/src/shadereffectitem.h b/src/shadereffectitem.h index d1f9fd4..83fbaea 100644 --- a/src/shadereffectitem.h +++ b/src/shadereffectitem.h @@ -140,6 +140,7 @@ private: bool m_checkedViewportUpdateMode : 1; bool m_checkedOpenGL : 1; bool m_mirrored : 1; + bool m_defaultVertexShader : 1; }; QT_END_HEADER diff --git a/tests/manual/performance/TestGaussianDropShadow.qml b/tests/manual/performance/TestGaussianDropShadow.qml index c6d1d9b..5843d55 100755 --- a/tests/manual/performance/TestGaussianDropShadow.qml +++ b/tests/manual/performance/TestGaussianDropShadow.qml @@ -21,7 +21,7 @@ Item { width: main.width height: main.height fillMode: Image.Tile - source: "tile.jpg" + source: "bg.jpg" } GaussianDropShadow { diff --git a/tests/manual/performance/TestWater.qml b/tests/manual/performance/TestWater.qml index ec5ef6d..4d90950 100755 --- a/tests/manual/performance/TestWater.qml +++ b/tests/manual/performance/TestWater.qml @@ -9,7 +9,7 @@ Item { id: image width: parent.width height: parent.height * 0.65 - source: "sydney5.png" + source: "sky.jpg" smooth: true } Water { diff --git a/tests/manual/performance/bg.jpg b/tests/manual/performance/bg.jpg Binary files differnew file mode 100644 index 0000000..4d22143 --- /dev/null +++ b/tests/manual/performance/bg.jpg diff --git a/tests/manual/performance/sky.jpg b/tests/manual/performance/sky.jpg Binary files differnew file mode 100644 index 0000000..8fc19ed --- /dev/null +++ b/tests/manual/performance/sky.jpg |