forked from 12to11/12to11

* egl.c (struct _EglBuffer): New field `scale'. Save the projective scale here. (struct _CompositeProgram): New field `scale'. Save the index of new uniform here. (EglCompileCompositeProgram): Fetch location of new uniform. (ApplyTransform): Set scale. (Composite): Apply value of new uniform. (BufferFromDmaBuf, BufferFromShm): Initialize scale to 0. (UpdateBufferForDamage): Scale damage if it and damage are set. * shaders.txt (Composite Rectangle Fragment Shader RGBA) (Composite Rectangle Fragment Shader RGBX) (Composite Rectangle Fragment Shader External): New uniform `scale'. (main): Divide texcoord by scale.
84 lines
1.6 KiB
GLSL
84 lines
1.6 KiB
GLSL
// -*- glsl -*-
|
|
|
|
// File containing GLSL shaders used to generate shaders.h.
|
|
|
|
// At the start of each shader, write // followed by two equals signs,
|
|
// followed by a space, the name of the shader and a newline.
|
|
// Following that, write the shader code.
|
|
|
|
// To terminate a shader, write // followed by another two equals
|
|
// signs, this time without a trailing name or whitespace.
|
|
|
|
//== Clear Rectangle Vertex Shader
|
|
attribute vec2 pos;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
gl_Position = vec4 (pos.x, pos.y, 1.0, 1.0);
|
|
}
|
|
//==
|
|
|
|
//== Clear Rectangle Fragment Shader
|
|
void
|
|
main (void)
|
|
{
|
|
gl_FragColor = vec4 (0.0, 0.0, 0.0, 1.0);
|
|
}
|
|
//==
|
|
|
|
//== Composite Rectangle Vertex Shader
|
|
attribute vec2 pos;
|
|
attribute vec2 texcoord;
|
|
varying vec2 v_texcoord;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
gl_Position = vec4 (pos.x, pos.y, 1.0, 1.0);
|
|
v_texcoord = texcoord;
|
|
}
|
|
//==
|
|
|
|
//== Composite Rectangle Fragment Shader RGBA
|
|
precision mediump float;
|
|
uniform sampler2D texture;
|
|
uniform float scale;
|
|
varying vec2 v_texcoord;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
gl_FragColor = texture2D (texture, v_texcoord / scale);
|
|
}
|
|
//==
|
|
|
|
//== Composite Rectangle Fragment Shader RGBX
|
|
precision mediump float;
|
|
uniform sampler2D texture;
|
|
uniform float scale;
|
|
varying vec2 v_texcoord;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
gl_FragColor = vec4 (texture2D (texture,
|
|
v_texcoord / scale).rgb,
|
|
1.0);
|
|
}
|
|
//==
|
|
|
|
//== Composite Rectangle Fragment Shader External
|
|
#extension GL_OES_EGL_image_external : require
|
|
|
|
precision mediump float;
|
|
uniform samplerExternalOES texture;
|
|
uniform float scale;
|
|
varying vec2 v_texcoord;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
gl_FragColor = texture2D (texture, v_texcoord / scale);
|
|
}
|
|
//==
|