Rootless Debug for GLES
Add the ability to enable debug layers for OpenGL ES.
This update concides with changes to framework/base to
control the enabling logic in GraphicsEnvironment.
Refer to go/rootless-gpu-debug-gles for design overview.
To learn more about creating GLES layers, refer to
https://developer.android.com/ndk/guides/
Test: cts-tradefed run singleCommand cts -m CtsGpuToolsHostTestCases
Bug: 110883880
Bug: 117515773
Change-Id: I0334cd9cd386f20bf40adac117e3144b0f76b7d3
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index d0cfada..01795e0 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;
}