forked from 12to11/12to11

* 12to11.c (HandleCmdline): Handle `-xrm'. (XLMain): Initialize single pixel buffers. * 12to11.man: Improve documentation. * Imakefile (SRCS): Add single_pixel_buffer.c. (OBJS): Add single_pixel_buffer.o. (single-pixel-buffer-v1): Add new scanner target. * README: Document new supported protocol. * compositor.h (struct _BufferFuncs): Add single pixel buffer functions. * egl.c (enum _EglBufferType): New buffer type. (struct _EglSinglePixelBuffer): New struct. (struct _EglBuffr): Add EglSinglePixelBuffer. (struct _CompositeProgram): Add source_color uniform. (EglCompileCompositeProgram): Look for both uniforms. (EglCompileShaders): Compile single pixel shader. (FindProgram, GetTextureTarget, Composite, UpdateTexture) (EnsureTexture, UpdateBuffer): Handle single pixel buffers. (BufferFromSinglePixel, FreeSinglePixelBuffer): New functions. (egl_buffer_funcs): Add new buffer functions. * picture_renderer.c (BufferFromSinglePixel, FreeSinglePixelBuffer): New functions. (picture_buffer_funcs): Add new buffer functions. * renderer.c (RenderBufferFromSinglePixel) (RenderUpdateBufferForDamage): New functions. (ReadRendererResource, PickRenderer): Read resource if no environment variable was specified. * shaders.txt (Composite Rectangle Fragment Shader Single Pixel): New shader. * text_input.c (struct _TextInput, UpdatePreedit) (PreeditStartCallback, PreeditCaretCallback): Correctly handle caret types and style. (XLInitTextInput): Fix failure message.
133 lines
2.5 KiB
GLSL
133 lines
2.5 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;
|
|
uniform mat3 source;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
gl_Position = vec4 (pos.x, pos.y, 1.0, 1.0);
|
|
v_texcoord = (source * vec3 (texcoord, 1.0)).xy;
|
|
}
|
|
//==
|
|
|
|
//== Composite Rectangle Fragment Shader RGBA
|
|
precision mediump float;
|
|
uniform sampler2D texture;
|
|
uniform bool invert_y;
|
|
varying vec2 v_texcoord;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
vec2 texcoord;
|
|
|
|
texcoord = v_texcoord;
|
|
|
|
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 mat3 source;
|
|
uniform bool invert_y;
|
|
varying vec2 v_texcoord;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
vec2 texcoord;
|
|
|
|
texcoord = v_texcoord;
|
|
|
|
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 mat3 source;
|
|
uniform bool invert_y;
|
|
varying vec2 v_texcoord;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
vec2 texcoord;
|
|
|
|
texcoord = v_texcoord;
|
|
|
|
if (invert_y)
|
|
texcoord = vec2 (texcoord.x, 1.0 - texcoord.y);
|
|
|
|
gl_FragColor = texture2D (texture, texcoord);
|
|
}
|
|
//==
|
|
|
|
//== Composite Rectangle Fragment Shader Single Pixel
|
|
#extension GL_OES_EGL_image_external : require
|
|
|
|
precision mediump float;
|
|
uniform vec4 source_color;
|
|
uniform mat3 source;
|
|
uniform bool invert_y;
|
|
varying vec2 v_texcoord;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
vec2 texcoord;
|
|
|
|
texcoord = v_texcoord;
|
|
|
|
if (invert_y)
|
|
texcoord = vec2 (texcoord.x, 1.0 - texcoord.y);
|
|
|
|
if (texcoord.x < 0.0 || texcoord.y < 0.0
|
|
|| texcoord.x > 1.0 || texcoord.y > 1.0)
|
|
gl_FragColor = vec4 (0.0, 0.0, 0.0, 0.0);
|
|
else
|
|
gl_FragColor = source_color;
|
|
}
|
|
//==
|