[PATCH v5 11/11] Rename gles2-renderer to gl-renderer.
John Kåre Alsaker
john.kare.alsaker at gmail.com
Fri Nov 9 12:21:20 PST 2012
---
src/compositor-android.c | 22 +++---
src/compositor-drm.c | 28 ++++----
src/compositor-rpi.c | 28 ++++----
src/compositor-wayland.c | 26 +++----
src/compositor-x11.c | 18 ++---
src/gl-renderer.h | 28 ++++----
src/gles2-renderer.c | 179 +++++++++++++++++++++++------------------------
7 files changed, 164 insertions(+), 165 deletions(-)
diff --git a/src/compositor-android.c b/src/compositor-android.c
index 4e0b410..8c1c735 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_state_destroy(base->compositor,
+ gl_renderer_output_state_destroy(base->compositor,
base->renderer_state);
android_framebuffer_destroy(output->fb);
@@ -287,22 +287,22 @@ static int
android_init_egl(struct android_compositor *compositor,
struct android_output *output)
{
- struct gles2_output_state *go;
+ struct gl_output_state *go;
EGLint visual_id = output->fb->format;
- if (gles2_renderer_init(&compositor->base,
- EGL_DEFAULT_DISPLAY, gles2_opaque_attribs,
+ if (gl_renderer_init(&compositor->base,
+ EGL_DEFAULT_DISPLAY, gl_opaque_attribs,
&visual_id) < 0)
return -1;
- go = gles2_renderer_output_state_create(&compositor->base,
+ go = gl_renderer_output_state_create(&compositor->base,
output->fb->native_window);
if (!go) {
- gles2_renderer_destroy(&compositor->base);
+ gl_renderer_destroy(&compositor->base);
return -1;
}
- gles2_renderer_output_bind(&output->base, go);
+ gl_renderer_output_bind(&output->base, go);
return 0;
}
@@ -314,7 +314,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);
@@ -354,12 +354,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 d3ebf23..8602bcb 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_state_destroy(output_base->compositor,
+ gl_renderer_output_state_destroy(output_base->compositor,
output_base->renderer_state);
gbm_surface_destroy(output->surface);
@@ -878,7 +878,7 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
int ret;
struct drm_compositor *ec;
struct gbm_surface *surface;
- struct gles2_output_state *go;
+ struct gl_output_state *go;
if (output_base == NULL) {
weston_log("output is NULL.\n");
@@ -938,7 +938,7 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
return -1;
}
- go = gles2_renderer_output_state_create(&ec->base, surface);
+ go = gl_renderer_output_state_create(&ec->base, surface);
if (!go)
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. */
@@ -971,12 +971,12 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
}
output->next = NULL;
- gles2_renderer_output_state_destroy(output_base->compositor,
+ gl_renderer_output_state_destroy(output_base->compositor,
output_base->renderer_state);
gbm_surface_destroy(output->surface);
output->surface = surface;
- gles2_renderer_output_bind(&output->base, go);
+ gl_renderer_output_bind(&output->base, go);
/*update output*/
output->base.current = &drm_mode->base;
@@ -984,8 +984,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_state_destroy(&ec->base, go);
+err_gl:
+ gl_renderer_output_state_destroy(&ec->base, go);
err_gbm:
gbm_surface_destroy(surface);
return -1;
@@ -1033,7 +1033,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_init(&ec->base, ec->gbm, gles2_opaque_attribs,
+ if (gl_renderer_init(&ec->base, ec->gbm, gl_opaque_attribs,
NULL) < 0) {
gbm_device_destroy(ec->gbm);
return -1;
@@ -1240,7 +1240,7 @@ create_output_for_connector(struct drm_compositor *ec,
int i;
char name[32];
const char *type_name;
- struct gles2_output_state *go;
+ struct gl_output_state *go;
i = find_crtc_for_connector(ec, resources, connector);
if (i < 0) {
@@ -1369,7 +1369,7 @@ create_output_for_connector(struct drm_compositor *ec,
goto err_free;
}
- go = gles2_renderer_output_state_create(&ec->base, output->surface);
+ go = gl_renderer_output_state_create(&ec->base, output->surface);
if (!go)
goto err_output;
@@ -1397,7 +1397,7 @@ create_output_for_connector(struct drm_compositor *ec,
wl_list_insert(ec->base.output_list.prev, &output->base.link);
- gles2_renderer_output_bind(&output->base, go);
+ gl_renderer_output_bind(&output->base, go);
output->base.origin = output->base.current;
output->base.repaint = drm_output_repaint;
@@ -1956,7 +1956,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);
@@ -2241,7 +2241,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 30684f5..eab8bef 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_state_destroy(base->compositor,
+ gl_renderer_output_state_destroy(base->compositor,
base->renderer_state);
wl_list_for_each_safe(element, tmp, &output->element_list, link)
@@ -998,7 +998,7 @@ rpi_output_create(struct rpi_compositor *compositor)
VC_RECT_T src_rect;
int ret;
float mm_width, mm_height;
- struct gles2_output_state *go;
+ struct gl_output_state *go;
VC_DISPMANX_ALPHA_T alphasetup = {
DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS,
255, /* opacity 0-255 */
@@ -1052,17 +1052,17 @@ rpi_output_create(struct rpi_compositor *compositor)
output->egl_window.width = modeinfo.width;
output->egl_window.height = modeinfo.height;
- go = gles2_renderer_output_state_create(&compositor->base,
+ go = gl_renderer_output_state_create(&compositor->base,
(EGLNativeWindowType)&output->egl_window);
if (!go)
goto out_output;
- if (!eglSurfaceAttrib(gles2_renderer_display(&compositor->base),
- gles2_renderer_output_state_surface(go),
+ if (!eglSurfaceAttrib(gl_renderer_display(&compositor->base),
+ gl_renderer_output_state_surface(go),
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;
}
output->base.repaint = rpi_output_repaint;
@@ -1102,7 +1102,7 @@ rpi_output_create(struct rpi_compositor *compositor)
WL_OUTPUT_TRANSFORM_NORMAL);
wl_list_insert(compositor->base.output_list.prev, &output->base.link);
- gles2_renderer_output_bind(&output->base, go);
+ gl_renderer_output_bind(&output->base, go);
weston_log("Raspberry Pi HDMI output %dx%d px\n",
output->mode.width, output->mode.height);
@@ -1111,8 +1111,8 @@ rpi_output_create(struct rpi_compositor *compositor)
return 0;
-out_gles2:
- gles2_renderer_output_state_destroy(&compositor->base,
+out_gl:
+ gl_renderer_output_state_destroy(&compositor->base,
output->base.renderer_state);
out_output:
weston_output_destroy(&output->base);
@@ -1373,7 +1373,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();
@@ -1515,19 +1515,19 @@ rpi_compositor_create(struct wl_display *display, int argc, char *argv[],
*/
bcm_host_init();
- if (gles2_renderer_init(&compositor->base, EGL_DEFAULT_DISPLAY,
+ if (gl_renderer_init(&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 f8d3662..71afb99 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_state_destroy(output_base->compositor,
+ gl_renderer_output_state_destroy(output_base->compositor,
output_base->renderer_state);
wl_egl_window_destroy(output->parent.egl_window);
@@ -160,7 +160,7 @@ wayland_compositor_create_output(struct wayland_compositor *c,
int width, int height)
{
struct wayland_output *output;
- struct gles2_output_state *go;
+ struct gl_output_state *go;
output = malloc(sizeof *output);
if (output == NULL)
@@ -197,12 +197,12 @@ wayland_compositor_create_output(struct wayland_compositor *c,
goto cleanup_output;
}
- go = gles2_renderer_output_state_create(&c->base,
+ go = gl_renderer_output_state_create(&c->base,
output->parent.egl_window);
if (!go)
goto cleanup_window;
- gles2_renderer_output_bind(&output->base, go);
+ gl_renderer_output_bind(&output->base, go);
output->parent.shell_surface =
wl_shell_get_shell_surface(c->parent.shell,
@@ -612,7 +612,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);
@@ -651,8 +651,8 @@ wayland_compositor_create(struct wl_display *display,
wl_display_dispatch(c->parent.wl_display);
c->base.wl_display = display;
- if (gles2_renderer_init(&c->base, c->parent.wl_display,
- gles2_alpha_attribs,
+ if (gl_renderer_init(&c->base, c->parent.wl_display,
+ gl_alpha_attribs,
NULL) < 0)
goto err_display;
@@ -666,9 +666,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);
@@ -679,14 +679,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 84e7cc2..084cbcd 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_state_destroy(output_base->compositor,
+ gl_renderer_output_state_destroy(output_base->compositor,
output_base->renderer_state);
xcb_destroy_window(compositor->conn, output->window);
@@ -466,7 +466,7 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
xcb_screen_iterator_t iter;
struct wm_normal_hints normal_hints;
struct wl_event_loop *loop;
- struct gles2_output_state *go;
+ struct gl_output_state *go;
uint32_t mask = XCB_CW_EVENT_MASK | XCB_CW_CURSOR;
xcb_atom_t atom_list[1];
uint32_t values[2] = {
@@ -559,7 +559,7 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
x11_output_wait_for_map(c, output);
- go = gles2_renderer_output_state_create(&c->base, output->window);
+ go = gl_renderer_output_state_create(&c->base, output->window);
if (!go)
return NULL;
@@ -582,7 +582,7 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
wl_list_insert(c->base.output_list.prev, &output->base.link);
- gles2_renderer_output_bind(&output->base, go);
+ gl_renderer_output_bind(&output->base, go);
weston_log("x11 output %dx%d, window id %d\n",
width, height, output->window);
@@ -1109,7 +1109,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);
@@ -1157,7 +1157,7 @@ x11_compositor_create(struct wl_display *display,
x11_compositor_get_resources(c);
c->base.wl_display = display;
- if (gles2_renderer_init(&c->base, c->dpy, gles2_opaque_attribs,
+ if (gl_renderer_init(&c->base, c->dpy, gl_opaque_attribs,
NULL) < 0)
goto err_xdisplay;
@@ -1165,7 +1165,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;
@@ -1209,8 +1209,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 c8edfb5..93c2d87 100644
--- a/src/gl-renderer.h
+++ b/src/gl-renderer.h
@@ -24,29 +24,29 @@
#include <EGL/egl.h>
-struct gles2_output_state;
+struct gl_output_state;
-extern const EGLint gles2_opaque_attribs[];
-extern const EGLint gles2_alpha_attribs[];
+extern const EGLint gl_opaque_attribs[];
+extern const EGLint gl_alpha_attribs[];
int
-gles2_renderer_init(struct weston_compositor *ec, EGLNativeDisplayType display,
+gl_renderer_init(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);
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_output_state *
-gles2_renderer_output_state_create(struct weston_compositor *ec,
+struct gl_output_state *
+gl_renderer_output_state_create(struct weston_compositor *ec,
EGLNativeWindowType window);
void
-gles2_renderer_output_state_destroy(struct weston_compositor *ec,
- struct gles2_output_state *go);
+gl_renderer_output_state_destroy(struct weston_compositor *ec,
+ struct gl_output_state *go);
EGLSurface
-gles2_renderer_output_state_surface(struct gles2_output_state *go);
+gl_renderer_output_state_surface(struct gl_output_state *go);
void
-gles2_renderer_output_bind(struct weston_output *output,
- struct gles2_output_state *go);
+gl_renderer_output_bind(struct weston_output *output,
+ struct gl_output_state *go);
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 df0c9eb..c7aeeaf 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,14 +1543,14 @@ 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 struct gles2_output_state *
-gles2_renderer_output_state_create(struct weston_compositor *ec,
+WL_EXPORT struct gl_output_state *
+gl_renderer_output_state_create(struct weston_compositor *ec,
EGLNativeWindowType window)
{
- 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 NULL;
@@ -1568,7 +1567,7 @@ gles2_renderer_output_state_create(struct weston_compositor *ec,
}
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 NULL;
}
@@ -1577,10 +1576,10 @@ gles2_renderer_output_state_create(struct weston_compositor *ec,
}
WL_EXPORT void
-gles2_renderer_output_state_destroy(struct weston_compositor *ec,
- struct gles2_output_state *go)
+gl_renderer_output_state_destroy(struct weston_compositor *ec,
+ struct gl_output_state *go)
{
- struct gles2_renderer *gr = get_renderer(ec);
+ struct gl_renderer *gr = get_renderer(ec);
eglDestroySurface(gr->egl_display, go->egl_surface);
@@ -1588,16 +1587,16 @@ gles2_renderer_output_state_destroy(struct weston_compositor *ec,
}
WL_EXPORT EGLSurface
-gles2_renderer_output_state_surface(struct gles2_output_state *go)
+gl_renderer_output_state_surface(struct gl_output_state *go)
{
return go->egl_surface;
}
WL_EXPORT void
-gles2_renderer_output_bind(struct weston_output *output,
- struct gles2_output_state *go)
+gl_renderer_output_bind(struct weston_output *output,
+ struct gl_output_state *go)
{
- struct gles2_renderer *gr = get_renderer(output->compositor);
+ struct gl_renderer *gr = get_renderer(output->compositor);
output->renderer_state = go;
@@ -1605,9 +1604,9 @@ gles2_renderer_output_bind(struct weston_output *output,
}
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);
@@ -1623,7 +1622,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;
@@ -1666,7 +1665,7 @@ out:
return -1;
}
-WL_EXPORT const EGLint gles2_opaque_attribs[] = {
+WL_EXPORT const EGLint gl_opaque_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
@@ -1676,7 +1675,7 @@ WL_EXPORT const EGLint gles2_opaque_attribs[] = {
EGL_NONE
};
-WL_EXPORT const EGLint gles2_alpha_attribs[] = {
+WL_EXPORT const EGLint gl_alpha_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
@@ -1687,10 +1686,10 @@ WL_EXPORT const EGLint gles2_alpha_attribs[] = {
};
WL_EXPORT int
-gles2_renderer_init(struct weston_compositor *ec, EGLNativeDisplayType display,
+gl_renderer_init(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);
@@ -1698,13 +1697,13 @@ gles2_renderer_init(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) {
@@ -1733,7 +1732,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;
}
@@ -1741,7 +1740,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)
@@ -1774,7 +1773,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;
@@ -1794,9 +1793,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