1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-18 13:55:36 -05:00

legacy glx: store tex_scr location for round corner shader

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2021-04-11 15:25:12 +01:00
parent d9bfd0192d
commit b2f9f80a28
No known key found for this signature in database
GPG key ID: D3A4405BE6CC17F4
2 changed files with 8 additions and 2 deletions

View file

@ -104,6 +104,7 @@ bool glx_init(session_t *ps, bool need_render) {
ppass->unifm_borderw = -1;
ppass->unifm_borderc = -1;
ppass->unifm_resolution = -1;
ppass->unifm_tex_scr = -1;
}
glx_session_t *psglx = ps->psglx;
@ -551,6 +552,7 @@ bool glx_init_rounded_corners(session_t *ps) {
P_GET_UNIFM_LOC("u_borderw", unifm_borderw);
P_GET_UNIFM_LOC("u_borderc", unifm_borderc);
P_GET_UNIFM_LOC("u_resolution", unifm_resolution);
P_GET_UNIFM_LOC("tex_scr", unifm_tex_scr);
#undef P_GET_UNIFM_LOC
success = true;
@ -1179,9 +1181,10 @@ bool glx_round_corners_dst(session_t *ps, struct managed_win *w,
glActiveTexture(GL_TEXTURE0);
glBindTexture(ptex->target, ptex->texture);
GLint loc_sampler = glGetUniformLocation(ppass->prog, "tex_scr");
glUniform1i(loc_sampler, (GLint)0);
if (ppass->unifm_tex_scr >= 0) {
glUniform1i(ppass->unifm_tex_scr, (GLint)0);
}
if (ppass->unifm_radius >= 0) {
glUniform1f(ppass->unifm_radius, cr);
}

View file

@ -57,6 +57,9 @@ typedef struct {
GLint unifm_borderc;
/// Location of uniform "resolution" in rounded-corners GLSL program.
GLint unifm_resolution;
/// Location of uniform "texture_scr" in rounded-corners GLSL program.
GLint unifm_tex_scr;
} glx_round_pass_t;
/// Structure containing GLX-dependent data for a session.