[PATCH v6 12/12] Rename gles2-renderer to gl-renderer.
John Kåre Alsaker
john.kare.alsaker at gmail.com
Tue Nov 13 10:10:29 PST 2012
---
src/compositor-android.c | 18 ++---
src/compositor-drm.c | 20 +++---
src/compositor-rpi.c | 24 +++----
src/compositor-wayland.c | 22 +++---
src/compositor-x11.c | 14 ++--
src/gl-renderer.h | 18 ++---
src/gles2-renderer.c | 171 +++++++++++++++++++++++------------------------
7 files changed, 143 insertions(+), 144 deletions(-)
diff --git a/src/compositor-android.c b/src/compositor-android.c
index 1262683..2c75e8f 100644
--- a/src/compositor-android.c
+++ b/src/compositor-android.c
@@ -109,7 +109,7 @@ android_output_destroy(struct weston_output *base)
wl_list_remove(&output->base.link);
weston_output_destroy(&output->base);
- gles2_renderer_output_destroy(base);
+ gl_renderer_output_destroy(base);
android_framebuffer_destroy(output->fb);
@@ -288,14 +288,14 @@ android_init_egl(struct android_compositor *compositor,
{
EGLint visual_id = output->fb->format;
- if (gles2_renderer_create(&compositor->base,
- EGL_DEFAULT_DISPLAY, gles2_renderer_opaque_attribs,
+ if (gl_renderer_create(&compositor->base,
+ EGL_DEFAULT_DISPLAY, gl_renderer_opaque_attribs,
&visual_id) < 0)
return -1;
- if (gles2_renderer_output_create(&output->base,
+ if (gl_renderer_output_create(&output->base,
output->fb->native_window) < 0) {
- gles2_renderer_destroy(&compositor->base);
+ gl_renderer_destroy(&compositor->base);
return -1;
}
@@ -309,7 +309,7 @@ android_compositor_destroy(struct weston_compositor *base)
android_seat_destroy(compositor->seat);
- gles2_renderer_destroy(base);
+ gl_renderer_destroy(base);
/* destroys outputs, too */
weston_compositor_shutdown(&compositor->base);
@@ -349,12 +349,12 @@ android_compositor_create(struct wl_display *display, int argc, char *argv[],
compositor->seat = android_seat_create(compositor);
if (!compositor->seat)
- goto err_gles2;
+ goto err_gl;
return &compositor->base;
-err_gles2:
- gles2_renderer_destroy(&compositor->base);
+err_gl:
+ gl_renderer_destroy(&compositor->base);
err_output:
android_output_destroy(&output->base);
err_compositor:
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 6eac8e7..2adec61 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -830,7 +830,7 @@ drm_output_destroy(struct weston_output *output_base)
c->crtc_allocator &= ~(1 << output->crtc_id);
c->connector_allocator &= ~(1 << output->connector_id);
- gles2_renderer_output_destroy(output_base);
+ gl_renderer_output_destroy(output_base);
gbm_surface_destroy(output->surface);
@@ -936,9 +936,9 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
return -1;
}
- gles2_renderer_output_destroy(&output->base);
+ gl_renderer_output_destroy(&output->base);
- if (!gles2_renderer_output_create(&output->base, surface)) {
+ if (!gl_renderer_output_create(&output->base, surface)) {
weston_log("failed to create renderer output\n");
goto err_gbm;
}
@@ -949,7 +949,7 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
&output->connector_id, 1, &drm_mode->mode_info);
if (ret) {
weston_log("failed to set mode\n");
- goto err_gles2;
+ goto err_gl;
}
/* reset rendering stuff. */
@@ -980,8 +980,8 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
weston_output_move(&output->base, output->base.x, output->base.y);
return 0;
-err_gles2:
- gles2_renderer_output_destroy(&output->base);
+err_gl:
+ gl_renderer_output_destroy(&output->base);
err_gbm:
gbm_surface_destroy(surface);
return -1;
@@ -1029,7 +1029,7 @@ init_egl(struct drm_compositor *ec, struct udev_device *device)
ec->drm.fd = fd;
ec->gbm = gbm_create_device(ec->drm.fd);
- if (gles2_renderer_create(&ec->base, ec->gbm, gles2_renderer_opaque_attribs,
+ if (gl_renderer_create(&ec->base, ec->gbm, gl_renderer_opaque_attribs,
NULL) < 0) {
gbm_device_destroy(ec->gbm);
return -1;
@@ -1368,7 +1368,7 @@ create_output_for_connector(struct drm_compositor *ec,
connector->mmWidth, connector->mmHeight,
o ? o->transform : WL_OUTPUT_TRANSFORM_NORMAL);
- if (gles2_renderer_output_create(&output->base, output->surface) < 0)
+ if (gl_renderer_output_create(&output->base, output->surface) < 0)
goto err_output;
output->cursor_bo[0] =
@@ -1948,7 +1948,7 @@ drm_destroy(struct weston_compositor *ec)
weston_compositor_shutdown(ec);
- gles2_renderer_destroy(ec);
+ gl_renderer_destroy(ec);
destroy_sprites(d);
gbm_device_destroy(d->gbm);
@@ -2233,7 +2233,7 @@ err_drm_source:
wl_list_for_each_safe(weston_seat, next, &ec->base.seat_list, link)
evdev_input_destroy(weston_seat);
err_sprite:
- gles2_renderer_destroy(&ec->base);
+ gl_renderer_destroy(&ec->base);
gbm_device_destroy(ec->gbm);
destroy_sprites(ec);
err_udev_dev:
diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
index f812b35..339032a 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -971,7 +971,7 @@ rpi_output_destroy(struct weston_output *base)
vc_dispmanx_element_remove(update, output->egl_element);
vc_dispmanx_update_submit_sync(update);
- gles2_renderer_output_destroy(base);
+ gl_renderer_output_destroy(base);
wl_list_for_each_safe(element, tmp, &output->element_list, link)
rpi_element_destroy(element);
@@ -1086,16 +1086,16 @@ rpi_output_create(struct rpi_compositor *compositor)
0, 0, round(mm_width), round(mm_height),
WL_OUTPUT_TRANSFORM_NORMAL);
- if (gles2_renderer_output_create(&output->base,
+ if (gl_renderer_output_create(&output->base,
(EGLNativeWindowType)&output->egl_window) < 0)
goto out_output;
- if (!eglSurfaceAttrib(gles2_renderer_display(&compositor->base),
- gles2_renderer_output_surface(&output->base),
+ if (!eglSurfaceAttrib(gl_renderer_display(&compositor->base),
+ gl_renderer_output_surface(&output->base),
EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED)) {
print_egl_error_state();
weston_log("Failed to set swap behaviour to preserved.\n");
- goto out_gles2;
+ goto out_gl;
}
wl_list_insert(compositor->base.output_list.prev, &output->base.link);
@@ -1107,8 +1107,8 @@ rpi_output_create(struct rpi_compositor *compositor)
return 0;
-out_gles2:
- gles2_renderer_output_destroy(&output->base);
+out_gl:
+ gl_renderer_output_destroy(&output->base);
out_output:
weston_output_destroy(&output->base);
update = vc_dispmanx_update_start(0);
@@ -1368,7 +1368,7 @@ rpi_compositor_destroy(struct weston_compositor *base)
/* destroys outputs, too */
weston_compositor_shutdown(&compositor->base);
- gles2_renderer_destroy(&compositor->base);
+ gl_renderer_destroy(&compositor->base);
tty_destroy(compositor->tty);
bcm_host_deinit();
@@ -1510,19 +1510,19 @@ rpi_compositor_create(struct wl_display *display, int argc, char *argv[],
*/
bcm_host_init();
- if (gles2_renderer_create(&compositor->base, EGL_DEFAULT_DISPLAY,
+ if (gl_renderer_create(&compositor->base, EGL_DEFAULT_DISPLAY,
config_attrs, NULL) < 0)
goto out_tty;
if (rpi_output_create(compositor) < 0)
- goto out_gles2;
+ goto out_gl;
evdev_input_create(&compositor->base, compositor->udev, seat);
return &compositor->base;
-out_gles2:
- gles2_renderer_destroy(&compositor->base);
+out_gl:
+ gl_renderer_destroy(&compositor->base);
out_tty:
tty_destroy(compositor->tty);
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index d8169b9..5376a20 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -105,7 +105,7 @@ create_border(struct wayland_compositor *c)
edges[2] = c->border.top;
edges[3] = c->border.bottom;
- gles2_renderer_set_border(&c->base, pixman_image_get_width(image),
+ gl_renderer_set_border(&c->base, pixman_image_get_width(image),
pixman_image_get_height(image),
pixman_image_get_data(image), edges);
@@ -144,7 +144,7 @@ wayland_output_destroy(struct weston_output *output_base)
{
struct wayland_output *output = (struct wayland_output *) output_base;
- gles2_renderer_output_destroy(output_base);
+ gl_renderer_output_destroy(output_base);
wl_egl_window_destroy(output->parent.egl_window);
free(output);
@@ -195,7 +195,7 @@ wayland_compositor_create_output(struct wayland_compositor *c,
goto cleanup_output;
}
- if (gles2_renderer_output_create(&output->base,
+ if (gl_renderer_output_create(&output->base,
output->parent.egl_window) < 0)
goto cleanup_window;
@@ -607,7 +607,7 @@ wayland_restore(struct weston_compositor *ec)
static void
wayland_destroy(struct weston_compositor *ec)
{
- gles2_renderer_destroy(ec);
+ gl_renderer_destroy(ec);
weston_compositor_shutdown(ec);
@@ -646,8 +646,8 @@ wayland_compositor_create(struct wl_display *display,
wl_display_dispatch(c->parent.wl_display);
c->base.wl_display = display;
- if (gles2_renderer_create(&c->base, c->parent.wl_display,
- gles2_renderer_alpha_attribs,
+ if (gl_renderer_create(&c->base, c->parent.wl_display,
+ gl_renderer_alpha_attribs,
NULL) < 0)
goto err_display;
@@ -661,9 +661,9 @@ wayland_compositor_create(struct wl_display *display,
/* requires border fields */
if (wayland_compositor_create_output(c, width, height) < 0)
- goto err_gles2;
+ goto err_gl;
- /* requires gles2_renderer_output_state_create called
+ /* requires gl_renderer_output_state_create called
* by wayland_compositor_create_output */
create_border(c);
@@ -674,14 +674,14 @@ wayland_compositor_create(struct wl_display *display,
wl_event_loop_add_fd(loop, fd, WL_EVENT_READABLE,
wayland_compositor_handle_event, c);
if (c->parent.wl_source == NULL)
- goto err_gles2;
+ goto err_gl;
wl_event_source_check(c->parent.wl_source);
return &c->base;
-err_gles2:
- gles2_renderer_destroy(&c->base);
+err_gl:
+ gl_renderer_destroy(&c->base);
err_display:
wl_display_disconnect(c->parent.wl_display);
err_compositor:
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 6e051ce..ba18297 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -341,7 +341,7 @@ x11_output_destroy(struct weston_output *output_base)
wl_list_remove(&output->base.link);
wl_event_source_remove(output->finish_frame_timer);
- gles2_renderer_output_destroy(output_base);
+ gl_renderer_output_destroy(output_base);
xcb_destroy_window(compositor->conn, output->window);
@@ -570,7 +570,7 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
weston_output_init(&output->base, &c->base,
x, y, width, height, transform);
- if (gles2_renderer_output_create(&output->base, output->window) < 0)
+ if (gl_renderer_output_create(&output->base, output->window) < 0)
return NULL;
loop = wl_display_get_event_loop(c->base.wl_display);
@@ -1104,7 +1104,7 @@ x11_destroy(struct weston_compositor *ec)
weston_compositor_shutdown(ec); /* destroys outputs, too */
- gles2_renderer_destroy(ec);
+ gl_renderer_destroy(ec);
XCloseDisplay(compositor->dpy);
free(ec);
@@ -1152,7 +1152,7 @@ x11_compositor_create(struct wl_display *display,
x11_compositor_get_resources(c);
c->base.wl_display = display;
- if (gles2_renderer_create(&c->base, c->dpy, gles2_renderer_opaque_attribs,
+ if (gl_renderer_create(&c->base, c->dpy, gl_renderer_opaque_attribs,
NULL) < 0)
goto err_xdisplay;
@@ -1160,7 +1160,7 @@ x11_compositor_create(struct wl_display *display,
c->base.restore = x11_restore;
if (x11_input_create(c, no_input) < 0)
- goto err_gles2;
+ goto err_gl;
width = option_width ? option_width : 1024;
height = option_height ? option_height : 640;
@@ -1204,8 +1204,8 @@ x11_compositor_create(struct wl_display *display,
err_x11_input:
x11_input_destroy(c);
-err_gles2:
- gles2_renderer_destroy(&c->base);
+err_gl:
+ gl_renderer_destroy(&c->base);
err_xdisplay:
XCloseDisplay(c->dpy);
err_free:
diff --git a/src/gl-renderer.h b/src/gl-renderer.h
index 1c5ed09..7494cff 100644
--- a/src/gl-renderer.h
+++ b/src/gl-renderer.h
@@ -24,23 +24,23 @@
#include <EGL/egl.h>
-extern const EGLint gles2_renderer_opaque_attribs[];
-extern const EGLint gles2_renderer_alpha_attribs[];
+extern const EGLint gl_renderer_opaque_attribs[];
+extern const EGLint gl_renderer_alpha_attribs[];
int
-gles2_renderer_create(struct weston_compositor *ec, EGLNativeDisplayType display,
+gl_renderer_create(struct weston_compositor *ec, EGLNativeDisplayType display,
const EGLint *attribs, const EGLint *visual_id);
EGLDisplay
-gles2_renderer_display(struct weston_compositor *ec);
+gl_renderer_display(struct weston_compositor *ec);
int
-gles2_renderer_output_create(struct weston_output *output,
+gl_renderer_output_create(struct weston_output *output,
EGLNativeWindowType window);
void
-gles2_renderer_output_destroy(struct weston_output *output);
+gl_renderer_output_destroy(struct weston_output *output);
EGLSurface
-gles2_renderer_output_surface(struct weston_output *output);
+gl_renderer_output_surface(struct weston_output *output);
void
-gles2_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t height, void *data,
+gl_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t height, void *data,
int32_t *edges);
void
-gles2_renderer_destroy(struct weston_compositor *ec);
+gl_renderer_destroy(struct weston_compositor *ec);
diff --git a/src/gles2-renderer.c b/src/gles2-renderer.c
index c12d671..45b60dd 100644
--- a/src/gles2-renderer.c
+++ b/src/gles2-renderer.c
@@ -37,7 +37,7 @@
#include <EGL/eglext.h>
#include "weston-egl-ext.h"
-struct gles2_shader {
+struct gl_shader {
GLuint program;
GLuint vertex_shader, fragment_shader;
GLint proj_uniform;
@@ -46,13 +46,13 @@ struct gles2_shader {
GLint color_uniform;
};
-struct gles2_output_state {
+struct gl_output_state {
EGLSurface egl_surface;
};
-struct gles2_surface_state {
+struct gl_surface_state {
GLfloat color[4];
- struct gles2_shader *shader;
+ struct gl_shader *shader;
GLuint textures[3];
int num_textures;
@@ -62,7 +62,7 @@ struct gles2_surface_state {
int num_images;
};
-struct gles2_renderer {
+struct gl_renderer {
struct weston_renderer base;
int fragment_shader_debug;
@@ -89,33 +89,33 @@ struct gles2_renderer {
int has_egl_image_external;
- struct gles2_shader texture_shader_rgba;
- struct gles2_shader texture_shader_rgbx;
- struct gles2_shader texture_shader_egl_external;
- struct gles2_shader texture_shader_y_uv;
- struct gles2_shader texture_shader_y_u_v;
- struct gles2_shader texture_shader_y_xuxv;
- struct gles2_shader invert_color_shader;
- struct gles2_shader solid_shader;
- struct gles2_shader *current_shader;
+ struct gl_shader texture_shader_rgba;
+ struct gl_shader texture_shader_rgbx;
+ struct gl_shader texture_shader_egl_external;
+ struct gl_shader texture_shader_y_uv;
+ struct gl_shader texture_shader_y_u_v;
+ struct gl_shader texture_shader_y_xuxv;
+ struct gl_shader invert_color_shader;
+ struct gl_shader solid_shader;
+ struct gl_shader *current_shader;
};
-static inline struct gles2_output_state *
+static inline struct gl_output_state *
get_output_state(struct weston_output *output)
{
- return (struct gles2_output_state *)output->renderer_state;
+ return (struct gl_output_state *)output->renderer_state;
}
-static inline struct gles2_surface_state *
+static inline struct gl_surface_state *
get_surface_state(struct weston_surface *surface)
{
- return (struct gles2_surface_state *)surface->renderer_state;
+ return (struct gl_surface_state *)surface->renderer_state;
}
-static inline struct gles2_renderer *
+static inline struct gl_renderer *
get_renderer(struct weston_compositor *ec)
{
- return (struct gles2_renderer *)ec->renderer;
+ return (struct gl_renderer *)ec->renderer;
}
static const char *
@@ -585,7 +585,7 @@ static void
triangle_fan_debug(struct weston_surface *surface, int first, int count)
{
struct weston_compositor *compositor = surface->compositor;
- struct gles2_renderer *gr = get_renderer(compositor);
+ struct gl_renderer *gr = get_renderer(compositor);
int i;
GLushort *buffer;
GLushort *index;
@@ -669,8 +669,8 @@ static int
use_output(struct weston_output *output)
{
static int errored;
- struct gles2_output_state *go = get_output_state(output);
- struct gles2_renderer *gr = get_renderer(output->compositor);
+ struct gl_output_state *go = get_output_state(output);
+ struct gl_renderer *gr = get_renderer(output->compositor);
EGLBoolean ret;
ret = eglMakeCurrent(gr->egl_display, go->egl_surface,
@@ -689,8 +689,8 @@ use_output(struct weston_output *output)
}
static void
-use_shader(struct gles2_renderer *gr,
- struct gles2_shader *shader)
+use_shader(struct gl_renderer *gr,
+ struct gl_shader *shader)
{
if (gr->current_shader == shader)
return;
@@ -700,12 +700,12 @@ use_shader(struct gles2_renderer *gr,
}
static void
-shader_uniforms(struct gles2_shader *shader,
+shader_uniforms(struct gl_shader *shader,
struct weston_surface *surface,
struct weston_output *output)
{
int i;
- struct gles2_surface_state *gs = get_surface_state(surface);
+ struct gl_surface_state *gs = get_surface_state(surface);
glUniformMatrix4fv(shader->proj_uniform,
1, GL_FALSE, output->matrix.d);
@@ -721,8 +721,8 @@ draw_surface(struct weston_surface *es, struct weston_output *output,
pixman_region32_t *damage) /* in global coordinates */
{
struct weston_compositor *ec = es->compositor;
- struct gles2_renderer *gr = get_renderer(ec);
- struct gles2_surface_state *gs = get_surface_state(es);
+ struct gl_renderer *gr = get_renderer(ec);
+ struct gl_surface_state *gs = get_surface_state(es);
/* repaint bounding region in global coordinates: */
pixman_region32_t repaint;
/* non-opaque region in surface coordinates: */
@@ -816,7 +816,7 @@ static int
texture_border(struct weston_output *output)
{
struct weston_compositor *ec = output->compositor;
- struct gles2_renderer *gr = get_renderer(ec);
+ struct gl_renderer *gr = get_renderer(ec);
GLfloat *d;
unsigned int *p;
int i, j, k, n;
@@ -892,8 +892,8 @@ static void
draw_border(struct weston_output *output)
{
struct weston_compositor *ec = output->compositor;
- struct gles2_renderer *gr = get_renderer(ec);
- struct gles2_shader *shader = &gr->texture_shader_rgba;
+ struct gl_renderer *gr = get_renderer(ec);
+ struct gl_shader *shader = &gr->texture_shader_rgba;
GLfloat *v;
int n;
@@ -928,12 +928,12 @@ draw_border(struct weston_output *output)
}
static void
-gles2_renderer_repaint_output(struct weston_output *output,
+gl_renderer_repaint_output(struct weston_output *output,
pixman_region32_t *output_damage)
{
- struct gles2_output_state *go = get_output_state(output);
+ struct gl_output_state *go = get_output_state(output);
struct weston_compositor *compositor = output->compositor;
- struct gles2_renderer *gr = get_renderer(compositor);
+ struct gl_renderer *gr = get_renderer(compositor);
EGLBoolean ret;
static int errored;
int32_t width, height, i;
@@ -989,7 +989,7 @@ gles2_renderer_repaint_output(struct weston_output *output,
}
static int
-gles2_renderer_read_pixels(struct weston_output *output,
+gl_renderer_read_pixels(struct weston_output *output,
pixman_format_code_t format, void *pixels,
uint32_t x, uint32_t y,
uint32_t width, uint32_t height)
@@ -1018,10 +1018,10 @@ gles2_renderer_read_pixels(struct weston_output *output,
}
static void
-gles2_renderer_flush_damage(struct weston_surface *surface)
+gl_renderer_flush_damage(struct weston_surface *surface)
{
- struct gles2_renderer *gr = get_renderer(surface->compositor);
- struct gles2_surface_state *gs = get_surface_state(surface);
+ struct gl_renderer *gr = get_renderer(surface->compositor);
+ struct gl_surface_state *gs = get_surface_state(surface);
#ifdef GL_UNPACK_ROW_LENGTH
pixman_box32_t *rectangles;
@@ -1074,7 +1074,7 @@ done:
}
static void
-ensure_textures(struct gles2_surface_state *gs, int num_textures)
+ensure_textures(struct gl_surface_state *gs, int num_textures)
{
int i;
@@ -1094,11 +1094,11 @@ ensure_textures(struct gles2_surface_state *gs, int num_textures)
}
static void
-gles2_renderer_attach(struct weston_surface *es, struct wl_buffer *buffer)
+gl_renderer_attach(struct weston_surface *es, struct wl_buffer *buffer)
{
struct weston_compositor *ec = es->compositor;
- struct gles2_renderer *gr = get_renderer(ec);
- struct gles2_surface_state *gs = get_surface_state(es);
+ struct gl_renderer *gr = get_renderer(ec);
+ struct gl_surface_state *gs = get_surface_state(es);
EGLint attribs[3], format;
int i, num_planes;
@@ -1186,11 +1186,11 @@ gles2_renderer_attach(struct weston_surface *es, struct wl_buffer *buffer)
}
static void
-gles2_renderer_surface_set_color(struct weston_surface *surface,
+gl_renderer_surface_set_color(struct weston_surface *surface,
float red, float green, float blue, float alpha)
{
- struct gles2_surface_state *gs = get_surface_state(surface);
- struct gles2_renderer *gr = get_renderer(surface->compositor);
+ struct gl_surface_state *gs = get_surface_state(surface);
+ struct gl_renderer *gr = get_renderer(surface->compositor);
gs->color[0] = red;
gs->color[1] = green;
@@ -1201,9 +1201,9 @@ gles2_renderer_surface_set_color(struct weston_surface *surface,
}
static int
-gles2_renderer_create_surface(struct weston_surface *surface)
+gl_renderer_create_surface(struct weston_surface *surface)
{
- struct gles2_surface_state *gs;
+ struct gl_surface_state *gs;
gs = calloc(1, sizeof *gs);
@@ -1216,10 +1216,10 @@ gles2_renderer_create_surface(struct weston_surface *surface)
}
static void
-gles2_renderer_destroy_surface(struct weston_surface *surface)
+gl_renderer_destroy_surface(struct weston_surface *surface)
{
- struct gles2_surface_state *gs = get_surface_state(surface);
- struct gles2_renderer *gr = get_renderer(surface->compositor);
+ struct gl_surface_state *gs = get_surface_state(surface);
+ struct gl_renderer *gr = get_renderer(surface->compositor);
int i;
glDeleteTextures(gs->num_textures, gs->textures);
@@ -1359,15 +1359,14 @@ compile_shader(GLenum type, int count, const char **sources)
}
static int
-shader_init(struct gles2_shader *shader, struct weston_compositor *ec,
+shader_init(struct gl_shader *shader, struct weston_compositor *ec,
const char *vertex_source, const char *fragment_source)
{
char msg[512];
GLint status;
int count;
const char *sources[3];
- struct gles2_renderer *renderer =
- (struct gles2_renderer *) ec->renderer;
+ struct gl_renderer *renderer = get_renderer(ec);
shader->vertex_shader =
compile_shader(GL_VERTEX_SHADER, 1, &vertex_source);
@@ -1411,7 +1410,7 @@ shader_init(struct gles2_shader *shader, struct weston_compositor *ec,
}
static void
-shader_release(struct gles2_shader *shader)
+shader_release(struct gl_shader *shader)
{
glDeleteShader(shader->vertex_shader);
glDeleteShader(shader->fragment_shader);
@@ -1503,7 +1502,7 @@ log_egl_config_info(EGLDisplay egldpy, EGLConfig eglconfig)
}
static void
-output_apply_border(struct weston_output *output, struct gles2_renderer *gr)
+output_apply_border(struct weston_output *output, struct gl_renderer *gr)
{
output->border.top = gr->border.top;
output->border.bottom = gr->border.bottom;
@@ -1512,10 +1511,10 @@ output_apply_border(struct weston_output *output, struct gles2_renderer *gr)
}
WL_EXPORT void
-gles2_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t height, void *data,
+gl_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t height, void *data,
int32_t *edges)
{
- struct gles2_renderer *gr = get_renderer(ec);
+ struct gl_renderer *gr = get_renderer(ec);
struct weston_output *output;
gr->border.left = edges[0];
@@ -1544,15 +1543,15 @@ gles2_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t h
}
static int
-gles2_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface);
+gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface);
WL_EXPORT int
-gles2_renderer_output_create(struct weston_output *output,
+gl_renderer_output_create(struct weston_output *output,
EGLNativeWindowType window)
{
struct weston_compositor *ec = output->compositor;
- struct gles2_renderer *gr = get_renderer(ec);
- struct gles2_output_state *go = calloc(1, sizeof *go);
+ struct gl_renderer *gr = get_renderer(ec);
+ struct gl_output_state *go = calloc(1, sizeof *go);
if (!go)
return -1;
@@ -1569,7 +1568,7 @@ gles2_renderer_output_create(struct weston_output *output,
}
if (gr->egl_context == NULL)
- if (gles2_renderer_setup(ec, go->egl_surface) < 0) {
+ if (gl_renderer_setup(ec, go->egl_surface) < 0) {
free(go);
return -1;
}
@@ -1582,10 +1581,10 @@ gles2_renderer_output_create(struct weston_output *output,
}
WL_EXPORT void
-gles2_renderer_output_destroy(struct weston_output *output)
+gl_renderer_output_destroy(struct weston_output *output)
{
- struct gles2_renderer *gr = get_renderer(output->compositor);
- struct gles2_output_state *go = get_output_state(output);
+ struct gl_renderer *gr = get_renderer(output->compositor);
+ struct gl_output_state *go = get_output_state(output);
eglDestroySurface(gr->egl_display, go->egl_surface);
@@ -1593,15 +1592,15 @@ gles2_renderer_output_destroy(struct weston_output *output)
}
WL_EXPORT EGLSurface
-gles2_renderer_output_surface(struct weston_output *output)
+gl_renderer_output_surface(struct weston_output *output)
{
return get_output_state(output)->egl_surface;
}
WL_EXPORT void
-gles2_renderer_destroy(struct weston_compositor *ec)
+gl_renderer_destroy(struct weston_compositor *ec)
{
- struct gles2_renderer *gr = get_renderer(ec);
+ struct gl_renderer *gr = get_renderer(ec);
if (gr->has_bind_display)
gr->unbind_display(gr->egl_display, ec->wl_display);
@@ -1616,7 +1615,7 @@ gles2_renderer_destroy(struct weston_compositor *ec)
}
static int
-egl_choose_config(struct gles2_renderer *gr, const EGLint *attribs,
+egl_choose_config(struct gl_renderer *gr, const EGLint *attribs,
const EGLint *visual_id)
{
EGLint count = 0;
@@ -1659,7 +1658,7 @@ out:
return -1;
}
-WL_EXPORT const EGLint gles2_renderer_opaque_attribs[] = {
+WL_EXPORT const EGLint gl_renderer_opaque_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
@@ -1669,7 +1668,7 @@ WL_EXPORT const EGLint gles2_renderer_opaque_attribs[] = {
EGL_NONE
};
-WL_EXPORT const EGLint gles2_renderer_alpha_attribs[] = {
+WL_EXPORT const EGLint gl_renderer_alpha_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
@@ -1680,10 +1679,10 @@ WL_EXPORT const EGLint gles2_renderer_alpha_attribs[] = {
};
WL_EXPORT int
-gles2_renderer_create(struct weston_compositor *ec, EGLNativeDisplayType display,
+gl_renderer_create(struct weston_compositor *ec, EGLNativeDisplayType display,
const EGLint *attribs, const EGLint *visual_id)
{
- struct gles2_renderer *gr;
+ struct gl_renderer *gr;
EGLint major, minor;
gr = calloc(1, sizeof *gr);
@@ -1691,13 +1690,13 @@ gles2_renderer_create(struct weston_compositor *ec, EGLNativeDisplayType display
if (gr == NULL)
return -1;
- gr->base.read_pixels = gles2_renderer_read_pixels;
- gr->base.repaint_output = gles2_renderer_repaint_output;
- gr->base.flush_damage = gles2_renderer_flush_damage;
- gr->base.attach = gles2_renderer_attach;
- gr->base.create_surface = gles2_renderer_create_surface;
- gr->base.surface_set_color = gles2_renderer_surface_set_color;
- gr->base.destroy_surface = gles2_renderer_destroy_surface;
+ gr->base.read_pixels = gl_renderer_read_pixels;
+ gr->base.repaint_output = gl_renderer_repaint_output;
+ gr->base.flush_damage = gl_renderer_flush_damage;
+ gr->base.attach = gl_renderer_attach;
+ gr->base.create_surface = gl_renderer_create_surface;
+ gr->base.surface_set_color = gl_renderer_surface_set_color;
+ gr->base.destroy_surface = gl_renderer_destroy_surface;
gr->egl_display = eglGetDisplay(display);
if (gr->egl_display == EGL_NO_DISPLAY) {
@@ -1726,7 +1725,7 @@ err_egl:
}
WL_EXPORT EGLDisplay
-gles2_renderer_display(struct weston_compositor *ec)
+gl_renderer_display(struct weston_compositor *ec)
{
return get_renderer(ec)->egl_display;
}
@@ -1734,7 +1733,7 @@ gles2_renderer_display(struct weston_compositor *ec)
static int
compile_shaders(struct weston_compositor *ec)
{
- struct gles2_renderer *gr = get_renderer(ec);
+ struct gl_renderer *gr = get_renderer(ec);
if (shader_init(&gr->texture_shader_rgba, ec,
vertex_shader, texture_fragment_shader_rgba) < 0)
@@ -1767,7 +1766,7 @@ fragment_debug_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
void *data)
{
struct weston_compositor *ec = data;
- struct gles2_renderer *gr = get_renderer(ec);
+ struct gl_renderer *gr = get_renderer(ec);
struct weston_output *output;
gr->fragment_shader_debug ^= 1;
@@ -1787,9 +1786,9 @@ fragment_debug_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
}
static int
-gles2_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
+gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
{
- struct gles2_renderer *gr = get_renderer(ec);
+ struct gl_renderer *gr = get_renderer(ec);
const char *extensions;
EGLBoolean ret;
--
1.8.0
More information about the wayland-devel
mailing list