Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2532)

Unified Diff: ui/gl/gl_implementation_win.cc

Issue 1007513006: Add ANGLE Platform implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_implementation_win.cc
diff --git a/ui/gl/gl_implementation_win.cc b/ui/gl/gl_implementation_win.cc
index 477f5a5b4b3118a5e4f66ddcc80ecbbc0e7cbe64..7bea3e673bbb5406ceb06c1bcf483843246f75e9 100644
--- a/ui/gl/gl_implementation_win.cc
+++ b/ui/gl/gl_implementation_win.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
+#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/native_library.h"
#include "base/path_service.h"
@@ -16,6 +17,8 @@
#include "base/threading/thread_restrictions.h"
#include "base/trace_event/trace_event.h"
#include "base/win/windows_version.h"
+// TODO(jmadill): Apply to all platforms eventually
+#include "ui/gl/angle_platform_impl.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context_stub_with_extensions.h"
#include "ui/gl/gl_egl_api_implementation.h"
@@ -97,6 +100,10 @@ typedef void (__stdcall *SetTraceFunctionPointersFunc)(
GetCategoryEnabledFlagFunc get_category_enabled_flag,
AddTraceEventFunc add_trace_event_func);
+// TODO(jmadill): Apply to all platforms eventually
+base::LazyInstance<ANGLEPlatformImpl> g_angle_platform_impl =
+ LAZY_INSTANCE_INITIALIZER;
+
} // namespace
void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) {
@@ -111,6 +118,23 @@ bool InitializeStaticGLBindings(GLImplementation implementation) {
// later switch to another GL implementation.
DCHECK_EQ(kGLImplementationNone, GetGLImplementation());
+ // Init ANGLE platform here, before we call GetPlatformDisplay().
+ // TODO(jmadill): Apply to all platforms eventually
+ base::NativeLibrary libGLESv2_module = base::LoadNativeLibrary(
+ base::FilePath(L"libGLESv2.dll"),
+ nullptr);
+
+ if (libGLESv2_module) {
+ ANGLEPlatformInitializeFunc initFunc =
+ reinterpret_cast<ANGLEPlatformInitializeFunc>(
+ base::GetFunctionPointerFromNativeLibrary(
+ libGLESv2_module,
+ "ANGLEPlatformInitialize"));
+ if (initFunc) {
+ initFunc(&g_angle_platform_impl.Get());
+ }
+ }
piman 2015/03/18 19:27:07 I think we'd only want to do this in the kGLImplem
Jamie Madill 2015/03/18 21:01:50 Done.
+
// Allow the main thread or another to initialize these bindings
// after instituting restrictions on I/O. Going forward they will
// likely be used in the browser process on most platforms. The
@@ -348,6 +372,22 @@ void InitializeDebugGLBindings() {
}
void ClearGLBindings() {
+ // TODO(jmadill): Apply to all platforms eventually
+ base::NativeLibrary libGLESv2_module = base::LoadNativeLibrary(
+ base::FilePath(L"libGLESv2.dll"),
+ nullptr);
+
+ if (libGLESv2_module) {
+ ANGLEPlatformShutdownFunc shutdownFunc =
piman 2015/03/18 19:27:07 We could just lookup this function at the same tim
Jamie Madill 2015/03/18 21:01:50 Done.
+ reinterpret_cast<ANGLEPlatformShutdownFunc>(
+ base::GetFunctionPointerFromNativeLibrary(
+ libGLESv2_module,
+ "ANGLEPlatformShutdown"));
+ if (shutdownFunc) {
+ shutdownFunc();
+ }
+ }
+
ClearGLBindingsEGL();
ClearGLBindingsGL();
ClearGLBindingsOSMESA();
« no previous file with comments | « ui/gl/gl.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698