mirror of
https://github.com/yshui/picom.git
synced 2024-11-11 13:51:02 -05:00
backend: gl_common: add time
uniform to (custom) window shader
This commit is contained in:
parent
81768f4a11
commit
c95152e83e
2 changed files with 9 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
#include <xcb/render.h> // for xcb_render_fixed_t, XXX
|
#include <xcb/render.h> // for xcb_render_fixed_t, XXX
|
||||||
|
|
||||||
#include "backend/backend.h"
|
#include "backend/backend.h"
|
||||||
|
@ -416,6 +417,12 @@ static void _gl_compose(backend_t *base, struct backend_image *img, GLuint targe
|
||||||
}
|
}
|
||||||
glUniform1f(win_shader->uniform_border_width, (float)border_width);
|
glUniform1f(win_shader->uniform_border_width, (float)border_width);
|
||||||
}
|
}
|
||||||
|
if (win_shader->uniform_time >= 0) {
|
||||||
|
struct timespec ts;
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
glUniform1f(win_shader->uniform_time,
|
||||||
|
(float)ts.tv_sec * 1000.0f + (float)ts.tv_nsec / 1.0e6f);
|
||||||
|
}
|
||||||
|
|
||||||
// log_trace("Draw: %d, %d, %d, %d -> %d, %d (%d, %d) z %d\n",
|
// log_trace("Draw: %d, %d, %d, %d -> %d, %d (%d, %d) z %d\n",
|
||||||
// x, y, width, height, dx, dy, ptex->width, ptex->height, z);
|
// x, y, width, height, dx, dy, ptex->width, ptex->height, z);
|
||||||
|
@ -916,6 +923,7 @@ static bool gl_win_shader_from_stringv(const char **vshader_strv,
|
||||||
bind_uniform(ret, max_brightness);
|
bind_uniform(ret, max_brightness);
|
||||||
bind_uniform(ret, corner_radius);
|
bind_uniform(ret, corner_radius);
|
||||||
bind_uniform(ret, border_width);
|
bind_uniform(ret, border_width);
|
||||||
|
bind_uniform(ret, time);
|
||||||
|
|
||||||
gl_check_err();
|
gl_check_err();
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ typedef struct {
|
||||||
GLint uniform_max_brightness;
|
GLint uniform_max_brightness;
|
||||||
GLint uniform_corner_radius;
|
GLint uniform_corner_radius;
|
||||||
GLint uniform_border_width;
|
GLint uniform_border_width;
|
||||||
|
GLint uniform_time;
|
||||||
} gl_win_shader_t;
|
} gl_win_shader_t;
|
||||||
|
|
||||||
// Program and uniforms for brightness shader
|
// Program and uniforms for brightness shader
|
||||||
|
|
Loading…
Reference in a new issue