struct gl_renderer {
struct weston_renderer base;
int fragment_shader_debug;
+ int fan_debug;
EGLDisplay egl_display;
EGLContext egl_context;
pixman_region32_t *surf_region)
{
struct weston_compositor *ec = es->compositor;
+ struct gl_renderer *gr = get_renderer(ec);
GLfloat *v;
unsigned int *vtxcnt;
int i, first, nfans;
for (i = 0, first = 0; i < nfans; i++) {
glDrawArrays(GL_TRIANGLE_FAN, first, vtxcnt[i]);
- if (ec->fan_debug)
+ if (gr->fan_debug)
triangle_fan_debug(es, first, vtxcnt[i]);
first += vtxcnt[i];
}
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- if (ec->fan_debug) {
+ if (gr->fan_debug) {
use_shader(gr, &gr->solid_shader);
shader_uniforms(&gr->solid_shader, es, output);
}
/* if debugging, redraw everything outside the damage to clean up
* debug lines from the previous draw on this buffer:
*/
- if (compositor->fan_debug) {
+ if (gr->fan_debug) {
pixman_region32_t undamaged;
pixman_region32_init(&undamaged);
pixman_region32_subtract(&undamaged, &output->region,
output_damage);
- compositor->fan_debug = 0;
+ gr->fan_debug = 0;
repaint_surfaces(output, &undamaged);
- compositor->fan_debug = 1;
+ gr->fan_debug = 1;
pixman_region32_fini(&undamaged);
}
weston_output_damage(output);
}
+static void
+fan_debug_repaint_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
+ void *data)
+{
+ struct weston_compositor *compositor = data;
+ struct gl_renderer *gr = get_renderer(compositor);
+
+ gr->fan_debug = !gr->fan_debug;
+ weston_compositor_damage_all(compositor);
+}
+
static int
gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
{
weston_compositor_add_debug_binding(ec, KEY_S,
fragment_debug_binding, ec);
+ weston_compositor_add_debug_binding(ec, KEY_F,
+ fan_debug_repaint_binding, ec);
weston_log("GL ES 2 renderer features:\n");
weston_log_continue(STAMP_SPACE "read-back format: %s\n",
output->set_backlight(output, output->backlight_current);
}
-static void
-fan_debug_repaint_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
- void *data)
-{
- struct desktop_shell *shell = data;
- struct weston_compositor *compositor = shell->compositor;
- compositor->fan_debug = !compositor->fan_debug;
- weston_compositor_damage_all(compositor);
-}
-
struct debug_binding_grab {
struct weston_keyboard_grab grab;
struct weston_seat *seat;
/* Debug bindings */
weston_compositor_add_key_binding(ec, KEY_SPACE, mod | MODIFIER_SHIFT,
debug_binding, shell);
- weston_compositor_add_debug_binding(ec, KEY_F,
- fan_debug_repaint_binding, shell);
}
WL_EXPORT int