[PATCH 2/9] gles2-renderer: Adds function to select the RGBA shader for the wayland backend.
John Kåre Alsaker
john.kare.alsaker at gmail.com
Sat Sep 15 11:34:00 PDT 2012
---
src/compositor-wayland.c | 9 +--------
src/compositor.h | 2 ++
src/gles2-renderer.c | 14 ++++++++++++++
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index fce89a9..9a12b1d 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -176,19 +176,12 @@ draw_border(struct wayland_output *output)
{
struct wayland_compositor *c =
(struct wayland_compositor *) output->base.compositor;
- struct weston_shader *shader = &c->base.texture_shader_rgba;
GLfloat *v;
int n;
glDisable(GL_BLEND);
- glUseProgram(shader->program);
- c->base.current_shader = shader;
- glUniformMatrix4fv(shader->proj_uniform,
- 1, GL_FALSE, output->base.matrix.d);
-
- glUniform1i(shader->tex_uniforms[0], 0);
- glUniform1f(shader->alpha_uniform, 1);
+ gles2_renderer_use_rgba_shader(&output->base);
n = texture_border(output);
diff --git a/src/compositor.h b/src/compositor.h
index 873cd9e..a3b5fc7 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -805,6 +805,8 @@ void
gles2_renderer_select_config(struct weston_compositor *ec, EGLConfig config);
int
gles2_renderer_outputs_ready(struct weston_compositor *ec);
+void
+gles2_renderer_use_rgba_shader(struct weston_output *output);
int
gles2_renderer_surface_create_and_bind(struct weston_output *output, EGLNativeWindowType window);
EGLSurface
diff --git a/src/gles2-renderer.c b/src/gles2-renderer.c
index ce5b0ae..97b14c6 100644
--- a/src/gles2-renderer.c
+++ b/src/gles2-renderer.c
@@ -1179,6 +1179,20 @@ init_display(struct weston_compositor *ec, EGLNativeDisplayType display)
return 0;
}
+WL_EXPORT void
+gles2_renderer_use_rgba_shader(struct weston_output *output)
+{
+ struct weston_shader *shader = &output->compositor->texture_shader_rgba;
+
+ weston_compositor_use_shader(output->compositor, shader);
+
+ glUniformMatrix4fv(shader->proj_uniform,
+ 1, GL_FALSE, output->matrix.d);
+
+ glUniform1i(shader->tex_uniforms[0], 0);
+ glUniform1f(shader->alpha_uniform, 1);
+}
+
WL_EXPORT int
gles2_renderer_surface_create_and_bind(struct weston_output *output, EGLNativeWindowType window)
{
--
1.7.12
More information about the wayland-devel
mailing list