Revert "Revert "Rootless Debug for GLES""
This reverts commit 9f20d92fb3b7ed2a88d2e497ec36d21e9005f497.
Test: cts-tradefed run singleCommand cts -m CtsGpuToolsHostTestCases
Test: Chromium starts up
Test: deqp - EGL, GLES2, GLES3
Bug: 110883880
Change-Id: I728ce502f8df43d5bfb370e6f9d4bd382f8c909d
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 1229bc2..8870d5f 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -30,11 +30,10 @@
#include "egl_tls.h"
#include "egl_display.h"
#include "egl_object.h"
+#include "egl_layers.h"
#include "CallStack.h"
#include "Loader.h"
-typedef __eglMustCastToProperFunctionPointerType EGLFuncPointer;
-
// ----------------------------------------------------------------------------
namespace android {
// ----------------------------------------------------------------------------
@@ -196,6 +195,14 @@
cnx->dso = loader.open(cnx);
}
+ // Check to see if any layers are enabled and route functions through them
+ if (cnx->dso) {
+ // Layers can be enabled long after the drivers have been loaded.
+ // They will only be initialized once.
+ LayerLoader& layer_loader(LayerLoader::getInstance());
+ layer_loader.InitLayers(cnx);
+ }
+
return cnx->dso ? EGL_TRUE : EGL_FALSE;
}