summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-07-28 11:54:44 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-07-29 15:40:27 +0000
commit5e8347fdbab98d721f031634a9f6c8b217072d34 (patch)
treeca507e39d1ffb058e6c622d17e19e1b236531f05
parent182983943b76bc0e40ff7693853ef2262323fa80 (diff)
Move shapes-related shaders to under the shapes plugin
Do not leave them in quick/items' qrc. Change-Id: I12360a54caa368219a7a80645f92af66aa9de9ba Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/imports/shapes/plugin.cpp1
-rw-r--r--src/imports/shapes/qquickshapegenericrenderer.cpp4
-rw-r--r--src/imports/shapes/qquickshapenvprrenderer.cpp8
-rw-r--r--src/imports/shapes/shaders/blit.frag9
-rw-r--r--src/imports/shapes/shaders/blit.vert12
-rw-r--r--src/imports/shapes/shaders/blit_core.frag13
-rw-r--r--src/imports/shapes/shaders/blit_core.vert14
-rw-r--r--src/imports/shapes/shaders/lineargradient.frag (renamed from src/quick/items/shaders/lineargradient.frag)0
-rw-r--r--src/imports/shapes/shaders/lineargradient.vert (renamed from src/quick/items/shaders/lineargradient.vert)0
-rw-r--r--src/imports/shapes/shaders/lineargradient_core.frag (renamed from src/quick/items/shaders/lineargradient_core.frag)0
-rw-r--r--src/imports/shapes/shaders/lineargradient_core.vert (renamed from src/quick/items/shaders/lineargradient_core.vert)0
-rw-r--r--src/imports/shapes/shapes.pro2
-rw-r--r--src/imports/shapes/shapes.qrc12
-rw-r--r--src/quick/items/items.qrc4
14 files changed, 69 insertions, 10 deletions
diff --git a/src/imports/shapes/plugin.cpp b/src/imports/shapes/plugin.cpp
index ae0d02da93..1729fc88b4 100644
--- a/src/imports/shapes/plugin.cpp
+++ b/src/imports/shapes/plugin.cpp
@@ -47,6 +47,7 @@ static void initResources()
#ifdef QT_STATIC
Q_INIT_RESOURCE(qmake_QtQuick_Shapes);
#endif
+ Q_INIT_RESOURCE(shapes);
}
QT_BEGIN_NAMESPACE
diff --git a/src/imports/shapes/qquickshapegenericrenderer.cpp b/src/imports/shapes/qquickshapegenericrenderer.cpp
index ca5f2a0e91..41bab83582 100644
--- a/src/imports/shapes/qquickshapegenericrenderer.cpp
+++ b/src/imports/shapes/qquickshapegenericrenderer.cpp
@@ -703,9 +703,9 @@ QSGMaterialType QQuickShapeLinearGradientShader::type;
QQuickShapeLinearGradientShader::QQuickShapeLinearGradientShader()
{
setShaderSourceFile(QOpenGLShader::Vertex,
- QStringLiteral(":/qt-project.org/items/shaders/lineargradient.vert"));
+ QStringLiteral(":/qt-project.org/shapes/shaders/lineargradient.vert"));
setShaderSourceFile(QOpenGLShader::Fragment,
- QStringLiteral(":/qt-project.org/items/shaders/lineargradient.frag"));
+ QStringLiteral(":/qt-project.org/shapes/shaders/lineargradient.frag"));
}
void QQuickShapeLinearGradientShader::initialize()
diff --git a/src/imports/shapes/qquickshapenvprrenderer.cpp b/src/imports/shapes/qquickshapenvprrenderer.cpp
index f3f8d807ec..57306a4d53 100644
--- a/src/imports/shapes/qquickshapenvprrenderer.cpp
+++ b/src/imports/shapes/qquickshapenvprrenderer.cpp
@@ -835,11 +835,11 @@ bool QQuickNvprBlitter::create()
m_program = new QOpenGLShaderProgram;
if (QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile) {
- m_program->addCacheableShaderFromSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/items/shaders/shadereffect_core.vert"));
- m_program->addCacheableShaderFromSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/items/shaders/shadereffect_core.frag"));
+ m_program->addCacheableShaderFromSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/shapes/shaders/blit_core.vert"));
+ m_program->addCacheableShaderFromSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/shapes/shaders/blit_core.frag"));
} else {
- m_program->addCacheableShaderFromSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/items/shaders/shadereffect.vert"));
- m_program->addCacheableShaderFromSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/items/shaders/shadereffect.frag"));
+ m_program->addCacheableShaderFromSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/shapes/shaders/blit.vert"));
+ m_program->addCacheableShaderFromSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/shapes/shaders/blit.frag"));
}
m_program->bindAttributeLocation("qt_Vertex", 0);
m_program->bindAttributeLocation("qt_MultiTexCoord0", 1);
diff --git a/src/imports/shapes/shaders/blit.frag b/src/imports/shapes/shaders/blit.frag
new file mode 100644
index 0000000000..505f0db179
--- /dev/null
+++ b/src/imports/shapes/shaders/blit.frag
@@ -0,0 +1,9 @@
+varying highp vec2 qt_TexCoord0;
+
+uniform sampler2D source;
+uniform lowp float qt_Opacity;
+
+void main()
+{
+ gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity;
+}
diff --git a/src/imports/shapes/shaders/blit.vert b/src/imports/shapes/shaders/blit.vert
new file mode 100644
index 0000000000..f8306bd945
--- /dev/null
+++ b/src/imports/shapes/shaders/blit.vert
@@ -0,0 +1,12 @@
+uniform highp mat4 qt_Matrix;
+
+attribute highp vec4 qt_Vertex;
+attribute highp vec2 qt_MultiTexCoord0;
+
+varying highp vec2 qt_TexCoord0;
+
+void main()
+{
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ gl_Position = qt_Matrix * qt_Vertex;
+}
diff --git a/src/imports/shapes/shaders/blit_core.frag b/src/imports/shapes/shaders/blit_core.frag
new file mode 100644
index 0000000000..7073808fba
--- /dev/null
+++ b/src/imports/shapes/shaders/blit_core.frag
@@ -0,0 +1,13 @@
+#version 150 core
+
+in vec2 qt_TexCoord0;
+
+out vec4 fragColor;
+
+uniform sampler2D source;
+uniform float qt_Opacity;
+
+void main()
+{
+ fragColor = texture(source, qt_TexCoord0) * qt_Opacity;
+}
diff --git a/src/imports/shapes/shaders/blit_core.vert b/src/imports/shapes/shaders/blit_core.vert
new file mode 100644
index 0000000000..5246441da3
--- /dev/null
+++ b/src/imports/shapes/shaders/blit_core.vert
@@ -0,0 +1,14 @@
+#version 150 core
+
+in vec4 qt_Vertex;
+in vec2 qt_MultiTexCoord0;
+
+out vec2 qt_TexCoord0;
+
+uniform mat4 qt_Matrix;
+
+void main()
+{
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ gl_Position = qt_Matrix * qt_Vertex;
+}
diff --git a/src/quick/items/shaders/lineargradient.frag b/src/imports/shapes/shaders/lineargradient.frag
index 7f4a739109..7f4a739109 100644
--- a/src/quick/items/shaders/lineargradient.frag
+++ b/src/imports/shapes/shaders/lineargradient.frag
diff --git a/src/quick/items/shaders/lineargradient.vert b/src/imports/shapes/shaders/lineargradient.vert
index eb21b8886b..eb21b8886b 100644
--- a/src/quick/items/shaders/lineargradient.vert
+++ b/src/imports/shapes/shaders/lineargradient.vert
diff --git a/src/quick/items/shaders/lineargradient_core.frag b/src/imports/shapes/shaders/lineargradient_core.frag
index 5908acfa67..5908acfa67 100644
--- a/src/quick/items/shaders/lineargradient_core.frag
+++ b/src/imports/shapes/shaders/lineargradient_core.frag
diff --git a/src/quick/items/shaders/lineargradient_core.vert b/src/imports/shapes/shaders/lineargradient_core.vert
index 60b56f38e3..60b56f38e3 100644
--- a/src/quick/items/shaders/lineargradient_core.vert
+++ b/src/imports/shapes/shaders/lineargradient_core.vert
diff --git a/src/imports/shapes/shapes.pro b/src/imports/shapes/shapes.pro
index 80e6a22142..4406474c3f 100644
--- a/src/imports/shapes/shapes.pro
+++ b/src/imports/shapes/shapes.pro
@@ -28,4 +28,6 @@ qtConfig(opengl) {
qquickshapenvprrenderer.cpp
}
+RESOURCES += shapes.qrc
+
load(qml_plugin)
diff --git a/src/imports/shapes/shapes.qrc b/src/imports/shapes/shapes.qrc
new file mode 100644
index 0000000000..65ee2007f9
--- /dev/null
+++ b/src/imports/shapes/shapes.qrc
@@ -0,0 +1,12 @@
+<RCC>
+ <qresource prefix="/qt-project.org/shapes">
+ <file>shaders/blit.vert</file>
+ <file>shaders/blit.frag</file>
+ <file>shaders/blit_core.frag</file>
+ <file>shaders/blit_core.vert</file>
+ <file>shaders/lineargradient.vert</file>
+ <file>shaders/lineargradient.frag</file>
+ <file>shaders/lineargradient_core.vert</file>
+ <file>shaders/lineargradient_core.frag</file>
+ </qresource>
+</RCC>
diff --git a/src/quick/items/items.qrc b/src/quick/items/items.qrc
index da9bf0c828..6aaf757c29 100644
--- a/src/quick/items/items.qrc
+++ b/src/quick/items/items.qrc
@@ -8,9 +8,5 @@
<file>shaders/shadereffect_core.vert</file>
<file>shaders/shadereffectfallback_core.frag</file>
<file>shaders/shadereffectfallback_core.vert</file>
- <file>shaders/lineargradient.vert</file>
- <file>shaders/lineargradient.frag</file>
- <file>shaders/lineargradient_core.vert</file>
- <file>shaders/lineargradient_core.frag</file>
</qresource>
</RCC>