mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:10:25 +02:00
USing a modern singleton guard
This commit is contained in:
parent
7ac2030862
commit
8dbd991652
2 changed files with 4 additions and 7 deletions
|
@ -8,14 +8,13 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
#include <mutex>
|
||||||
#include "GPULogging.h"
|
#include "GPULogging.h"
|
||||||
#include "GLBackendShared.h"
|
#include "GLBackendShared.h"
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|
||||||
using namespace gpu;
|
using namespace gpu;
|
||||||
|
|
||||||
bool GLBackend::_initialized = false;
|
|
||||||
|
|
||||||
GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
|
GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
|
||||||
{
|
{
|
||||||
(&::gpu::GLBackend::do_draw),
|
(&::gpu::GLBackend::do_draw),
|
||||||
|
@ -91,7 +90,8 @@ GLBackend::GLBackend() :
|
||||||
_pipeline(),
|
_pipeline(),
|
||||||
_output()
|
_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 Version: " << QString((const char*) glGetString(GL_VERSION));
|
||||||
qCDebug(gpulogging) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_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));
|
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"));
|
qCDebug(gpulogging, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
||||||
}*/
|
}*/
|
||||||
#endif
|
#endif
|
||||||
_initialized = true;
|
});
|
||||||
}
|
|
||||||
|
|
||||||
initInput();
|
initInput();
|
||||||
initTransform();
|
initTransform();
|
||||||
|
|
|
@ -447,8 +447,6 @@ protected:
|
||||||
|
|
||||||
typedef void (GLBackend::*CommandCall)(Batch&, uint32);
|
typedef void (GLBackend::*CommandCall)(Batch&, uint32);
|
||||||
static CommandCall _commandCalls[Batch::NUM_COMMANDS];
|
static CommandCall _commandCalls[Batch::NUM_COMMANDS];
|
||||||
|
|
||||||
static bool _initialized;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue