diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2016-10-03 14:17:03 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2016-11-27 22:10:41 +0000 |
commit | e8801e7c09414753a8e01a6be303c7922bbe023f (patch) | |
tree | fa7e24e97c8e0a7ed4cebfa2ea7ec47f1c0f7a2e /examples/quick/scenegraph/openglunderqml/squircle.cpp | |
parent | af4516ac866cc877c3a033d6b837b30445ee8f1a (diff) |
Enable shader disk cache in Qt Quick
Change-Id: I14ee97ee75664c5dfcd229a5be2be6294c936b2c
Task-number: QTBUG-55496
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'examples/quick/scenegraph/openglunderqml/squircle.cpp')
-rw-r--r-- | examples/quick/scenegraph/openglunderqml/squircle.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp index 6b25756e61..b7082892b8 100644 --- a/examples/quick/scenegraph/openglunderqml/squircle.cpp +++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp @@ -125,22 +125,22 @@ void SquircleRenderer::paint() initializeOpenGLFunctions(); m_program = new QOpenGLShaderProgram(); - m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, - "attribute highp vec4 vertices;" - "varying highp vec2 coords;" - "void main() {" - " gl_Position = vertices;" - " coords = vertices.xy;" - "}"); - m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, - "uniform lowp float t;" - "varying highp vec2 coords;" - "void main() {" - " lowp float i = 1. - (pow(abs(coords.x), 4.) + pow(abs(coords.y), 4.));" - " i = smoothstep(t - 0.8, t + 0.8, i);" - " i = floor(i * 20.) / 20.;" - " gl_FragColor = vec4(coords * .5 + .5, i, i);" - "}"); + m_program->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, + "attribute highp vec4 vertices;" + "varying highp vec2 coords;" + "void main() {" + " gl_Position = vertices;" + " coords = vertices.xy;" + "}"); + m_program->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, + "uniform lowp float t;" + "varying highp vec2 coords;" + "void main() {" + " lowp float i = 1. - (pow(abs(coords.x), 4.) + pow(abs(coords.y), 4.));" + " i = smoothstep(t - 0.8, t + 0.8, i);" + " i = floor(i * 20.) / 20.;" + " gl_FragColor = vec4(coords * .5 + .5, i, i);" + "}"); m_program->bindAttributeLocation("vertices", 0); m_program->link(); |