Starting to remove windows.h includes from things.
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
|
||||
#include "xenia/ui/file_picker.h"
|
||||
|
||||
#include "xenia/base/platform.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/platform_win.h"
|
||||
|
||||
namespace xe {
|
||||
namespace ui {
|
||||
|
||||
@@ -13,9 +13,15 @@
|
||||
#include "xenia/base/platform.h"
|
||||
|
||||
#include "third_party/GL/glew.h"
|
||||
#include "third_party/GL/wglew.h"
|
||||
|
||||
extern "C" GLEWContext* glewGetContext();
|
||||
|
||||
#if XE_PLATFORM_WIN32
|
||||
// We avoid including wglew.h here as it includes windows.h and pollutes the
|
||||
// global namespace. As we don't need wglew most places we only do that as
|
||||
// required.
|
||||
typedef struct WGLEWContextStruct WGLEWContext;
|
||||
extern "C" WGLEWContext* wglewGetContext();
|
||||
#endif // XE_PLATFORM_WIN32
|
||||
|
||||
#endif // XENIA_UI_GL_GL_H_
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
#include "xenia/ui/gl/gl4_elemental_renderer.h"
|
||||
#include "xenia/ui/window.h"
|
||||
|
||||
// TODO(benvanik): move win32 code to _win?
|
||||
#include "xenia/base/platform_win.h"
|
||||
#include "third_party/GL/wglew.h"
|
||||
|
||||
DEFINE_bool(thread_safe_gl, false,
|
||||
"Only allow one GL context to be active at a time.");
|
||||
|
||||
@@ -52,11 +56,16 @@ std::unique_ptr<GLContext> GLContext::Create(Window* target_window) {
|
||||
return context;
|
||||
}
|
||||
|
||||
GLContext::GLContext(Window* target_window) : GraphicsContext(target_window) {}
|
||||
GLContext::GLContext(Window* target_window) : GraphicsContext(target_window) {
|
||||
glew_context_.reset(new GLEWContext());
|
||||
wglew_context_.reset(new WGLEWContext());
|
||||
}
|
||||
|
||||
GLContext::GLContext(Window* target_window, HGLRC glrc)
|
||||
: GraphicsContext(target_window), glrc_(glrc) {
|
||||
dc_ = GetDC(HWND(target_window_->native_handle()));
|
||||
glew_context_.reset(new GLEWContext());
|
||||
wglew_context_.reset(new WGLEWContext());
|
||||
}
|
||||
|
||||
GLContext::~GLContext() {
|
||||
@@ -100,8 +109,8 @@ bool GLContext::Initialize(Window* target_window) {
|
||||
}
|
||||
wglMakeCurrent(dc_, temp_context);
|
||||
|
||||
tls_glew_context_ = &glew_context_;
|
||||
tls_wglew_context_ = &wglew_context_;
|
||||
tls_glew_context_ = glew_context_.get();
|
||||
tls_wglew_context_ = wglew_context_.get();
|
||||
glewExperimental = GL_TRUE;
|
||||
if (glewInit() != GLEW_OK) {
|
||||
XELOGE("Unable to initialize GLEW");
|
||||
@@ -403,8 +412,8 @@ bool GLContext::MakeCurrent() {
|
||||
XELOGE("Unable to make GL context current");
|
||||
return false;
|
||||
}
|
||||
tls_glew_context_ = &glew_context_;
|
||||
tls_wglew_context_ = &wglew_context_;
|
||||
tls_glew_context_ = glew_context_.get();
|
||||
tls_wglew_context_ = wglew_context_.get();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
|
||||
DECLARE_bool(thread_safe_gl);
|
||||
|
||||
// TODO(benvanik): hide Win32 stuff.
|
||||
typedef struct HDC__* HDC;
|
||||
typedef struct HGLRC__* HGLRC;
|
||||
|
||||
namespace xe {
|
||||
namespace ui {
|
||||
namespace gl {
|
||||
@@ -61,8 +65,8 @@ class GLContext : public GraphicsContext {
|
||||
HDC dc_ = nullptr;
|
||||
HGLRC glrc_ = nullptr;
|
||||
|
||||
GLEWContext glew_context_;
|
||||
WGLEWContext wglew_context_;
|
||||
std::unique_ptr<GLEWContext> glew_context_;
|
||||
std::unique_ptr<WGLEWContext> wglew_context_;
|
||||
|
||||
Blitter blitter_;
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/platform_win.h"
|
||||
#include "xenia/ui/window_win.h"
|
||||
|
||||
namespace xe {
|
||||
|
||||
Reference in New Issue
Block a user