Changeset View
Changeset View
Standalone View
Standalone View
libkwineffects/kwinglutils.cpp
Show First 20 Lines • Show All 220 Lines • ▼ Show 20 Line(s) | |||||
221 | const QByteArray GLShader::prepareSource(GLenum shaderType, const QByteArray &source) const | 221 | const QByteArray GLShader::prepareSource(GLenum shaderType, const QByteArray &source) const | ||
222 | { | 222 | { | ||
223 | Q_UNUSED(shaderType) | 223 | Q_UNUSED(shaderType) | ||
224 | // Prepare the source code | 224 | // Prepare the source code | ||
225 | QByteArray ba; | 225 | QByteArray ba; | ||
226 | if (GLPlatform::instance()->isGLES() && GLPlatform::instance()->glslVersion() < kVersionNumber(3, 0)) { | 226 | if (GLPlatform::instance()->isGLES() && GLPlatform::instance()->glslVersion() < kVersionNumber(3, 0)) { | ||
227 | ba.append("precision highp float;\n"); | 227 | ba.append("precision highp float;\n"); | ||
228 | } | 228 | } | ||
229 | if (ShaderManager::instance()->isShaderDebug()) { | | |||
230 | ba.append("#define KWIN_SHADER_DEBUG 1\n"); | | |||
231 | } | | |||
232 | ba.append(source); | 229 | ba.append(source); | ||
233 | if (GLPlatform::instance()->isGLES() && GLPlatform::instance()->glslVersion() >= kVersionNumber(3, 0)) { | 230 | if (GLPlatform::instance()->isGLES() && GLPlatform::instance()->glslVersion() >= kVersionNumber(3, 0)) { | ||
234 | ba.replace("#version 140", "#version 300 es\n\nprecision highp float;\n"); | 231 | ba.replace("#version 140", "#version 300 es\n\nprecision highp float;\n"); | ||
235 | } | 232 | } | ||
236 | 233 | | |||
237 | return ba; | 234 | return ba; | ||
238 | } | 235 | } | ||
239 | 236 | | |||
▲ Show 20 Lines • Show All 312 Lines • ▼ Show 20 Line(s) | |||||
552 | void ShaderManager::cleanup() | 549 | void ShaderManager::cleanup() | ||
553 | { | 550 | { | ||
554 | delete s_shaderManager; | 551 | delete s_shaderManager; | ||
555 | s_shaderManager = nullptr; | 552 | s_shaderManager = nullptr; | ||
556 | } | 553 | } | ||
557 | 554 | | |||
558 | ShaderManager::ShaderManager() | 555 | ShaderManager::ShaderManager() | ||
559 | { | 556 | { | ||
560 | m_debug = qstrcmp(qgetenv("KWIN_GL_DEBUG"), "1") == 0; | | |||
561 | | ||||
562 | const qint64 coreVersionNumber = GLPlatform::instance()->isGLES() ? kVersionNumber(3, 0) : kVersionNumber(1, 40); | 557 | const qint64 coreVersionNumber = GLPlatform::instance()->isGLES() ? kVersionNumber(3, 0) : kVersionNumber(1, 40); | ||
563 | if (GLPlatform::instance()->glslVersion() >= coreVersionNumber) { | 558 | if (GLPlatform::instance()->glslVersion() >= coreVersionNumber) { | ||
564 | m_resourcePath = QStringLiteral(":/effect-shaders-1.40/"); | 559 | m_resourcePath = QStringLiteral(":/effect-shaders-1.40/"); | ||
565 | } else { | 560 | } else { | ||
566 | m_resourcePath = QStringLiteral(":/effect-shaders-1.10/"); | 561 | m_resourcePath = QStringLiteral(":/effect-shaders-1.10/"); | ||
567 | } | 562 | } | ||
568 | } | 563 | } | ||
569 | 564 | | |||
▲ Show 20 Lines • Show All 420 Lines • ▼ Show 20 Line(s) | 980 | { | |||
990 | } | 985 | } | ||
991 | } | 986 | } | ||
992 | 987 | | |||
993 | bool ShaderManager::isShaderBound() const | 988 | bool ShaderManager::isShaderBound() const | ||
994 | { | 989 | { | ||
995 | return !m_boundShaders.isEmpty(); | 990 | return !m_boundShaders.isEmpty(); | ||
996 | } | 991 | } | ||
997 | 992 | | |||
998 | bool ShaderManager::isShaderDebug() const | | |||
999 | { | | |||
1000 | return m_debug; | | |||
1001 | } | | |||
1002 | | ||||
1003 | GLShader *ShaderManager::pushShader(ShaderTraits traits) | 993 | GLShader *ShaderManager::pushShader(ShaderTraits traits) | ||
1004 | { | 994 | { | ||
1005 | GLShader *shader = this->shader(traits); | 995 | GLShader *shader = this->shader(traits); | ||
1006 | pushShader(shader); | 996 | pushShader(shader); | ||
1007 | return shader; | 997 | return shader; | ||
1008 | } | 998 | } | ||
1009 | 999 | | |||
1010 | 1000 | | |||
▲ Show 20 Lines • Show All 1319 Lines • Show Last 20 Lines |