diff options
Diffstat (limited to 'app/gfx/gl/gl_context.cc')
-rw-r--r-- | app/gfx/gl/gl_context.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/app/gfx/gl/gl_context.cc b/app/gfx/gl/gl_context.cc index 7e58027..a07d30a 100644 --- a/app/gfx/gl/gl_context.cc +++ b/app/gfx/gl/gl_context.cc @@ -4,18 +4,22 @@ #include <string> +#include "app/app_switches.h" #include "app/gfx/gl/gl_context.h" #include "app/gfx/gl/gl_bindings.h" #include "app/gfx/gl/gl_implementation.h" +#include "base/command_line.h" #include "base/logging.h" namespace gfx { -bool GLContext::HasExtension(const char* name) { +std::string GLContext::GetExtensions() { DCHECK(IsCurrent()); + return std::string(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))); +} - std::string extensions(reinterpret_cast<const char*>( - glGetString(GL_EXTENSIONS))); +bool GLContext::HasExtension(const char* name) { + std::string extensions = GetExtensions(); extensions += " "; std::string delimited_name(name); @@ -30,6 +34,13 @@ bool GLContext::InitializeCommon() { return false; } + if (!IsOffscreen()) { + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableGpuVsync)) + SetSwapInterval(0); + else + SetSwapInterval(1); + } + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); if (glGetError() != GL_NO_ERROR) { LOG(ERROR) << "glClear failed."; |