Browse Source

fix resize crash / add LGLW_CONTEXT_ALLOW_USE_AFTER_FREE build option

pull/1639/head
bsp2 6 years ago
parent
commit
a4898ff3ec
2 changed files with 16 additions and 1 deletions
  1. +8
    -0
      dep/lglw/lglw_linux.c
  2. +8
    -1
      setenv_linux.sh

+ 8
- 0
dep/lglw/lglw_linux.c View File

@@ -1297,8 +1297,16 @@ lglw_bool_t lglw_window_resize (lglw_t _lglw, int32_t _w, int32_t _h) {
if(0 != lglw->hidden.xwnd)
{
XResizeWindow(lglw->xdsp, lglw->hidden.xwnd, _w, _h);

#ifdef LGLW_CONTEXT_ALLOW_USE_AFTER_FREE
// (note) [bsp] destroying the GL context also destroys all GL objects attached to it
// (_if_ the GL driver is implemented correctly).
// IOW, if we destroy the context here, we'd have to re-create all the textures,
// buffer objects, framebuffer objects, shaders, .. before they can be used again.
// Apparently this works with certain GL drivers on Linux but it still is an application error.
loc_destroy_gl(lglw);
loc_create_gl(lglw);
#endif // LGLW_CONTEXT_ALLOW_USE_AFTER_FREE
}

if(0 != lglw->win.xwnd)


+ 8
- 1
setenv_linux.sh View File

@@ -25,9 +25,16 @@ CPU_ARCH="-march=athlon-fx"
fi

# Extra compiler flags (C and C++)
#EXTRA_FLAGS=""
#EXTRA_FLAGS=-DUSE_LOG_PRINTF
EXTRA_FLAGS="-DUSE_BEGIN_REDRAW_FXN -I${VSVR_BASE_DIR}/dep/lglw"
#EXTRA_FLAGS=""

# (note) see dep/lglw/lglw_linux.c for an important note re: LGLW_CONTEXT_ALLOW_USE_AFTER_FREE
#EXTRA_FLAGS="${EXTRA_FLAGS} -DLGLW_CONTEXT_ALLOW_USE_AFTER_FREE"

if [ "${USER}" = "cameron" ]; then
EXTRA_FLAGS="${EXTRA_FLAGS} -DLGLW_CONTEXT_ALLOW_USE_AFTER_FREE"
fi

# Extra C compiler flags
export EXTRA_CFLAGS="${CPU_ARCH} ${EXTRA_FLAGS}"


Loading…
Cancel
Save