[core] Refactor OpenGL extension loading mechanism
Previously, we initialized global variables that held pointers to the extension functions. While this seemed to work, the spec doesn't guarantee that the function pointers are identical for different OpenGL contexts. Therefore, we are now making them a member variable of the Context object.
This commit is contained in:
committed by
John Firebaugh
parent
234384ece9
commit
e67abfbe67
@@ -1,26 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace mbgl {
|
||||
namespace gl {
|
||||
namespace debugging {
|
||||
|
||||
void enable();
|
||||
class Context;
|
||||
|
||||
#ifndef NDEBUG
|
||||
struct group {
|
||||
group(const std::string&);
|
||||
~group();
|
||||
|
||||
class DebugGroup : private util::noncopyable {
|
||||
public:
|
||||
DebugGroup(const Context&, const std::string&);
|
||||
~DebugGroup();
|
||||
|
||||
private:
|
||||
const Context& context;
|
||||
};
|
||||
|
||||
#define __MBGL_DEBUG_GROUP_NAME2(counter) __MBGL_DEBUG_GROUP_##counter
|
||||
#define __MBGL_DEBUG_GROUP_NAME(counter) __MBGL_DEBUG_GROUP_NAME2(counter)
|
||||
#define MBGL_DEBUG_GROUP(string) ::mbgl::gl::debugging::group __MBGL_DEBUG_GROUP_NAME(__LINE__)(string);
|
||||
#define MBGL_DEBUG_GROUP(context, name) const ::mbgl::gl::DebugGroup __MBGL_DEBUG_GROUP_NAME(__LINE__)(context, name);
|
||||
|
||||
#else
|
||||
#define MBGL_DEBUG_GROUP(string)
|
||||
|
||||
#define MBGL_DEBUG_GROUP(context, name)
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace debugging
|
||||
} // namespace gl
|
||||
} // namespace mbgl
|
||||
|
||||
Reference in New Issue
Block a user