@@ -233,9 +233,6 @@ dithered-present = false;
|
||||
# Enable/disable VSync.
|
||||
# vsync = true
|
||||
|
||||
# Enable remote control via D-Bus. See the *D-BUS API* section below for more details.
|
||||
# dbus = false
|
||||
|
||||
# Try to detect WM windows (a non-override-redirect window with no
|
||||
# child that has 'WM_STATE') and mark them as active.
|
||||
#
|
||||
|
||||
@@ -896,12 +896,6 @@ static backend_t *backend_xrender_init(session_t *ps) {
|
||||
&ps->c, ps->c.screen_info->root_visual, xd->target_win,
|
||||
XCB_RENDER_CP_SUBWINDOW_MODE, &pa);
|
||||
|
||||
auto pictfmt = x_get_pictform_for_visual(&ps->c, ps->c.screen_info->root_visual);
|
||||
if (!pictfmt) {
|
||||
log_fatal("Default visual is invalid");
|
||||
abort();
|
||||
}
|
||||
|
||||
xd->vsync = ps->o.vsync;
|
||||
if (ps->present_exists) {
|
||||
auto eid = x_new_id(&ps->c);
|
||||
@@ -930,14 +924,15 @@ static backend_t *backend_xrender_init(session_t *ps) {
|
||||
// double buffering.
|
||||
int first_buffer_index = xd->vsync ? 0 : 2;
|
||||
for (int i = first_buffer_index; i < 3; i++) {
|
||||
xd->back_pixmap[i] =
|
||||
x_create_pixmap(&ps->c, pictfmt->depth, to_u16_checked(ps->root_width),
|
||||
to_u16_checked(ps->root_height));
|
||||
xd->back_pixmap[i] = x_create_pixmap(&ps->c, ps->c.screen_info->root_depth,
|
||||
to_u16_checked(ps->root_width),
|
||||
to_u16_checked(ps->root_height));
|
||||
const uint32_t pic_attrs_mask = XCB_RENDER_CP_REPEAT;
|
||||
const xcb_render_create_picture_value_list_t pic_attrs = {
|
||||
.repeat = XCB_RENDER_REPEAT_PAD};
|
||||
xd->back[i] = x_create_picture_with_pictfmt_and_pixmap(
|
||||
&ps->c, pictfmt, xd->back_pixmap[i], pic_attrs_mask, &pic_attrs);
|
||||
xd->back[i] = x_create_picture_with_visual_and_pixmap(
|
||||
&ps->c, ps->c.screen_info->root_visual, xd->back_pixmap[i],
|
||||
pic_attrs_mask, &pic_attrs);
|
||||
xd->buffer_age[i] = -1;
|
||||
if (xd->back_pixmap[i] == XCB_NONE || xd->back[i] == XCB_NONE) {
|
||||
log_error("Cannot create pixmap for rendering");
|
||||
|
||||
15
src/c2.c
15
src/c2.c
@@ -233,14 +233,16 @@ static inline long winprop_get_int(winprop_t prop, size_t index) {
|
||||
*/
|
||||
static inline int strcmp_wd(const char *needle, const char *src) {
|
||||
int ret = mstrncmp(needle, src);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
char c = src[strlen(needle)];
|
||||
if (isalnum((unsigned char)c) || '_' == c)
|
||||
if (isalnum((unsigned char)c) || '_' == c) {
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,8 +256,9 @@ static inline attr_unused bool c2_ptr_isempty(const c2_ptr_t p) {
|
||||
* Reset a c2_ptr_t.
|
||||
*/
|
||||
static inline void c2_ptr_reset(c2_ptr_t *pp) {
|
||||
if (pp)
|
||||
if (pp) {
|
||||
memcpy(pp, &C2_PTR_NULL, sizeof(c2_ptr_t));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -988,7 +991,7 @@ static int c2_parse_legacy(const char *pattern, int offset, c2_ptr_t *presult) {
|
||||
|
||||
// Determine the pattern target
|
||||
#define TGTFILL(pdefid) \
|
||||
(pleaf->predef = pdefid, pleaf->type = C2_PREDEFS[pdefid].type, \
|
||||
(pleaf->predef = (pdefid), pleaf->type = C2_PREDEFS[pdefid].type, \
|
||||
pleaf->format = C2_PREDEFS[pdefid].format)
|
||||
switch (pattern[offset]) {
|
||||
case 'n': TGTFILL(C2_L_PNAME); break;
|
||||
|
||||
23
src/config.c
23
src/config.c
@@ -183,20 +183,19 @@ const char *parse_readnum(const char *src, double *dest) {
|
||||
}
|
||||
|
||||
enum blur_method parse_blur_method(const char *src) {
|
||||
if (strcmp(src, "box") == 0) {
|
||||
return BLUR_METHOD_BOX;
|
||||
}
|
||||
if (strcmp(src, "dual_kawase") == 0) {
|
||||
return BLUR_METHOD_DUAL_KAWASE;
|
||||
}
|
||||
if (strcmp(src, "gaussian") == 0) {
|
||||
return BLUR_METHOD_GAUSSIAN;
|
||||
}
|
||||
if (strcmp(src, "kernel") == 0) {
|
||||
return BLUR_METHOD_KERNEL;
|
||||
} else if (strcmp(src, "box") == 0) {
|
||||
return BLUR_METHOD_BOX;
|
||||
} else if (strcmp(src, "gaussian") == 0) {
|
||||
return BLUR_METHOD_GAUSSIAN;
|
||||
} else if (strcmp(src, "dual_kawase") == 0) {
|
||||
return BLUR_METHOD_DUAL_KAWASE;
|
||||
} else if (strcmp(src, "kawase") == 0) {
|
||||
log_warn("Blur method 'kawase' has been renamed to 'dual_kawase'. "
|
||||
"Interpreted as 'dual_kawase', but this will stop working "
|
||||
"soon.");
|
||||
return BLUR_METHOD_DUAL_KAWASE;
|
||||
} else if (strcmp(src, "none") == 0) {
|
||||
}
|
||||
if (strcmp(src, "none") == 0) {
|
||||
return BLUR_METHOD_NONE;
|
||||
}
|
||||
return BLUR_METHOD_INVALID;
|
||||
|
||||
23
src/log.c
23
src/log.c
@@ -78,16 +78,21 @@ static attr_const const char *log_level_to_string(enum log_level level) {
|
||||
}
|
||||
|
||||
enum log_level string_to_log_level(const char *str) {
|
||||
if (strcasecmp(str, "TRACE") == 0)
|
||||
if (strcasecmp(str, "TRACE") == 0) {
|
||||
return LOG_LEVEL_TRACE;
|
||||
else if (strcasecmp(str, "DEBUG") == 0)
|
||||
}
|
||||
if (strcasecmp(str, "DEBUG") == 0) {
|
||||
return LOG_LEVEL_DEBUG;
|
||||
else if (strcasecmp(str, "INFO") == 0)
|
||||
}
|
||||
if (strcasecmp(str, "INFO") == 0) {
|
||||
return LOG_LEVEL_INFO;
|
||||
else if (strcasecmp(str, "WARN") == 0)
|
||||
}
|
||||
if (strcasecmp(str, "WARN") == 0) {
|
||||
return LOG_LEVEL_WARN;
|
||||
else if (strcasecmp(str, "ERROR") == 0)
|
||||
}
|
||||
if (strcasecmp(str, "ERROR") == 0) {
|
||||
return LOG_LEVEL_ERROR;
|
||||
}
|
||||
return LOG_LEVEL_INVALID;
|
||||
}
|
||||
|
||||
@@ -143,8 +148,9 @@ enum log_level log_get_level(const struct log *l) {
|
||||
attr_printf(4, 5) void log_printf(struct log *l, int level, const char *func,
|
||||
const char *fmt, ...) {
|
||||
assert(level <= LOG_LEVEL_FATAL && level >= 0);
|
||||
if (level < l->log_level)
|
||||
if (level < l->log_level) {
|
||||
return;
|
||||
}
|
||||
|
||||
char *buf = NULL;
|
||||
va_list args;
|
||||
@@ -340,7 +346,7 @@ static void
|
||||
gl_string_marker_logger_write(struct log_target *tgt, const char *str, size_t len) {
|
||||
auto g = (struct gl_string_marker_logger *)tgt;
|
||||
// strip newlines at the end of the string
|
||||
while (len > 0 && str[len-1] == '\n') {
|
||||
while (len > 0 && str[len - 1] == '\n') {
|
||||
len--;
|
||||
}
|
||||
g->gl_string_marker((GLsizei)len, str);
|
||||
@@ -358,8 +364,9 @@ struct log_target *gl_string_marker_logger_new(void) {
|
||||
}
|
||||
|
||||
void *fnptr = glXGetProcAddress((GLubyte *)"glStringMarkerGREMEDY");
|
||||
if (!fnptr)
|
||||
if (!fnptr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
auto ret = cmalloc(struct gl_string_marker_logger);
|
||||
ret->tgt.ops = &gl_string_marker_logger_ops;
|
||||
|
||||
111
src/opengl.c
111
src/opengl.c
@@ -78,8 +78,9 @@ bool glx_init(session_t *ps, bool need_render) {
|
||||
}
|
||||
|
||||
// Ensure GLX_EXT_texture_from_pixmap exists
|
||||
if (need_render && !glxext.has_GLX_EXT_texture_from_pixmap)
|
||||
if (need_render && !glxext.has_GLX_EXT_texture_from_pixmap) {
|
||||
goto glx_init_end;
|
||||
}
|
||||
|
||||
// Initialize GLX data structure
|
||||
if (!ps->psglx) {
|
||||
@@ -178,9 +179,10 @@ bool glx_init(session_t *ps, bool need_render) {
|
||||
|
||||
// Check GL_ARB_texture_non_power_of_two, requires a GLX context and
|
||||
// must precede FBConfig fetching
|
||||
if (need_render)
|
||||
if (need_render) {
|
||||
psglx->has_texture_non_power_of_two =
|
||||
gl_has_extension("GL_ARB_texture_non_power_of_two");
|
||||
}
|
||||
|
||||
// Render preparations
|
||||
if (need_render) {
|
||||
@@ -200,7 +202,7 @@ bool glx_init(session_t *ps, bool need_render) {
|
||||
}
|
||||
|
||||
// Clear screen
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClearColor(0.0F, 0.0F, 0.0F, 1.0F);
|
||||
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
// glXSwapBuffers(ps->c.dpy, get_tgt_window(ps));
|
||||
}
|
||||
@@ -210,15 +212,17 @@ bool glx_init(session_t *ps, bool need_render) {
|
||||
glx_init_end:
|
||||
XFree(pvis);
|
||||
|
||||
if (!success)
|
||||
if (!success) {
|
||||
glx_destroy(ps);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static void glx_free_prog_main(glx_prog_main_t *pprogram) {
|
||||
if (!pprogram)
|
||||
if (!pprogram) {
|
||||
return;
|
||||
}
|
||||
if (pprogram->prog) {
|
||||
glDeleteProgram(pprogram->prog);
|
||||
pprogram->prog = 0;
|
||||
@@ -232,8 +236,9 @@ static void glx_free_prog_main(glx_prog_main_t *pprogram) {
|
||||
* Destroy GLX related resources.
|
||||
*/
|
||||
void glx_destroy(session_t *ps) {
|
||||
if (!ps->psglx)
|
||||
if (!ps->psglx) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Free all GLX resources of windows
|
||||
win_stack_foreach_managed(w, &ps->window_stack) {
|
||||
@@ -373,8 +378,9 @@ bool glx_init_blur(session_t *ps) {
|
||||
double sum = 0.0;
|
||||
for (int j = 0; j < height; ++j) {
|
||||
for (int k = 0; k < width; ++k) {
|
||||
if (height / 2 == j && width / 2 == k)
|
||||
if (height / 2 == j && width / 2 == k) {
|
||||
continue;
|
||||
}
|
||||
double val = kern->data[j * width + k];
|
||||
if (val == 0) {
|
||||
continue;
|
||||
@@ -691,8 +697,9 @@ bool glx_bind_texture(session_t *ps attr_unused, glx_texture_t **pptex, int x, i
|
||||
*/
|
||||
bool glx_bind_pixmap(session_t *ps, glx_texture_t **pptex, xcb_pixmap_t pixmap, int width,
|
||||
int height, bool repeat, const struct glx_fbconfig_info *fbcfg) {
|
||||
if (ps->o.backend != BKEND_GLX && ps->o.backend != BKEND_XR_GLX_HYBRID)
|
||||
if (ps->o.backend != BKEND_GLX && ps->o.backend != BKEND_XR_GLX_HYBRID) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!pixmap) {
|
||||
log_error("Binding to an empty pixmap %#010x. This can't work.", pixmap);
|
||||
@@ -754,14 +761,15 @@ bool glx_bind_pixmap(session_t *ps, glx_texture_t **pptex, xcb_pixmap_t pixmap,
|
||||
// pixmap-specific parameters, and this may change in the future
|
||||
GLenum tex_tgt = 0;
|
||||
if (GLX_TEXTURE_2D_BIT_EXT & fbcfg->texture_tgts &&
|
||||
ps->psglx->has_texture_non_power_of_two)
|
||||
ps->psglx->has_texture_non_power_of_two) {
|
||||
tex_tgt = GLX_TEXTURE_2D_EXT;
|
||||
else if (GLX_TEXTURE_RECTANGLE_BIT_EXT & fbcfg->texture_tgts)
|
||||
} else if (GLX_TEXTURE_RECTANGLE_BIT_EXT & fbcfg->texture_tgts) {
|
||||
tex_tgt = GLX_TEXTURE_RECTANGLE_EXT;
|
||||
else if (!(GLX_TEXTURE_2D_BIT_EXT & fbcfg->texture_tgts))
|
||||
} else if (!(GLX_TEXTURE_2D_BIT_EXT & fbcfg->texture_tgts)) {
|
||||
tex_tgt = GLX_TEXTURE_RECTANGLE_EXT;
|
||||
else
|
||||
} else {
|
||||
tex_tgt = GLX_TEXTURE_2D_EXT;
|
||||
}
|
||||
|
||||
log_debug("depth %d, tgt %#x, rgba %d", depth, tex_tgt,
|
||||
(GLX_TEXTURE_FORMAT_RGBA_EXT == fbcfg->texture_fmt));
|
||||
@@ -820,8 +828,9 @@ bool glx_bind_pixmap(session_t *ps, glx_texture_t **pptex, xcb_pixmap_t pixmap,
|
||||
|
||||
// The specification requires rebinding whenever the content changes...
|
||||
// We can't follow this, too slow.
|
||||
if (need_release)
|
||||
if (need_release) {
|
||||
glXReleaseTexImageEXT(ps->c.dpy, ptex->glpixmap, GLX_FRONT_LEFT_EXT);
|
||||
}
|
||||
|
||||
glXBindTexImageEXT(ps->c.dpy, ptex->glpixmap, GLX_FRONT_LEFT_EXT, NULL);
|
||||
|
||||
@@ -859,14 +868,16 @@ void glx_release_pixmap(session_t *ps, glx_texture_t *ptex) {
|
||||
*/
|
||||
void glx_set_clip(session_t *ps, const region_t *reg) {
|
||||
// Quit if we aren't using stencils
|
||||
if (ps->o.glx_no_stencil)
|
||||
if (ps->o.glx_no_stencil) {
|
||||
return;
|
||||
}
|
||||
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
if (!reg)
|
||||
if (!reg) {
|
||||
return;
|
||||
}
|
||||
|
||||
int nrects;
|
||||
const rect_t *rects = pixman_region32_rectangles((region_t *)reg, &nrects);
|
||||
@@ -914,8 +925,9 @@ bool glx_blur_dst(session_t *ps, int dx, int dy, int width, int height, float z,
|
||||
|
||||
// Calculate copy region size
|
||||
glx_blur_cache_t ibc = {.width = 0, .height = 0};
|
||||
if (!pbc)
|
||||
if (!pbc) {
|
||||
pbc = &ibc;
|
||||
}
|
||||
|
||||
int mdx = dx, mdy = dy, mwidth = width, mheight = height;
|
||||
// log_trace("%d, %d, %d, %d", mdx, mdy, mwidth, mheight);
|
||||
@@ -942,24 +954,29 @@ bool glx_blur_dst(session_t *ps, int dx, int dy, int width, int height, float z,
|
||||
*/
|
||||
|
||||
GLenum tex_tgt = GL_TEXTURE_RECTANGLE;
|
||||
if (ps->psglx->has_texture_non_power_of_two)
|
||||
if (ps->psglx->has_texture_non_power_of_two) {
|
||||
tex_tgt = GL_TEXTURE_2D;
|
||||
}
|
||||
|
||||
// Free textures if size inconsistency discovered
|
||||
if (mwidth != pbc->width || mheight != pbc->height)
|
||||
if (mwidth != pbc->width || mheight != pbc->height) {
|
||||
free_glx_bc_resize(ps, pbc);
|
||||
}
|
||||
|
||||
// Generate FBO and textures if needed
|
||||
if (!pbc->textures[0])
|
||||
if (!pbc->textures[0]) {
|
||||
pbc->textures[0] = glx_gen_texture(tex_tgt, mwidth, mheight);
|
||||
}
|
||||
GLuint tex_scr = pbc->textures[0];
|
||||
if (more_passes && !pbc->textures[1])
|
||||
if (more_passes && !pbc->textures[1]) {
|
||||
pbc->textures[1] = glx_gen_texture(tex_tgt, mwidth, mheight);
|
||||
}
|
||||
pbc->width = mwidth;
|
||||
pbc->height = mheight;
|
||||
GLuint tex_scr2 = pbc->textures[1];
|
||||
if (more_passes && !pbc->fbo)
|
||||
if (more_passes && !pbc->fbo) {
|
||||
glGenFramebuffers(1, &pbc->fbo);
|
||||
}
|
||||
const GLuint fbo = pbc->fbo;
|
||||
|
||||
if (!tex_scr || (more_passes && !tex_scr2)) {
|
||||
@@ -987,7 +1004,7 @@ bool glx_blur_dst(session_t *ps, int dx, int dy, int width, int height, float z,
|
||||
} */
|
||||
|
||||
// Texture scaling factor
|
||||
GLfloat texfac_x = 1.0f, texfac_y = 1.0f;
|
||||
GLfloat texfac_x = 1.0F, texfac_y = 1.0F;
|
||||
if (tex_tgt == GL_TEXTURE_2D) {
|
||||
texfac_x /= (GLfloat)mwidth;
|
||||
texfac_y /= (GLfloat)mheight;
|
||||
@@ -1020,10 +1037,12 @@ bool glx_blur_dst(session_t *ps, int dx, int dy, int width, int height, float z,
|
||||
} else {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glDrawBuffer(GL_BACK);
|
||||
if (have_scissors)
|
||||
if (have_scissors) {
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
if (have_stencil)
|
||||
}
|
||||
if (have_stencil) {
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
// Color negation for testing...
|
||||
@@ -1033,12 +1052,15 @@ bool glx_blur_dst(session_t *ps, int dx, int dy, int width, int height, float z,
|
||||
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glUseProgram(ppass->prog);
|
||||
if (ppass->unifm_offset_x >= 0)
|
||||
if (ppass->unifm_offset_x >= 0) {
|
||||
glUniform1f(ppass->unifm_offset_x, texfac_x);
|
||||
if (ppass->unifm_offset_y >= 0)
|
||||
}
|
||||
if (ppass->unifm_offset_y >= 0) {
|
||||
glUniform1f(ppass->unifm_offset_y, texfac_y);
|
||||
if (ppass->unifm_factor_center >= 0)
|
||||
}
|
||||
if (ppass->unifm_factor_center >= 0) {
|
||||
glUniform1f(ppass->unifm_factor_center, factor_center);
|
||||
}
|
||||
|
||||
P_PAINTREG_START(crect) {
|
||||
auto rx = (GLfloat)(crect.x1 - mdx) * texfac_x;
|
||||
@@ -1088,10 +1110,12 @@ glx_blur_dst_end:
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glBindTexture(tex_tgt, 0);
|
||||
glDisable(tex_tgt);
|
||||
if (have_scissors)
|
||||
if (have_scissors) {
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
if (have_stencil)
|
||||
}
|
||||
if (have_stencil) {
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
}
|
||||
|
||||
if (&ibc == pbc) {
|
||||
free_glx_bc(ps, pbc);
|
||||
@@ -1276,7 +1300,7 @@ bool glx_dim_dst(session_t *ps, int dx, int dy, int width, int height, int z,
|
||||
// considering all those mess in color negation and modulation
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor4f(0.0f, 0.0f, 0.0f, factor);
|
||||
glColor4f(0.0F, 0.0F, 0.0F, factor);
|
||||
|
||||
P_PAINTREG_START(crect) {
|
||||
// XXX what does all of these variables mean?
|
||||
@@ -1292,7 +1316,7 @@ bool glx_dim_dst(session_t *ps, int dx, int dy, int width, int height, int z,
|
||||
}
|
||||
P_PAINTREG_END();
|
||||
|
||||
glColor4f(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glColor4f(0.0F, 0.0F, 0.0F, 0.0F);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
gl_check_err();
|
||||
@@ -1412,15 +1436,19 @@ bool glx_render(session_t *ps, const glx_texture_t *ptex, int x, int y, int dx,
|
||||
glUseProgram(pprogram->prog);
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
if (pprogram->unifm_opacity >= 0)
|
||||
if (pprogram->unifm_opacity >= 0) {
|
||||
glUniform1f(pprogram->unifm_opacity, (float)opacity);
|
||||
if (pprogram->unifm_invert_color >= 0)
|
||||
}
|
||||
if (pprogram->unifm_invert_color >= 0) {
|
||||
glUniform1i(pprogram->unifm_invert_color, neg);
|
||||
if (pprogram->unifm_tex >= 0)
|
||||
}
|
||||
if (pprogram->unifm_tex >= 0) {
|
||||
glUniform1i(pprogram->unifm_tex, 0);
|
||||
if (pprogram->unifm_time >= 0)
|
||||
glUniform1f(pprogram->unifm_time, (float)ts.tv_sec * 1000.0f +
|
||||
(float)ts.tv_nsec / 1.0e6f);
|
||||
}
|
||||
if (pprogram->unifm_time >= 0) {
|
||||
glUniform1f(pprogram->unifm_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", x, y, width, height,
|
||||
@@ -1460,8 +1488,8 @@ bool glx_render(session_t *ps, const glx_texture_t *ptex, int x, int y, int dx,
|
||||
// Invert Y if needed, this may not work as expected, though. I
|
||||
// don't have such a FBConfig to test with.
|
||||
if (!ptex->y_inverted) {
|
||||
ry = 1.0f - ry;
|
||||
rye = 1.0f - rye;
|
||||
ry = 1.0F - ry;
|
||||
rye = 1.0F - rye;
|
||||
}
|
||||
|
||||
// log_trace("Rect %d: %f, %f, %f, %f -> %d, %d, %d, %d", ri, rx,
|
||||
@@ -1493,7 +1521,7 @@ bool glx_render(session_t *ps, const glx_texture_t *ptex, int x, int y, int dx,
|
||||
|
||||
// Cleanup
|
||||
glBindTexture(ptex->target, 0);
|
||||
glColor4f(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glColor4f(0.0F, 0.0F, 0.0F, 0.0F);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
@@ -1506,8 +1534,9 @@ bool glx_render(session_t *ps, const glx_texture_t *ptex, int x, int y, int dx,
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
|
||||
if (has_prog)
|
||||
if (has_prog) {
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
gl_check_err();
|
||||
|
||||
|
||||
@@ -156,8 +156,9 @@ static inline bool glx_has_context(session_t *ps) {
|
||||
*/
|
||||
static inline bool ensure_glx_context(session_t *ps) {
|
||||
// Create GLX context
|
||||
if (!glx_has_context(ps))
|
||||
if (!glx_has_context(ps)) {
|
||||
glx_init(ps, false);
|
||||
}
|
||||
|
||||
return glx_has_context(ps);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user