renamed gles2 components to gles

This commit is contained in:
William McKinnon 2025-10-27 00:49:39 -04:00
parent 879243e370
commit 00c96e3ac0
19 changed files with 304 additions and 303 deletions

11
render/gles/shaders/embed.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh -eu
var=${1:-data}
hex="$(od -A n -t x1 -v)"
echo "static const char $var[] = {"
for byte in $hex; do
echo " 0x$byte,"
done
echo " 0x00,"
echo "};"

View file

@ -0,0 +1,10 @@
uniform mat3 proj;
uniform mat3 tex_proj;
attribute vec2 pos;
varying vec2 v_texcoord;
void main() {
vec3 pos3 = vec3(pos, 1.0);
gl_Position = vec4(pos3 * proj, 1.0);
v_texcoord = (pos3 * tex_proj).xy;
}

View file

@ -0,0 +1,13 @@
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texcoord;
uniform vec4 color;
void main() {
gl_FragColor = color;
}

View file

@ -0,0 +1,15 @@
#extension GL_OES_EGL_image_external : require
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
varying vec2 v_texcoord;
uniform samplerExternalOES texture0;
uniform float alpha;
void main() {
gl_FragColor = texture2D(texture0, v_texcoord) * alpha;
}

View file

@ -0,0 +1,13 @@
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
varying vec2 v_texcoord;
uniform sampler2D tex;
uniform float alpha;
void main() {
gl_FragColor = texture2D(tex, v_texcoord) * alpha;
}

View file

@ -0,0 +1,13 @@
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
varying vec2 v_texcoord;
uniform sampler2D tex;
uniform float alpha;
void main() {
gl_FragColor = vec4(texture2D(tex, v_texcoord).rgb, 1.0) * alpha;
}

View file

@ -0,0 +1,30 @@
embed = find_program('./embed.sh', native: true)
shaders = [
'gles2_common.vert',
'gles2_quad.frag',
'gles2_tex_rgba.frag',
'gles2_tex_rgbx.frag',
'gles2_tex_external.frag',
]
foreach name : shaders
custom_target(
'gles-' + name,
input: name,
output: name + '_check',
command: [glslang, '@INPUT@'],
build_by_default: true,
)
output = name.underscorify() + '_src.h'
var = name.underscorify() + '_src'
wlr_files += custom_target(
output,
command: [embed, var],
input: name,
output: output,
feed: true,
capture: true,
)
endforeach