forked from 12to11/12to11

* 12to11.c (MakeColormap): Delete function. (XLMain): Stop making colormap here. * compositor.h (ImmediateRelease): New flag. (struct _BufferFuncs): New field can_release_now. (struct _State): New flag `BufferAlreadyReleased'. * egl.c (struct _CompositeProgram): New field `invert_y'. (EglCompileCompositeProgram): Get new uniform index. (Composite): Apply InvertY. (egl_render_funcs): Set ImmediateRelease flag. (BufferFromDmaBuf): Set InvertY flag if set. (UpdateTexture, UpdateShmBufferIncrementally): Set CanRelease flag on SHM buffers. (UpdateBuffer): Don't update if damage is empty. (CanReleaseNow): New function. (egl_buffer_funcs): Add CanReleaseNow. * picture_renderer.c (MakeCheckWindow): New function. (FindSupportedModifiers): Use a more similar window to look for modifiers. (CanReleaseNow): New function. (picture_buffer_funcs): Add CanReleaseNow. * renderer.c (RenderCanReleaseNow): New wrapper function. (InstallRenderer): Create colormaps here, so the buffer init function can get it. * shaders.txt (Composite Rectangle Fragment Shader RGBA) (Composite Rectangle Fragment Shader RGBX) (Composite Rectangle Fragment Shader External): New uniform `invert_y'. (main): Use it. * subcompositor.c (SubcompositorUpdate): Always update attached buffer from damage, even if damage is empty. * surface.c (TryEarlyRelease): New function. (InternalCommit): Call it. Also, do not call role release_buffer hook if ImmediateRelease is specified by the renderer. (SavePendingState): Likewise, release buffers immediately if possible.
108 lines
2 KiB
GLSL
108 lines
2 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, 0.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;
|
|
uniform bool invert_y;
|
|
varying vec2 v_texcoord;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
vec2 texcoord;
|
|
|
|
texcoord = v_texcoord / scale;
|
|
|
|
if (invert_y)
|
|
texcoord = vec2 (texcoord.x, 1.0 - texcoord.y);
|
|
|
|
gl_FragColor = texture2D (texture, texcoord);
|
|
}
|
|
//==
|
|
|
|
//== Composite Rectangle Fragment Shader RGBX
|
|
precision mediump float;
|
|
uniform sampler2D texture;
|
|
uniform float scale;
|
|
uniform bool invert_y;
|
|
varying vec2 v_texcoord;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
vec2 texcoord;
|
|
|
|
texcoord = v_texcoord / scale;
|
|
|
|
if (invert_y)
|
|
texcoord = vec2 (texcoord.x, 1.0 - texcoord.y);
|
|
|
|
gl_FragColor = vec4 (texture2D (texture,
|
|
texcoord).rgb,
|
|
1.0);
|
|
}
|
|
//==
|
|
|
|
//== Composite Rectangle Fragment Shader External
|
|
#extension GL_OES_EGL_image_external : require
|
|
|
|
precision mediump float;
|
|
uniform samplerExternalOES texture;
|
|
uniform float scale;
|
|
uniform bool invert_y;
|
|
varying vec2 v_texcoord;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
vec2 texcoord;
|
|
|
|
texcoord = v_texcoord / scale;
|
|
|
|
if (invert_y)
|
|
texcoord = vec2 (texcoord.x, 1.0 - texcoord.y);
|
|
|
|
gl_FragColor = texture2D (texture, texcoord);
|
|
}
|
|
//==
|