Adding generic immediate mode drawing API and migrating microprofile.

Future changes will move elemental-forms and imgui to the common API as
well.
This commit is contained in:
Ben Vanik
2015-11-05 21:36:05 -08:00
parent dc04baeb3f
commit c631b965d7
13 changed files with 674 additions and 427 deletions

View File

@@ -19,7 +19,7 @@
#include "xenia/base/math.h"
#include "xenia/profiling.h"
#include "xenia/ui/gl/gl4_elemental_renderer.h"
#include "xenia/ui/gl/gl_profiler_display.h"
#include "xenia/ui/gl/gl_immediate_drawer.h"
#include "xenia/ui/window.h"
// TODO(benvanik): move win32 code to _win?
@@ -84,6 +84,7 @@ GLContext::GLContext(Window* target_window, HGLRC glrc)
GLContext::~GLContext() {
MakeCurrent();
blitter_.Shutdown();
immediate_drawer_.reset();
ClearCurrent();
if (glrc_) {
wglDeleteContext(glrc_);
@@ -186,6 +187,8 @@ bool GLContext::Initialize(Window* target_window, GLContext* share_context) {
return false;
}
immediate_drawer_ = std::make_unique<GLImmediateDrawer>(this);
ClearCurrent();
return true;
@@ -249,6 +252,8 @@ std::unique_ptr<GraphicsContext> GLContext::CreateShared() {
return nullptr;
}
new_context->immediate_drawer_ = std::make_unique<GLImmediateDrawer>(this);
new_context->ClearCurrent();
return std::unique_ptr<GraphicsContext>(new_context.release());
@@ -408,14 +413,14 @@ void GLContext::SetupDebugging() {
this);
}
std::unique_ptr<ProfilerDisplay> GLContext::CreateProfilerDisplay() {
return std::make_unique<GLProfilerDisplay>(target_window_);
}
std::unique_ptr<el::graphics::Renderer> GLContext::CreateElementalRenderer() {
return GL4ElementalRenderer::Create(this);
}
ImmediateDrawer* GLContext::immediate_drawer() {
return immediate_drawer_.get();
}
bool GLContext::is_current() {
return tls_glew_context_ == glew_context_.get();
}