aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-10-27 16:05:50 +0200
committerSimon Ser <contact@emersion.fr>2022-10-28 13:49:03 +0200
commit4d04144b9254335c74f54c6e282904ec0c54c9dd (patch)
tree863bac9e96562cbe55fd1f879f2b20a5217ee512 /render
parentd69018c195d1bb8e6919e73a1709d03a9ae98f38 (diff)
render/gles2: de-duplicate vertex shaders
The vertex shaders for quads and textures are identical.
Diffstat (limited to 'render')
-rw-r--r--render/gles2/renderer.c11
-rw-r--r--render/gles2/shaders/common.vert (renamed from render/gles2/shaders/quad.vert)0
-rw-r--r--render/gles2/shaders/meson.build3
-rw-r--r--render/gles2/shaders/tex.vert9
4 files changed, 6 insertions, 17 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index de80a55f..8d060150 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -19,9 +19,8 @@
#include "render/pixel_format.h"
#include "types/wlr_matrix.h"
-#include "quad_vert_src.h"
+#include "common_vert_src.h"
#include "quad_frag_src.h"
-#include "tex_vert_src.h"
#include "tex_rgba_frag_src.h"
#include "tex_rgbx_frag_src.h"
#include "tex_external_frag_src.h"
@@ -786,7 +785,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
GLuint prog;
renderer->shaders.quad.program = prog =
- link_program(renderer, quad_vert_src, quad_frag_src);
+ link_program(renderer, common_vert_src, quad_frag_src);
if (!renderer->shaders.quad.program) {
goto error;
}
@@ -795,7 +794,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
renderer->shaders.quad.pos_attrib = glGetAttribLocation(prog, "pos");
renderer->shaders.tex_rgba.program = prog =
- link_program(renderer, tex_vert_src, tex_rgba_frag_src);
+ link_program(renderer, common_vert_src, tex_rgba_frag_src);
if (!renderer->shaders.tex_rgba.program) {
goto error;
}
@@ -806,7 +805,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
renderer->shaders.tex_rgba.tex_attrib = glGetAttribLocation(prog, "texcoord");
renderer->shaders.tex_rgbx.program = prog =
- link_program(renderer, tex_vert_src, tex_rgbx_frag_src);
+ link_program(renderer, common_vert_src, tex_rgbx_frag_src);
if (!renderer->shaders.tex_rgbx.program) {
goto error;
}
@@ -818,7 +817,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
if (renderer->exts.OES_egl_image_external) {
renderer->shaders.tex_ext.program = prog =
- link_program(renderer, tex_vert_src, tex_external_frag_src);
+ link_program(renderer, common_vert_src, tex_external_frag_src);
if (!renderer->shaders.tex_ext.program) {
goto error;
}
diff --git a/render/gles2/shaders/quad.vert b/render/gles2/shaders/common.vert
index 9cebb458..9cebb458 100644
--- a/render/gles2/shaders/quad.vert
+++ b/render/gles2/shaders/common.vert
diff --git a/render/gles2/shaders/meson.build b/render/gles2/shaders/meson.build
index 626c2b14..79454d9a 100644
--- a/render/gles2/shaders/meson.build
+++ b/render/gles2/shaders/meson.build
@@ -1,9 +1,8 @@
embed = find_program('./embed.sh', native: true)
shaders = [
- 'quad.vert',
+ 'common.vert',
'quad.frag',
- 'tex.vert',
'tex_rgba.frag',
'tex_rgbx.frag',
'tex_external.frag',
diff --git a/render/gles2/shaders/tex.vert b/render/gles2/shaders/tex.vert
deleted file mode 100644
index 9cebb458..00000000
--- a/render/gles2/shaders/tex.vert
+++ /dev/null
@@ -1,9 +0,0 @@
-uniform mat3 proj;
-attribute vec2 pos;
-attribute vec2 texcoord;
-varying vec2 v_texcoord;
-
-void main() {
- gl_Position = vec4(proj * vec3(pos, 1.0), 1.0);
- v_texcoord = texcoord;
-}