This will allow them to be imported dynamically without name
mangling. This is necessary because sometimes SwiftShader
overrides libGLESv2 and libEGL, so we need to determine at
run-time if we are running with "actual" ANGLE.

BUG=466735

Change-Id: I396d717b79066feb8ed0d577ee7386b33eb1d160
Reviewed-on: https://chromium-review.googlesource.com/259954
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill 2015-03-13 10:45:27 -04:00
Родитель 1f40291c8f
Коммит 6bd5831261
5 изменённых файлов: 24 добавлений и 20 удалений

Просмотреть файл

@ -20,10 +20,6 @@ class Platform
{ {
public: public:
ANGLE_EXPORT static void initialize(Platform*);
ANGLE_EXPORT static void shutdown();
ANGLE_EXPORT static Platform *current();
// Tracing -------- // Tracing --------
typedef uint64_t TraceEventHandle; typedef uint64_t TraceEventHandle;
@ -104,4 +100,13 @@ class Platform
} }
typedef void(*ANGLEPlatformInitializeFunc)(angle::Platform*);
ANGLE_EXPORT void ANGLEPlatformInitialize(angle::Platform*);
typedef void (*ANGLEPlatformShutdownFunc)();
ANGLE_EXPORT void ANGLEPlatformShutdown();
typedef angle::Platform *(*ANGLEPlatformCurrentFunc)();
ANGLE_EXPORT angle::Platform *ANGLEPlatformCurrent();
#endif // ANGLE_PLATFORM_H #endif // ANGLE_PLATFORM_H

Просмотреть файл

@ -55,14 +55,14 @@ DefaultPlatform *defaultPlatform = nullptr;
void InitDefaultPlatformImpl() void InitDefaultPlatformImpl()
{ {
if (angle::Platform::current() == nullptr) if (ANGLEPlatformCurrent() == nullptr)
{ {
if (defaultPlatform == nullptr) if (defaultPlatform == nullptr)
{ {
defaultPlatform = new DefaultPlatform(); defaultPlatform = new DefaultPlatform();
} }
angle::Platform::initialize(defaultPlatform); ANGLEPlatformInitialize(defaultPlatform);
} }
} }
@ -70,9 +70,9 @@ void DeinitDefaultPlatformImpl()
{ {
if (defaultPlatform != nullptr) if (defaultPlatform != nullptr)
{ {
if (angle::Platform::current() == defaultPlatform) if (ANGLEPlatformCurrent() == defaultPlatform)
{ {
angle::Platform::shutdown(); ANGLEPlatformShutdown();
} }
SafeDelete(defaultPlatform); SafeDelete(defaultPlatform);

Просмотреть файл

@ -9,33 +9,27 @@
#include <platform/Platform.h> #include <platform/Platform.h>
#include "common/debug.h" #include "common/debug.h"
#include "platform/Platform.h"
namespace angle
{
namespace namespace
{ {
Platform *currentPlatform = nullptr; angle::Platform *currentPlatform = nullptr;
} }
// static // static
ANGLE_EXPORT Platform *Platform::current() ANGLE_EXPORT angle::Platform *ANGLEPlatformCurrent()
{ {
return currentPlatform; return currentPlatform;
} }
// static // static
ANGLE_EXPORT void Platform::initialize(Platform *platformImpl) ANGLE_EXPORT void ANGLEPlatformInitialize(angle::Platform *platformImpl)
{ {
ASSERT(platformImpl != nullptr); ASSERT(platformImpl != nullptr);
currentPlatform = platformImpl; currentPlatform = platformImpl;
} }
// static // static
ANGLE_EXPORT void Platform::shutdown() ANGLE_EXPORT void ANGLEPlatformShutdown()
{ {
currentPlatform = nullptr; currentPlatform = nullptr;
} }
}

Просмотреть файл

@ -109,7 +109,7 @@ egl::Error CreateRendererD3D(egl::Display *display, RendererD3D **outRenderer)
{ {
ASSERT(result.getID() >= 0 && result.getID() < NUM_D3D11_INIT_ERRORS); ASSERT(result.getID() >= 0 && result.getID() < NUM_D3D11_INIT_ERRORS);
angle::Platform *platform = angle::Platform::current(); angle::Platform *platform = ANGLEPlatformCurrent();
platform->histogramEnumeration("GPU.ANGLE.D3D11InitializeResult", platform->histogramEnumeration("GPU.ANGLE.D3D11InitializeResult",
result.getID(), NUM_D3D11_INIT_ERRORS); result.getID(), NUM_D3D11_INIT_ERRORS);
} }
@ -120,7 +120,7 @@ egl::Error CreateRendererD3D(egl::Display *display, RendererD3D **outRenderer)
{ {
ASSERT(result.getID() >= 0 && result.getID() < NUM_D3D9_INIT_ERRORS); ASSERT(result.getID() >= 0 && result.getID() < NUM_D3D9_INIT_ERRORS);
angle::Platform *platform = angle::Platform::current(); angle::Platform *platform = ANGLEPlatformCurrent();
platform->histogramEnumeration("GPU.ANGLE.D3D9InitializeResult", platform->histogramEnumeration("GPU.ANGLE.D3D9InitializeResult",
result.getID(), NUM_D3D9_INIT_ERRORS); result.getID(), NUM_D3D9_INIT_ERRORS);
} }

Просмотреть файл

@ -286,3 +286,8 @@ EXPORTS
; Setting up TRACE macro callbacks ; Setting up TRACE macro callbacks
SetTraceFunctionPointers @284 SetTraceFunctionPointers @284
; ANGLE Platform Implementation
ANGLEPlatformCurrent @290
ANGLEPlatformInitialize @291
ANGLEPlatformShutdown @292