diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-06-06 19:56:34 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-06-06 19:56:34 -0300 |
commit | c42651c39e80478594f5fef0c852faaaf498009d (patch) | |
tree | 97afc32566c9ec2b2a04955c2a99e47f447ea5d4 /platform | |
parent | 85f4f3927973fa7b106ee274033b1f0180ad4343 (diff) | |
parent | a1b696aa569da526745927bad1c4203aeab9e2c6 (diff) |
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'platform')
-rw-r--r-- | platform/osx/dir_access_osx.mm | 4 | ||||
-rw-r--r-- | platform/x11/context_gl_x11.cpp | 34 |
2 files changed, 31 insertions, 7 deletions
diff --git a/platform/osx/dir_access_osx.mm b/platform/osx/dir_access_osx.mm index 20dc1df8f4..d123c5c648 100644 --- a/platform/osx/dir_access_osx.mm +++ b/platform/osx/dir_access_osx.mm @@ -319,10 +319,10 @@ size_t DirAccessOSX::get_space_left() { struct statvfs vfs; if (statvfs(current_dir.utf8().get_data(), &vfs) != 0) { - return -1; + return 0; }; - return vfs.f_bfree * vfs.f_bsize; + return (size_t) (vfs.f_bavail * vfs.f_bsize); #else #warning THIS IS BROKEN return 0; diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp index 4e00dbf0a8..cd325dfc99 100644 --- a/platform/x11/context_gl_x11.cpp +++ b/platform/x11/context_gl_x11.cpp @@ -179,14 +179,38 @@ int ContextGL_X11::get_window_height() { } void ContextGL_X11::set_use_vsync(bool p_use) { - GLXDrawable drawable = glXGetCurrentDrawable(); - //GLXSwapIntervalEXT(x11_display, drawable, p_use?1:0); - use_vsync=p_use; + static bool setup = false; + static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = NULL; + static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalMESA = NULL; + static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL; + + if (!setup) { + setup = true; + String extensions = glXQueryExtensionsString(x11_display, DefaultScreen(x11_display)); + if (extensions.find("GLX_EXT_swap_control") != -1) + glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalEXT"); + if (extensions.find("GLX_MESA_swap_control") != -1) + glXSwapIntervalMESA = (PFNGLXSWAPINTERVALSGIPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalMESA"); + if (extensions.find("GLX_SGI_swap_control") != -1) + glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalSGI"); + } + int val = p_use ? 1:0; + if (glXSwapIntervalMESA) { + glXSwapIntervalMESA(val); + } + else if (glXSwapIntervalSGI) { + glXSwapIntervalSGI(val); + } + else if (glXSwapIntervalEXT) { + GLXDrawable drawable = glXGetCurrentDrawable(); + glXSwapIntervalEXT(x11_display, drawable, val); + } + else return; + use_vsync = p_use; } bool ContextGL_X11::is_using_vsync() const { - return false; - //return use_vsync; + return use_vsync; } |