USing a modern singleton guard

This commit is contained in:
Sam Gateau 2015-07-22 10:54:40 -07:00
parent 7ac2030862
commit 8dbd991652
2 changed files with 4 additions and 7 deletions

View file

@ -8,14 +8,13 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <mutex>
#include "GPULogging.h"
#include "GLBackendShared.h"
#include <glm/gtc/type_ptr.hpp>
using namespace gpu;
bool GLBackend::_initialized = false;
GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
{
(&::gpu::GLBackend::do_draw),
@ -91,7 +90,8 @@ GLBackend::GLBackend() :
_pipeline(),
_output()
{
if (!_initialized) {
static std::once_flag once;
std::call_once(once, [] {
qCDebug(gpulogging) << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
qCDebug(gpulogging) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
qCDebug(gpulogging) << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR));
@ -118,8 +118,7 @@ GLBackend::GLBackend() :
qCDebug(gpulogging, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
}*/
#endif
_initialized = true;
}
});
initInput();
initTransform();

View file

@ -447,8 +447,6 @@ protected:
typedef void (GLBackend::*CommandCall)(Batch&, uint32);
static CommandCall _commandCalls[Batch::NUM_COMMANDS];
static bool _initialized;
};