From 36eb48d0cacd23dff66904218f9402bbdb95312c Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Mon, 28 Oct 2019 19:04:00 +0000 Subject: [PATCH] render: Add damage checking shader program --- src/render.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/render.c b/src/render.c index 057ec03..35a7cf2 100644 --- a/src/render.c +++ b/src/render.c @@ -312,6 +312,7 @@ void renderer_destroy(struct renderer* self) glDeleteProgram(self->dmabuf_shader_program); glDeleteProgram(self->texture_shader_program); + glDeleteProgram(self->damage_shader_program); eglMakeCurrent(self->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglDestroySurface(self->display, self->surface); @@ -396,6 +397,11 @@ int renderer_init(struct renderer* self, uint32_t width, uint32_t height) "shaders/texture-fragment.glsl") < 0) goto shader_failure; + if (gl_compile_shader_program(&self->damage_shader_program, + "shaders/texture-damage-vertex.glsl", + "shaders/texture-damage-fragment.glsl") < 0) + goto shader_failure; + self->width = width; self->height = height; glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &self->read_format); @@ -554,7 +560,7 @@ void render_check_damage(struct renderer* self, GLenum target, GLuint tex) for (int y = 0; y < height; ++y) for (int x = 0; x < width; ++x) - if (buffer[y * width + x]) + if (buffer[y * width + x] & 0xff00) pixman_region_union_rect(damage, damage, x * 32, y * 32, 32, 32);