[libkwinglutils] Cleanup Shader API: removal of ShaderType
As all effects are ported to the ShaderTraits API the old ShaderType API can be completely removed.
This commit is contained in:
parent
1752302203
commit
54870d5e14
16 changed files with 1 additions and 490 deletions
|
@ -5,7 +5,7 @@ ecm_setup_version(${PROJECT_VERSION}
|
|||
VARIABLE_PREFIX KWINEFFECTS
|
||||
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kwineffects_version.h"
|
||||
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KWinEffectsConfigVersion.cmake"
|
||||
SOVERSION 7
|
||||
SOVERSION 8
|
||||
)
|
||||
|
||||
### xrenderutils lib ###
|
||||
|
|
|
@ -655,16 +655,6 @@ void ColorCorrectionPrivate::colorServerUpdateSucceededSlot()
|
|||
|
||||
// Reload all shaders
|
||||
ShaderManager::cleanup();
|
||||
if (!ShaderManager::instance()->isValid()) {
|
||||
qCCritical(LIBKWINGLUTILS) << "Shader reinitialization failed, possible compile problems with the shaders "
|
||||
"altered for color-correction";
|
||||
m_hasError = true;
|
||||
qCDebug(LIBKWINGLUTILS) << "Color correction has been disabled due to shader issues";
|
||||
m_enabled = false;
|
||||
GLShader::sColorCorrect = false;
|
||||
ShaderManager::cleanup();
|
||||
ShaderManager::instance();
|
||||
}
|
||||
}
|
||||
|
||||
emit q->changed();
|
||||
|
|
|
@ -626,14 +626,11 @@ QMatrix4x4 GLShader::getUniformMatrix4x4(const char* name)
|
|||
// ShaderManager
|
||||
//****************************************
|
||||
ShaderManager *ShaderManager::s_shaderManager = nullptr;
|
||||
QSize ShaderManager::s_virtualScreenSize;
|
||||
|
||||
ShaderManager *ShaderManager::instance()
|
||||
{
|
||||
if (!s_shaderManager) {
|
||||
s_shaderManager = new ShaderManager();
|
||||
s_shaderManager->initShaders();
|
||||
s_shaderManager->m_inited = true;
|
||||
}
|
||||
return s_shaderManager;
|
||||
}
|
||||
|
@ -645,12 +642,7 @@ void ShaderManager::cleanup()
|
|||
}
|
||||
|
||||
ShaderManager::ShaderManager()
|
||||
: m_inited(false)
|
||||
, m_valid(false)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
m_shader[i] = 0;
|
||||
|
||||
m_debug = qstrcmp(qgetenv("KWIN_GL_DEBUG"), "1") == 0;
|
||||
}
|
||||
|
||||
|
@ -660,9 +652,6 @@ ShaderManager::~ShaderManager()
|
|||
popShader();
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
delete m_shader[i];
|
||||
|
||||
qDeleteAll(m_shaderHash);
|
||||
m_shaderHash.clear();
|
||||
}
|
||||
|
@ -1040,11 +1029,6 @@ bool ShaderManager::isShaderBound() const
|
|||
return !m_boundShaders.isEmpty();
|
||||
}
|
||||
|
||||
bool ShaderManager::isValid() const
|
||||
{
|
||||
return m_valid;
|
||||
}
|
||||
|
||||
bool ShaderManager::isShaderDebug() const
|
||||
{
|
||||
return m_debug;
|
||||
|
@ -1057,42 +1041,6 @@ GLShader *ShaderManager::pushShader(ShaderTraits traits)
|
|||
return shader;
|
||||
}
|
||||
|
||||
GLShader *ShaderManager::pushShader(ShaderType type, bool reset)
|
||||
{
|
||||
if (m_inited && !m_valid) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
pushShader(m_shader[type]);
|
||||
if (reset) {
|
||||
resetShader(type);
|
||||
}
|
||||
|
||||
return m_shader[type];
|
||||
}
|
||||
|
||||
void ShaderManager::resetAllShaders()
|
||||
{
|
||||
if (!m_inited || !m_valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
pushShader(ShaderType(i), true);
|
||||
popShader();
|
||||
}
|
||||
}
|
||||
|
||||
void ShaderManager::resetShader(GLShader *shader, ShaderType type)
|
||||
{
|
||||
if (!(shader && shader->isValid()))
|
||||
return;
|
||||
|
||||
pushShader(shader);
|
||||
resetShader(type);
|
||||
popShader();
|
||||
}
|
||||
|
||||
|
||||
void ShaderManager::pushShader(GLShader *shader)
|
||||
{
|
||||
|
@ -1129,51 +1077,6 @@ void ShaderManager::bindAttributeLocations(GLShader *shader) const
|
|||
shader->bindAttributeLocation("texCoord", VA_TexCoord);
|
||||
}
|
||||
|
||||
GLShader *ShaderManager::loadFragmentShader(ShaderType vertex, const QString &fragmentFile)
|
||||
{
|
||||
const char *vertexFile[] = {
|
||||
"scene-vertex.glsl",
|
||||
"scene-generic-vertex.glsl",
|
||||
"scene-color-vertex.glsl"
|
||||
};
|
||||
|
||||
GLShader *shader = new GLShader(QString::fromUtf8(m_shaderDir + vertexFile[vertex]), fragmentFile, GLShader::ExplicitLinking);
|
||||
bindAttributeLocations(shader);
|
||||
bindFragDataLocations(shader);
|
||||
shader->link();
|
||||
|
||||
if (shader->isValid()) {
|
||||
pushShader(shader);
|
||||
resetShader(vertex);
|
||||
popShader();
|
||||
}
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
GLShader *ShaderManager::loadVertexShader(ShaderType fragment, const QString &vertexFile)
|
||||
{
|
||||
// The Simple and Generic shaders use same fragment shader
|
||||
const char *fragmentFile[] = {
|
||||
"scene-fragment.glsl",
|
||||
"scene-fragment.glsl",
|
||||
"scene-color-fragment.glsl"
|
||||
};
|
||||
|
||||
GLShader *shader = new GLShader(vertexFile, QString::fromUtf8(m_shaderDir + fragmentFile[fragment]), GLShader::ExplicitLinking);
|
||||
bindAttributeLocations(shader);
|
||||
bindFragDataLocations(shader);
|
||||
shader->link();
|
||||
|
||||
if (shader->isValid()) {
|
||||
pushShader(shader);
|
||||
resetShader(fragment);
|
||||
popShader();
|
||||
}
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
GLShader *ShaderManager::loadShaderFromCode(const QByteArray &vertexSource, const QByteArray &fragmentSource)
|
||||
{
|
||||
GLShader *shader = new GLShader(GLShader::ExplicitLinking);
|
||||
|
@ -1184,108 +1087,6 @@ GLShader *ShaderManager::loadShaderFromCode(const QByteArray &vertexSource, cons
|
|||
return shader;
|
||||
}
|
||||
|
||||
void ShaderManager::initShaders()
|
||||
{
|
||||
const char *vertexFile[] = {
|
||||
"scene-vertex.glsl",
|
||||
"scene-generic-vertex.glsl",
|
||||
"scene-color-vertex.glsl",
|
||||
};
|
||||
|
||||
const char *fragmentFile[] = {
|
||||
"scene-fragment.glsl",
|
||||
"scene-fragment.glsl",
|
||||
"scene-color-fragment.glsl",
|
||||
};
|
||||
|
||||
const qint64 coreVersionNumber = GLPlatform::instance()->isGLES() ? kVersionNumber(3, 0) : kVersionNumber(1, 40);
|
||||
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
|
||||
m_shaderDir = ":/resources/shaders/1.40/";
|
||||
else
|
||||
m_shaderDir = ":/resources/shaders/1.10/";
|
||||
|
||||
// Be optimistic
|
||||
m_valid = true;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
m_shader[i] = new GLShader(QString::fromUtf8(m_shaderDir + vertexFile[i]),
|
||||
QString::fromUtf8(m_shaderDir + fragmentFile[i]),
|
||||
GLShader::ExplicitLinking);
|
||||
bindAttributeLocations(m_shader[i]);
|
||||
bindFragDataLocations(m_shader[i]);
|
||||
m_shader[i]->link();
|
||||
|
||||
if (!m_shader[i]->isValid()) {
|
||||
m_valid = false;
|
||||
break;
|
||||
}
|
||||
|
||||
pushShader(m_shader[i]);
|
||||
resetShader(ShaderType(i));
|
||||
popShader();
|
||||
}
|
||||
|
||||
if (!m_valid) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
delete m_shader[i];
|
||||
m_shader[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ShaderManager::resetShader(ShaderType type)
|
||||
{
|
||||
// resetShader is either called from init or from push, we know that a built-in shader is bound
|
||||
const QMatrix4x4 identity;
|
||||
|
||||
QMatrix4x4 projection;
|
||||
QMatrix4x4 modelView;
|
||||
|
||||
GLShader *shader = getBoundShader();
|
||||
|
||||
switch(type) {
|
||||
case SimpleShader:
|
||||
projection.ortho(0, s_virtualScreenSize.width(), s_virtualScreenSize.height(), 0, 0, 65535);
|
||||
break;
|
||||
|
||||
case GenericShader: {
|
||||
// Set up the projection matrix
|
||||
float fovy = 60.0f;
|
||||
float aspect = 1.0f;
|
||||
float zNear = 0.1f;
|
||||
float zFar = 100.0f;
|
||||
float ymax = zNear * tan(fovy * M_PI / 360.0f);
|
||||
float ymin = -ymax;
|
||||
float xmin = ymin * aspect;
|
||||
float xmax = ymax * aspect;
|
||||
projection.frustum(xmin, xmax, ymin, ymax, zNear, zFar);
|
||||
|
||||
// Set up the model-view matrix
|
||||
float scaleFactor = 1.1 * tan(fovy * M_PI / 360.0f) / ymax;
|
||||
modelView.translate(xmin * scaleFactor, ymax * scaleFactor, -1.1);
|
||||
modelView.scale((xmax - xmin)*scaleFactor / s_virtualScreenSize.width(), -(ymax - ymin)*scaleFactor / s_virtualScreenSize.height(), 0.001);
|
||||
break;
|
||||
}
|
||||
|
||||
case ColorShader:
|
||||
projection.ortho(0, s_virtualScreenSize.width(), s_virtualScreenSize.height(), 0, 0, 65535);
|
||||
shader->setUniform("geometryColor", QVector4D(0, 0, 0, 1));
|
||||
break;
|
||||
}
|
||||
|
||||
shader->setUniform("sampler", 0);
|
||||
|
||||
shader->setUniform(GLShader::ProjectionMatrix, projection);
|
||||
shader->setUniform(GLShader::ModelViewMatrix, modelView);
|
||||
shader->setUniform(GLShader::ScreenTransformation, identity);
|
||||
shader->setUniform(GLShader::WindowTransformation, identity);
|
||||
|
||||
shader->setUniform(GLShader::Offset, QVector2D(0, 0));
|
||||
shader->setUniform(GLShader::ModulationConstant, QVector4D(1.0, 1.0, 1.0, 1.0));
|
||||
|
||||
shader->setUniform(GLShader::Saturation, 1.0f);
|
||||
}
|
||||
|
||||
/*** GLRenderTarget ***/
|
||||
bool GLRenderTarget::sSupported = false;
|
||||
bool GLRenderTarget::s_blitSupported = false;
|
||||
|
|
|
@ -228,40 +228,6 @@ Q_DECLARE_FLAGS(ShaderTraits, ShaderTrait)
|
|||
class KWINGLUTILS_EXPORT ShaderManager
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Identifiers for built-in shaders available for effects and scene
|
||||
**/
|
||||
enum ShaderType {
|
||||
/**
|
||||
* An orthographic projection shader able to render textured geometries.
|
||||
* Expects a @c vec2 uniform @c offset describing the offset from top-left corner
|
||||
* and defaults to @c (0/0). Expects a @c vec2 uniform @c textureSize to calculate
|
||||
* normalized texture coordinates. Defaults to @c (1.0/1.0). And expects a @c vec3
|
||||
* uniform @c colorManiuplation, with @c x being opacity, @c y being brightness and
|
||||
* @c z being saturation. All three values default to @c 1.0.
|
||||
* The sampler uniform is @c sample and defaults to @c 0.
|
||||
* The shader uses two vertex attributes @c vertex and @c texCoord.
|
||||
**/
|
||||
SimpleShader = 0,
|
||||
/**
|
||||
* A generic shader able to render transformed, textured geometries.
|
||||
* This shader is mostly needed by the scene and not of much interest for effects.
|
||||
* Effects can influence this shader through @link ScreenPaintData and @link WindowPaintData.
|
||||
* The shader expects four @c mat4 uniforms @c projection, @c modelview,
|
||||
* @c screenTransformation and @c windowTransformation. The fragment shader expect the
|
||||
* same uniforms as the SimpleShader and the same vertex attributes are used.
|
||||
**/
|
||||
GenericShader,
|
||||
/**
|
||||
* An orthographic shader to render simple colored geometries without texturing.
|
||||
* Expects a @c vec2 uniform @c offset describing the offset from top-left corner
|
||||
* and defaults to @c (0/0). The fragment shader expects a single @c vec4 uniform
|
||||
* @c geometryColor, which defaults to fully opaque black.
|
||||
* The Shader uses one vertex attribute @c vertex.
|
||||
**/
|
||||
ColorShader
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a shader with the given traits, creating it if necessary.
|
||||
*/
|
||||
|
@ -276,13 +242,6 @@ public:
|
|||
* @return @c true if a shader is bound, @c false otherwise
|
||||
**/
|
||||
bool isShaderBound() const;
|
||||
/**
|
||||
* Allows to query whether Shaders are supported by the compositor, that is
|
||||
* whether the Shaders compiled successfully.
|
||||
*
|
||||
* @return @c true if the built-in shaders are valid, @c false otherwise
|
||||
**/
|
||||
bool isValid() const;
|
||||
/**
|
||||
* Is @c true if the environment variable KWIN_GL_DEBUG is set to 1.
|
||||
* In that case shaders are compiled with KWIN_SHADER_DEBUG defined.
|
||||
|
@ -291,16 +250,6 @@ public:
|
|||
**/
|
||||
bool isShaderDebug() const;
|
||||
|
||||
/**
|
||||
* Binds the shader of specified @p type.
|
||||
* To unbind the shader use @link popShader. A previous bound shader will be rebound.
|
||||
* @param type The built-in shader to bind
|
||||
* @param reset Whether all uniforms should be reset to their default values
|
||||
* @return The bound shader or @c NULL if shaders are not valid
|
||||
* @see popShader
|
||||
**/
|
||||
GLShader *pushShader(ShaderType type, bool reset = false);
|
||||
|
||||
/**
|
||||
* Pushes the current shader onto the stack and binds a shader
|
||||
* with the given traits.
|
||||
|
@ -325,33 +274,6 @@ public:
|
|||
**/
|
||||
void popShader();
|
||||
|
||||
/**
|
||||
* Resets all shaders to the default uniform values.
|
||||
* Only built in shaders are changed.
|
||||
* @since 4.8
|
||||
**/
|
||||
void resetAllShaders();
|
||||
|
||||
/**
|
||||
* Resets ShaderType @p type uniforms of a custom shader
|
||||
* @since 4.11.1
|
||||
*/
|
||||
void resetShader(GLShader *shader, ShaderType type);
|
||||
|
||||
/**
|
||||
* Creates a GLShader with a built-in vertex shader and a custom fragment shader.
|
||||
* @param vertex The generic vertex shader
|
||||
* @param fragmentFile The path to the source code of the fragment shader
|
||||
* @return The created shader
|
||||
**/
|
||||
GLShader *loadFragmentShader(ShaderType vertex, const QString &fragmentFile);
|
||||
/**
|
||||
* Creates a GLShader with a built-in fragment shader and a custom vertex shader.
|
||||
* @param fragment The generic fragment shader
|
||||
* @param vertexFile The path to the source code of the vertex shader
|
||||
* @return The created shader
|
||||
**/
|
||||
GLShader *loadVertexShader(ShaderType fragment, const QString &vertexFile);
|
||||
/**
|
||||
* Creates a GLShader with the specified sources.
|
||||
* The difference to GLShader is that it does not need to be loaded from files.
|
||||
|
@ -385,14 +307,6 @@ public:
|
|||
*/
|
||||
bool selfTest();
|
||||
|
||||
/**
|
||||
* Sets the virtual screen size to @p s.
|
||||
* @since 5.2
|
||||
**/
|
||||
static void setVirtualScreenSize(const QSize &s) {
|
||||
s_virtualScreenSize = s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a pointer to the ShaderManager instance
|
||||
**/
|
||||
|
@ -407,8 +321,6 @@ private:
|
|||
ShaderManager();
|
||||
~ShaderManager();
|
||||
|
||||
void initShaders();
|
||||
void resetShader(ShaderType type);
|
||||
void bindFragDataLocations(GLShader *shader);
|
||||
void bindAttributeLocations(GLShader *shader) const;
|
||||
|
||||
|
@ -417,14 +329,9 @@ private:
|
|||
GLShader *generateShader(ShaderTraits traits);
|
||||
|
||||
QStack<GLShader*> m_boundShaders;
|
||||
GLShader *m_shader[3];
|
||||
QHash<ShaderTraits, GLShader *> m_shaderHash;
|
||||
bool m_inited;
|
||||
bool m_valid;
|
||||
bool m_debug;
|
||||
QByteArray m_shaderDir;
|
||||
static ShaderManager *s_shaderManager;
|
||||
static QSize s_virtualScreenSize;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -446,14 +353,6 @@ private:
|
|||
class KWINGLUTILS_EXPORT ShaderBinder
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Pushes the Shader of the given @p type to the ShaderManager's stack.
|
||||
*
|
||||
* @param type The built-in Shader type
|
||||
* @param reset Whether all uniforms should be reset to their default values. Defaults to false.
|
||||
* @see ShaderManager::pushShader
|
||||
**/
|
||||
explicit ShaderBinder(ShaderManager::ShaderType type, bool reset = false);
|
||||
/**
|
||||
* @brief Pushes the given @p shader to the ShaderManager's stack.
|
||||
*
|
||||
|
@ -480,13 +379,6 @@ private:
|
|||
GLShader *m_shader;
|
||||
};
|
||||
|
||||
inline
|
||||
ShaderBinder::ShaderBinder(ShaderManager::ShaderType type, bool reset)
|
||||
: m_shader(nullptr)
|
||||
{
|
||||
m_shader = ShaderManager::instance()->pushShader(type, reset);
|
||||
}
|
||||
|
||||
inline
|
||||
ShaderBinder::ShaderBinder(GLShader *shader)
|
||||
: m_shader(shader)
|
||||
|
|
|
@ -1,17 +1,7 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/resources">
|
||||
<file>shaders/1.10/lanczos-fragment.glsl</file>
|
||||
<file>shaders/1.10/scene-vertex.glsl</file>
|
||||
<file>shaders/1.10/scene-fragment.glsl</file>
|
||||
<file>shaders/1.10/scene-color-vertex.glsl</file>
|
||||
<file>shaders/1.10/scene-color-fragment.glsl</file>
|
||||
<file>shaders/1.10/scene-generic-vertex.glsl</file>
|
||||
|
||||
<file>shaders/1.40/lanczos-fragment.glsl</file>
|
||||
<file>shaders/1.40/scene-vertex.glsl</file>
|
||||
<file>shaders/1.40/scene-fragment.glsl</file>
|
||||
<file>shaders/1.40/scene-color-vertex.glsl</file>
|
||||
<file>shaders/1.40/scene-color-fragment.glsl</file>
|
||||
<file>shaders/1.40/scene-generic-vertex.glsl</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -938,10 +938,8 @@ void SceneOpenGL::screenGeometryChanged(const QSize &size)
|
|||
Scene::screenGeometryChanged(size);
|
||||
glViewport(0,0, size.width(), size.height());
|
||||
m_backend->screenGeometryChanged(size);
|
||||
ShaderManager::setVirtualScreenSize(size);
|
||||
GLRenderTarget::setVirtualScreenSize(size);
|
||||
GLVertexBuffer::setVirtualScreenSize(size);
|
||||
ShaderManager::instance()->resetAllShaders();
|
||||
}
|
||||
|
||||
void SceneOpenGL::paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data)
|
||||
|
@ -1025,14 +1023,8 @@ SceneOpenGL2::SceneOpenGL2(OpenGLBackend *backend, QObject *parent)
|
|||
connect(options, SIGNAL(colorCorrectedChanged()), this, SLOT(slotColorCorrectedChanged()), Qt::QueuedConnection);
|
||||
|
||||
const QSize &s = screens()->size();
|
||||
ShaderManager::setVirtualScreenSize(s);
|
||||
GLRenderTarget::setVirtualScreenSize(s);
|
||||
GLVertexBuffer::setVirtualScreenSize(s);
|
||||
if (!ShaderManager::instance()->isValid()) {
|
||||
qCDebug(KWIN_CORE) << "No Scene Shaders available";
|
||||
init_ok = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// push one shader on the stack so that one is always bound
|
||||
ShaderManager::instance()->pushShader(ShaderTrait::MapTexture);
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
uniform vec4 geometryColor;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = geometryColor;
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
uniform mat4 projection;
|
||||
// offset of the window/texture to be rendered
|
||||
uniform vec2 offset;
|
||||
|
||||
// passed in vertex - only x and y are used
|
||||
attribute vec4 vertex;
|
||||
|
||||
void main() {
|
||||
gl_Position = projection*vec4(vertex.xy + offset, vertex.zw);
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
uniform sampler2D sampler;
|
||||
uniform vec4 modulation;
|
||||
uniform float saturation;
|
||||
|
||||
varying vec2 varyingTexCoords;
|
||||
|
||||
//varying vec4 color;
|
||||
|
||||
void main() {
|
||||
vec4 tex = texture2D(sampler, varyingTexCoords);
|
||||
|
||||
if (saturation != 1.0) {
|
||||
tex.rgb = mix(vec3(dot( vec3( 0.30, 0.59, 0.11 ), tex.rgb )), tex.rgb, saturation);
|
||||
}
|
||||
|
||||
tex *= modulation;
|
||||
|
||||
#ifdef KWIN_SHADER_DEBUG
|
||||
tex.g = min(tex.g + 0.5, 1.0);
|
||||
#endif
|
||||
|
||||
gl_FragColor = tex;
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
uniform mat4 projection;
|
||||
uniform mat4 modelview;
|
||||
uniform mat4 screenTransformation;
|
||||
uniform mat4 windowTransformation;
|
||||
|
||||
// passed in vertex - only x and y are used
|
||||
attribute vec4 vertex;
|
||||
// passed in texCoords - to be forwarded
|
||||
attribute vec2 texCoord;
|
||||
|
||||
// texCoords passed to fragment shader
|
||||
varying vec2 varyingTexCoords;
|
||||
|
||||
void main() {
|
||||
varyingTexCoords = texCoord;
|
||||
gl_Position = projection*(modelview*screenTransformation*windowTransformation)*vertex;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
uniform mat4 projection;
|
||||
// offset of the window/texture to be rendered
|
||||
uniform vec2 offset;
|
||||
|
||||
// passed in vertex - only x and y are used
|
||||
attribute vec4 vertex;
|
||||
// passed in texCoords - to be forwarded
|
||||
attribute vec2 texCoord;
|
||||
|
||||
// texCoords passed to fragment shader
|
||||
varying vec2 varyingTexCoords;
|
||||
|
||||
void main() {
|
||||
varyingTexCoords = texCoord;
|
||||
gl_Position = projection*vec4(vertex.xy + offset, vertex.zw);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
#version 140
|
||||
|
||||
uniform vec4 geometryColor;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = geometryColor;
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#version 140
|
||||
|
||||
uniform mat4 projection;
|
||||
|
||||
// offset of the window/texture to be rendered
|
||||
uniform vec2 offset;
|
||||
|
||||
in vec4 vertex;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = projection * vec4(vertex.xy + offset, vertex.zw);
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
#version 140
|
||||
|
||||
uniform sampler2D sampler;
|
||||
uniform vec4 modulation;
|
||||
uniform float saturation;
|
||||
|
||||
in vec2 varyingTexCoords;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 tex = texture(sampler, varyingTexCoords);
|
||||
|
||||
if (saturation != 1.0) {
|
||||
tex.rgb = mix(vec3(dot(vec3(0.30, 0.59, 0.11), tex.rgb)), tex.rgb, saturation);
|
||||
}
|
||||
|
||||
tex *= modulation;
|
||||
|
||||
#ifdef KWIN_SHADER_DEBUG
|
||||
tex.g = min(tex.g + 0.5, 1.0);
|
||||
#endif
|
||||
|
||||
fragColor = tex;
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
#version 140
|
||||
|
||||
uniform mat4 projection;
|
||||
uniform mat4 modelview;
|
||||
uniform mat4 screenTransformation;
|
||||
uniform mat4 windowTransformation;
|
||||
|
||||
in vec4 vertex;
|
||||
in vec2 texCoord;
|
||||
|
||||
out vec2 varyingTexCoords;
|
||||
|
||||
void main()
|
||||
{
|
||||
varyingTexCoords = texCoord;
|
||||
gl_Position = projection * (modelview * screenTransformation * windowTransformation) * vertex;
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
#version 140
|
||||
|
||||
uniform mat4 projection;
|
||||
|
||||
// offset of the window/texture to be rendered
|
||||
uniform vec2 offset;
|
||||
|
||||
in vec4 vertex;
|
||||
in vec2 texCoord;
|
||||
|
||||
out vec2 varyingTexCoords;
|
||||
|
||||
void main()
|
||||
{
|
||||
varyingTexCoords = texCoord;
|
||||
gl_Position = projection * vec4(vertex.xy + offset, vertex.zw);
|
||||
}
|
Loading…
Reference in a new issue