Commit 17651d3d authored by Geoff Lang's avatar Geoff Lang Committed by Commit Bot

Log debug messages from EGL_KHR_debug.

BUG=angleproject:1618

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Id680ec102ea40bb2117b276e0ffa002956a750d2
Reviewed-on: https://chromium-review.googlesource.com/1101514Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568188}
parent 86d4b6f0
......@@ -146,6 +146,13 @@ MockEGLInterface::Mock_eglCreateWindowSurface(EGLDisplay dpy,
return interface_->CreateWindowSurface(dpy, config, win, attrib_list);
}
EGLint GL_BINDING_CALL
MockEGLInterface::Mock_eglDebugMessageControlKHR(EGLDEBUGPROCKHR callback,
const EGLAttrib* attrib_list) {
MakeFunctionUnique("eglDebugMessageControlKHR");
return interface_->DebugMessageControlKHR(callback, attrib_list);
}
EGLBoolean GL_BINDING_CALL
MockEGLInterface::Mock_eglDestroyContext(EGLDisplay dpy, EGLContext ctx) {
MakeFunctionUnique("eglDestroyContext");
......@@ -355,6 +362,15 @@ EGLBoolean GL_BINDING_CALL MockEGLInterface::Mock_eglInitialize(EGLDisplay dpy,
return interface_->Initialize(dpy, major, minor);
}
EGLint GL_BINDING_CALL
MockEGLInterface::Mock_eglLabelObjectKHR(EGLDisplay display,
EGLenum objectType,
EGLObjectKHR object,
EGLLabelKHR label) {
MakeFunctionUnique("eglLabelObjectKHR");
return interface_->LabelObjectKHR(display, objectType, object, label);
}
EGLBoolean GL_BINDING_CALL
MockEGLInterface::Mock_eglMakeCurrent(EGLDisplay dpy,
EGLSurface draw,
......@@ -426,6 +442,12 @@ MockEGLInterface::Mock_eglQueryContext(EGLDisplay dpy,
return interface_->QueryContext(dpy, ctx, attribute, value);
}
EGLBoolean GL_BINDING_CALL
MockEGLInterface::Mock_eglQueryDebugKHR(EGLint attribute, EGLAttrib* value) {
MakeFunctionUnique("eglQueryDebugKHR");
return interface_->QueryDebugKHR(attribute, value);
}
EGLBoolean GL_BINDING_CALL
MockEGLInterface::Mock_eglQueryStreamKHR(EGLDisplay dpy,
EGLStreamKHR stream,
......@@ -626,6 +648,9 @@ MockEGLInterface::GetGLProcAddress(const char* name) {
return reinterpret_cast<GLFunctionPointerType>(Mock_eglCreateSyncKHR);
if (strcmp(name, "eglCreateWindowSurface") == 0)
return reinterpret_cast<GLFunctionPointerType>(Mock_eglCreateWindowSurface);
if (strcmp(name, "eglDebugMessageControlKHR") == 0)
return reinterpret_cast<GLFunctionPointerType>(
Mock_eglDebugMessageControlKHR);
if (strcmp(name, "eglDestroyContext") == 0)
return reinterpret_cast<GLFunctionPointerType>(Mock_eglDestroyContext);
if (strcmp(name, "eglDestroyImageKHR") == 0)
......@@ -692,6 +717,8 @@ MockEGLInterface::GetGLProcAddress(const char* name) {
Mock_eglImageFlushExternalEXT);
if (strcmp(name, "eglInitialize") == 0)
return reinterpret_cast<GLFunctionPointerType>(Mock_eglInitialize);
if (strcmp(name, "eglLabelObjectKHR") == 0)
return reinterpret_cast<GLFunctionPointerType>(Mock_eglLabelObjectKHR);
if (strcmp(name, "eglMakeCurrent") == 0)
return reinterpret_cast<GLFunctionPointerType>(Mock_eglMakeCurrent);
if (strcmp(name, "eglPostSubBufferNV") == 0)
......@@ -712,6 +739,8 @@ MockEGLInterface::GetGLProcAddress(const char* name) {
return reinterpret_cast<GLFunctionPointerType>(Mock_eglQueryAPI);
if (strcmp(name, "eglQueryContext") == 0)
return reinterpret_cast<GLFunctionPointerType>(Mock_eglQueryContext);
if (strcmp(name, "eglQueryDebugKHR") == 0)
return reinterpret_cast<GLFunctionPointerType>(Mock_eglQueryDebugKHR);
if (strcmp(name, "eglQueryStreamKHR") == 0)
return reinterpret_cast<GLFunctionPointerType>(Mock_eglQueryStreamKHR);
if (strcmp(name, "eglQueryStreamu64KHR") == 0)
......
......@@ -65,6 +65,9 @@ Mock_eglCreateWindowSurface(EGLDisplay dpy,
EGLConfig config,
EGLNativeWindowType win,
const EGLint* attrib_list);
static EGLint GL_BINDING_CALL
Mock_eglDebugMessageControlKHR(EGLDEBUGPROCKHR callback,
const EGLAttrib* attrib_list);
static EGLBoolean GL_BINDING_CALL Mock_eglDestroyContext(EGLDisplay dpy,
EGLContext ctx);
static EGLBoolean GL_BINDING_CALL Mock_eglDestroyImageKHR(EGLDisplay dpy,
......@@ -153,6 +156,10 @@ Mock_eglImageFlushExternalEXT(EGLDisplay dpy,
static EGLBoolean GL_BINDING_CALL Mock_eglInitialize(EGLDisplay dpy,
EGLint* major,
EGLint* minor);
static EGLint GL_BINDING_CALL Mock_eglLabelObjectKHR(EGLDisplay display,
EGLenum objectType,
EGLObjectKHR object,
EGLLabelKHR label);
static EGLBoolean GL_BINDING_CALL Mock_eglMakeCurrent(EGLDisplay dpy,
EGLSurface draw,
EGLSurface read,
......@@ -185,6 +192,8 @@ static EGLBoolean GL_BINDING_CALL Mock_eglQueryContext(EGLDisplay dpy,
EGLContext ctx,
EGLint attribute,
EGLint* value);
static EGLBoolean GL_BINDING_CALL Mock_eglQueryDebugKHR(EGLint attribute,
EGLAttrib* value);
static EGLBoolean GL_BINDING_CALL Mock_eglQueryStreamKHR(EGLDisplay dpy,
EGLStreamKHR stream,
EGLenum attribute,
......
......@@ -1914,6 +1914,11 @@ EGL_FUNCTIONS = [
'names': ['eglCreateWindowSurface'],
'arguments': 'EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, '
'const EGLint* attrib_list', },
{ 'return_type': 'EGLint',
'known_as': 'eglDebugMessageControlKHR',
'versions': [{ 'name': 'eglDebugMessageControlKHR',
'client_extensions': ['EGL_KHR_debug'], }],
'arguments': 'EGLDEBUGPROCKHR callback, const EGLAttrib* attrib_list', },
{ 'return_type': 'EGLBoolean',
'names': ['eglDestroyContext'],
'arguments': 'EGLDisplay dpy, EGLContext ctx', },
......@@ -2048,6 +2053,12 @@ EGL_FUNCTIONS = [
{ 'return_type': 'EGLBoolean',
'names': ['eglInitialize'],
'arguments': 'EGLDisplay dpy, EGLint* major, EGLint* minor', },
{ 'return_type': 'EGLint',
'known_as': 'eglLabelObjectKHR',
'versions': [{ 'name': 'eglLabelObjectKHR',
'client_extensions': ['EGL_KHR_debug'], }],
'arguments': 'EGLDisplay display, EGLenum objectType, EGLObjectKHR object, '
'EGLLabelKHR label', },
{ 'return_type': 'EGLBoolean',
'names': ['eglMakeCurrent'],
'arguments':
......@@ -2081,6 +2092,11 @@ EGL_FUNCTIONS = [
'names': ['eglQueryContext'],
'arguments':
'EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value', },
{ 'return_type': 'EGLBoolean',
'known_as': 'eglQueryDebugKHR',
'versions': [{ 'name': 'eglQueryDebugKHR',
'client_extensions': ['EGL_KHR_debug'], }],
'arguments': 'EGLint attribute, EGLAttrib* value', },
{ 'return_type': 'EGLBoolean',
'versions': [{ 'name': 'eglQueryStreamKHR',
'extensions': ['EGL_KHR_stream'] }],
......@@ -2917,6 +2933,9 @@ void DriverEGL::InitializeExtensionBindings() {
log_argument_names = re.sub(
r'GLDEBUGPROC ([a-zA-Z0-9_]+)',
r'GLDEBUGPROC_\1', log_argument_names)
log_argument_names = re.sub(
r'EGLDEBUGPROCKHR ([a-zA-Z0-9_]+)',
r'EGLDEBUGPROCKHR_\1', log_argument_names)
log_argument_names = re.sub(
r'(?<!E)GLenum ([a-zA-Z0-9_]+)', r'GLenum_\1', log_argument_names)
# Strip remaining types.
......@@ -2939,6 +2958,9 @@ void DriverEGL::InitializeExtensionBindings() {
log_argument_names = re.sub(
r'GLDEBUGPROC_([a-zA-Z0-9_]+)',
r'reinterpret_cast<void*>(\1)', log_argument_names)
log_argument_names = re.sub(
r'EGLDEBUGPROCKHR_([a-zA-Z0-9_]+)',
r'reinterpret_cast<void*>(\1)', log_argument_names)
log_argument_names = re.sub(
r'GLenum_([a-zA-Z0-9_]+)', r'GLEnums::GetStringEnum(\1)',
log_argument_names)
......
......@@ -59,6 +59,8 @@ EGLSurface eglCreateWindowSurfaceFn(EGLDisplay dpy,
EGLConfig config,
EGLNativeWindowType win,
const EGLint* attrib_list) override;
EGLint eglDebugMessageControlKHRFn(EGLDEBUGPROCKHR callback,
const EGLAttrib* attrib_list) override;
EGLBoolean eglDestroyContextFn(EGLDisplay dpy, EGLContext ctx) override;
EGLBoolean eglDestroyImageKHRFn(EGLDisplay dpy, EGLImageKHR image) override;
EGLBoolean eglDestroyStreamKHRFn(EGLDisplay dpy, EGLStreamKHR stream) override;
......@@ -130,6 +132,10 @@ EGLBoolean eglImageFlushExternalEXTFn(EGLDisplay dpy,
EGLBoolean eglInitializeFn(EGLDisplay dpy,
EGLint* major,
EGLint* minor) override;
EGLint eglLabelObjectKHRFn(EGLDisplay display,
EGLenum objectType,
EGLObjectKHR object,
EGLLabelKHR label) override;
EGLBoolean eglMakeCurrentFn(EGLDisplay dpy,
EGLSurface draw,
EGLSurface read,
......@@ -160,6 +166,7 @@ EGLBoolean eglQueryContextFn(EGLDisplay dpy,
EGLContext ctx,
EGLint attribute,
EGLint* value) override;
EGLBoolean eglQueryDebugKHRFn(EGLint attribute, EGLAttrib* value) override;
EGLBoolean eglQueryStreamKHRFn(EGLDisplay dpy,
EGLStreamKHR stream,
EGLenum attribute,
......
......@@ -117,12 +117,29 @@ void DriverEGL::InitializeClientExtensionBindings() {
ext.b_EGL_EXT_platform_base =
HasExtension(extensions, "EGL_EXT_platform_base");
ext.b_EGL_KHR_debug = HasExtension(extensions, "EGL_KHR_debug");
if (ext.b_EGL_KHR_debug) {
fn.eglDebugMessageControlKHRFn =
reinterpret_cast<eglDebugMessageControlKHRProc>(
GetGLProcAddress("eglDebugMessageControlKHR"));
}
if (ext.b_EGL_EXT_platform_base) {
fn.eglGetPlatformDisplayEXTFn =
reinterpret_cast<eglGetPlatformDisplayEXTProc>(
GetGLProcAddress("eglGetPlatformDisplayEXT"));
}
if (ext.b_EGL_KHR_debug) {
fn.eglLabelObjectKHRFn = reinterpret_cast<eglLabelObjectKHRProc>(
GetGLProcAddress("eglLabelObjectKHR"));
}
if (ext.b_EGL_KHR_debug) {
fn.eglQueryDebugKHRFn = reinterpret_cast<eglQueryDebugKHRProc>(
GetGLProcAddress("eglQueryDebugKHR"));
}
}
void DriverEGL::InitializeExtensionBindings() {
......@@ -452,6 +469,11 @@ EGLSurface EGLApiBase::eglCreateWindowSurfaceFn(EGLDisplay dpy,
return driver_->fn.eglCreateWindowSurfaceFn(dpy, config, win, attrib_list);
}
EGLint EGLApiBase::eglDebugMessageControlKHRFn(EGLDEBUGPROCKHR callback,
const EGLAttrib* attrib_list) {
return driver_->fn.eglDebugMessageControlKHRFn(callback, attrib_list);
}
EGLBoolean EGLApiBase::eglDestroyContextFn(EGLDisplay dpy, EGLContext ctx) {
return driver_->fn.eglDestroyContextFn(dpy, ctx);
}
......@@ -618,6 +640,13 @@ EGLBoolean EGLApiBase::eglInitializeFn(EGLDisplay dpy,
return driver_->fn.eglInitializeFn(dpy, major, minor);
}
EGLint EGLApiBase::eglLabelObjectKHRFn(EGLDisplay display,
EGLenum objectType,
EGLObjectKHR object,
EGLLabelKHR label) {
return driver_->fn.eglLabelObjectKHRFn(display, objectType, object, label);
}
EGLBoolean EGLApiBase::eglMakeCurrentFn(EGLDisplay dpy,
EGLSurface draw,
EGLSurface read,
......@@ -675,6 +704,10 @@ EGLBoolean EGLApiBase::eglQueryContextFn(EGLDisplay dpy,
return driver_->fn.eglQueryContextFn(dpy, ctx, attribute, value);
}
EGLBoolean EGLApiBase::eglQueryDebugKHRFn(EGLint attribute, EGLAttrib* value) {
return driver_->fn.eglQueryDebugKHRFn(attribute, value);
}
EGLBoolean EGLApiBase::eglQueryStreamKHRFn(EGLDisplay dpy,
EGLStreamKHR stream,
EGLenum attribute,
......@@ -915,6 +948,12 @@ EGLSurface TraceEGLApi::eglCreateWindowSurfaceFn(EGLDisplay dpy,
return egl_api_->eglCreateWindowSurfaceFn(dpy, config, win, attrib_list);
}
EGLint TraceEGLApi::eglDebugMessageControlKHRFn(EGLDEBUGPROCKHR callback,
const EGLAttrib* attrib_list) {
TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglDebugMessageControlKHR")
return egl_api_->eglDebugMessageControlKHRFn(callback, attrib_list);
}
EGLBoolean TraceEGLApi::eglDestroyContextFn(EGLDisplay dpy, EGLContext ctx) {
TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglDestroyContext")
return egl_api_->eglDestroyContextFn(dpy, ctx);
......@@ -1117,6 +1156,14 @@ EGLBoolean TraceEGLApi::eglInitializeFn(EGLDisplay dpy,
return egl_api_->eglInitializeFn(dpy, major, minor);
}
EGLint TraceEGLApi::eglLabelObjectKHRFn(EGLDisplay display,
EGLenum objectType,
EGLObjectKHR object,
EGLLabelKHR label) {
TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglLabelObjectKHR")
return egl_api_->eglLabelObjectKHRFn(display, objectType, object, label);
}
EGLBoolean TraceEGLApi::eglMakeCurrentFn(EGLDisplay dpy,
EGLSurface draw,
EGLSurface read,
......@@ -1184,6 +1231,11 @@ EGLBoolean TraceEGLApi::eglQueryContextFn(EGLDisplay dpy,
return egl_api_->eglQueryContextFn(dpy, ctx, attribute, value);
}
EGLBoolean TraceEGLApi::eglQueryDebugKHRFn(EGLint attribute, EGLAttrib* value) {
TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglQueryDebugKHR")
return egl_api_->eglQueryDebugKHRFn(attribute, value);
}
EGLBoolean TraceEGLApi::eglQueryStreamKHRFn(EGLDisplay dpy,
EGLStreamKHR stream,
EGLenum attribute,
......@@ -1512,6 +1564,16 @@ EGLSurface DebugEGLApi::eglCreateWindowSurfaceFn(EGLDisplay dpy,
return result;
}
EGLint DebugEGLApi::eglDebugMessageControlKHRFn(EGLDEBUGPROCKHR callback,
const EGLAttrib* attrib_list) {
GL_SERVICE_LOG("eglDebugMessageControlKHR"
<< "(" << reinterpret_cast<void*>(callback) << ", "
<< static_cast<const void*>(attrib_list) << ")");
EGLint result = egl_api_->eglDebugMessageControlKHRFn(callback, attrib_list);
GL_SERVICE_LOG("GL_RESULT: " << result);
return result;
}
EGLBoolean DebugEGLApi::eglDestroyContextFn(EGLDisplay dpy, EGLContext ctx) {
GL_SERVICE_LOG("eglDestroyContext"
<< "(" << dpy << ", " << ctx << ")");
......@@ -1825,6 +1887,19 @@ EGLBoolean DebugEGLApi::eglInitializeFn(EGLDisplay dpy,
return result;
}
EGLint DebugEGLApi::eglLabelObjectKHRFn(EGLDisplay display,
EGLenum objectType,
EGLObjectKHR object,
EGLLabelKHR label) {
GL_SERVICE_LOG("eglLabelObjectKHR"
<< "(" << display << ", " << objectType << ", " << object
<< ", " << label << ")");
EGLint result =
egl_api_->eglLabelObjectKHRFn(display, objectType, object, label);
GL_SERVICE_LOG("GL_RESULT: " << result);
return result;
}
EGLBoolean DebugEGLApi::eglMakeCurrentFn(EGLDisplay dpy,
EGLSurface draw,
EGLSurface read,
......@@ -1921,6 +1996,15 @@ EGLBoolean DebugEGLApi::eglQueryContextFn(EGLDisplay dpy,
return result;
}
EGLBoolean DebugEGLApi::eglQueryDebugKHRFn(EGLint attribute, EGLAttrib* value) {
GL_SERVICE_LOG("eglQueryDebugKHR"
<< "(" << attribute << ", " << static_cast<const void*>(value)
<< ")");
EGLBoolean result = egl_api_->eglQueryDebugKHRFn(attribute, value);
GL_SERVICE_LOG("GL_RESULT: " << result);
return result;
}
EGLBoolean DebugEGLApi::eglQueryStreamKHRFn(EGLDisplay dpy,
EGLStreamKHR stream,
EGLenum attribute,
......
......@@ -77,6 +77,9 @@ typedef EGLSurface(GL_BINDING_CALL* eglCreateWindowSurfaceProc)(
EGLConfig config,
EGLNativeWindowType win,
const EGLint* attrib_list);
typedef EGLint(GL_BINDING_CALL* eglDebugMessageControlKHRProc)(
EGLDEBUGPROCKHR callback,
const EGLAttrib* attrib_list);
typedef EGLBoolean(GL_BINDING_CALL* eglDestroyContextProc)(EGLDisplay dpy,
EGLContext ctx);
typedef EGLBoolean(GL_BINDING_CALL* eglDestroyImageKHRProc)(EGLDisplay dpy,
......@@ -167,6 +170,10 @@ typedef EGLBoolean(GL_BINDING_CALL* eglImageFlushExternalEXTProc)(
typedef EGLBoolean(GL_BINDING_CALL* eglInitializeProc)(EGLDisplay dpy,
EGLint* major,
EGLint* minor);
typedef EGLint(GL_BINDING_CALL* eglLabelObjectKHRProc)(EGLDisplay display,
EGLenum objectType,
EGLObjectKHR object,
EGLLabelKHR label);
typedef EGLBoolean(GL_BINDING_CALL* eglMakeCurrentProc)(EGLDisplay dpy,
EGLSurface draw,
EGLSurface read,
......@@ -201,6 +208,8 @@ typedef EGLBoolean(GL_BINDING_CALL* eglQueryContextProc)(EGLDisplay dpy,
EGLContext ctx,
EGLint attribute,
EGLint* value);
typedef EGLBoolean(GL_BINDING_CALL* eglQueryDebugKHRProc)(EGLint attribute,
EGLAttrib* value);
typedef EGLBoolean(GL_BINDING_CALL* eglQueryStreamKHRProc)(EGLDisplay dpy,
EGLStreamKHR stream,
EGLenum attribute,
......@@ -271,6 +280,7 @@ typedef EGLint(GL_BINDING_CALL* eglWaitSyncKHRProc)(EGLDisplay dpy,
struct ExtensionsEGL {
bool b_EGL_EXT_platform_base;
bool b_EGL_KHR_debug;
bool b_EGL_ANDROID_get_frame_timestamps;
bool b_EGL_ANDROID_get_native_client_buffer;
bool b_EGL_ANDROID_native_fence_sync;
......@@ -312,6 +322,7 @@ struct ProcsEGL {
eglCreateStreamProducerD3DTextureANGLEFn;
eglCreateSyncKHRProc eglCreateSyncKHRFn;
eglCreateWindowSurfaceProc eglCreateWindowSurfaceFn;
eglDebugMessageControlKHRProc eglDebugMessageControlKHRFn;
eglDestroyContextProc eglDestroyContextFn;
eglDestroyImageKHRProc eglDestroyImageKHRFn;
eglDestroyStreamKHRProc eglDestroyStreamKHRFn;
......@@ -341,6 +352,7 @@ struct ProcsEGL {
eglGetSyncValuesCHROMIUMProc eglGetSyncValuesCHROMIUMFn;
eglImageFlushExternalEXTProc eglImageFlushExternalEXTFn;
eglInitializeProc eglInitializeFn;
eglLabelObjectKHRProc eglLabelObjectKHRFn;
eglMakeCurrentProc eglMakeCurrentFn;
eglPostSubBufferNVProc eglPostSubBufferNVFn;
eglProgramCacheGetAttribANGLEProc eglProgramCacheGetAttribANGLEFn;
......@@ -349,6 +361,7 @@ struct ProcsEGL {
eglProgramCacheResizeANGLEProc eglProgramCacheResizeANGLEFn;
eglQueryAPIProc eglQueryAPIFn;
eglQueryContextProc eglQueryContextFn;
eglQueryDebugKHRProc eglQueryDebugKHRFn;
eglQueryStreamKHRProc eglQueryStreamKHRFn;
eglQueryStreamu64KHRProc eglQueryStreamu64KHRFn;
eglQueryStringProc eglQueryStringFn;
......@@ -433,6 +446,8 @@ class GL_EXPORT EGLApi {
EGLConfig config,
EGLNativeWindowType win,
const EGLint* attrib_list) = 0;
virtual EGLint eglDebugMessageControlKHRFn(EGLDEBUGPROCKHR callback,
const EGLAttrib* attrib_list) = 0;
virtual EGLBoolean eglDestroyContextFn(EGLDisplay dpy, EGLContext ctx) = 0;
virtual EGLBoolean eglDestroyImageKHRFn(EGLDisplay dpy,
EGLImageKHR image) = 0;
......@@ -514,6 +529,10 @@ class GL_EXPORT EGLApi {
virtual EGLBoolean eglInitializeFn(EGLDisplay dpy,
EGLint* major,
EGLint* minor) = 0;
virtual EGLint eglLabelObjectKHRFn(EGLDisplay display,
EGLenum objectType,
EGLObjectKHR object,
EGLLabelKHR label) = 0;
virtual EGLBoolean eglMakeCurrentFn(EGLDisplay dpy,
EGLSurface draw,
EGLSurface read,
......@@ -545,6 +564,7 @@ class GL_EXPORT EGLApi {
EGLContext ctx,
EGLint attribute,
EGLint* value) = 0;
virtual EGLBoolean eglQueryDebugKHRFn(EGLint attribute, EGLAttrib* value) = 0;
virtual EGLBoolean eglQueryStreamKHRFn(EGLDisplay dpy,
EGLStreamKHR stream,
EGLenum attribute,
......@@ -626,6 +646,8 @@ class GL_EXPORT EGLApi {
#define eglCreateSyncKHR ::gl::g_current_egl_context->eglCreateSyncKHRFn
#define eglCreateWindowSurface \
::gl::g_current_egl_context->eglCreateWindowSurfaceFn
#define eglDebugMessageControlKHR \
::gl::g_current_egl_context->eglDebugMessageControlKHRFn
#define eglDestroyContext ::gl::g_current_egl_context->eglDestroyContextFn
#define eglDestroyImageKHR ::gl::g_current_egl_context->eglDestroyImageKHRFn
#define eglDestroyStreamKHR ::gl::g_current_egl_context->eglDestroyStreamKHRFn
......@@ -665,6 +687,7 @@ class GL_EXPORT EGLApi {
#define eglImageFlushExternalEXT \
::gl::g_current_egl_context->eglImageFlushExternalEXTFn
#define eglInitialize ::gl::g_current_egl_context->eglInitializeFn
#define eglLabelObjectKHR ::gl::g_current_egl_context->eglLabelObjectKHRFn
#define eglMakeCurrent ::gl::g_current_egl_context->eglMakeCurrentFn
#define eglPostSubBufferNV ::gl::g_current_egl_context->eglPostSubBufferNVFn
#define eglProgramCacheGetAttribANGLE \
......@@ -677,6 +700,7 @@ class GL_EXPORT EGLApi {
::gl::g_current_egl_context->eglProgramCacheResizeANGLEFn
#define eglQueryAPI ::gl::g_current_egl_context->eglQueryAPIFn
#define eglQueryContext ::gl::g_current_egl_context->eglQueryContextFn
#define eglQueryDebugKHR ::gl::g_current_egl_context->eglQueryDebugKHRFn
#define eglQueryStreamKHR ::gl::g_current_egl_context->eglQueryStreamKHRFn
#define eglQueryStreamu64KHR ::gl::g_current_egl_context->eglQueryStreamu64KHRFn
#define eglQueryString ::gl::g_current_egl_context->eglQueryStringFn
......
......@@ -65,6 +65,8 @@ MOCK_METHOD4(CreateWindowSurface,
EGLConfig config,
EGLNativeWindowType win,
const EGLint* attrib_list));
MOCK_METHOD2(DebugMessageControlKHR,
EGLint(EGLDEBUGPROCKHR callback, const EGLAttrib* attrib_list));
MOCK_METHOD2(DestroyContext, EGLBoolean(EGLDisplay dpy, EGLContext ctx));
MOCK_METHOD2(DestroyImageKHR, EGLBoolean(EGLDisplay dpy, EGLImageKHR image));
MOCK_METHOD2(DestroyStreamKHR, EGLBoolean(EGLDisplay dpy, EGLStreamKHR stream));
......@@ -144,6 +146,11 @@ MOCK_METHOD3(ImageFlushExternalEXT,
const EGLAttrib* attrib_list));
MOCK_METHOD3(Initialize,
EGLBoolean(EGLDisplay dpy, EGLint* major, EGLint* minor));
MOCK_METHOD4(LabelObjectKHR,
EGLint(EGLDisplay display,
EGLenum objectType,
EGLObjectKHR object,
EGLLabelKHR label));
MOCK_METHOD4(MakeCurrent,
EGLBoolean(EGLDisplay dpy,
EGLSurface draw,
......@@ -179,6 +186,7 @@ MOCK_METHOD4(QueryContext,
EGLContext ctx,
EGLint attribute,
EGLint* value));
MOCK_METHOD2(QueryDebugKHR, EGLBoolean(EGLint attribute, EGLAttrib* value));
MOCK_METHOD4(QueryStreamKHR,
EGLBoolean(EGLDisplay dpy,
EGLStreamKHR stream,
......
......@@ -483,6 +483,49 @@ void AddInitDisplay(std::vector<DisplayType>* init_displays,
}
}
const char* GetDebugMessageTypeString(EGLint source) {
switch (source) {
case EGL_DEBUG_MSG_CRITICAL_KHR:
return "Critical";
case EGL_DEBUG_MSG_ERROR_KHR:
return "Error";
case EGL_DEBUG_MSG_WARN_KHR:
return "Warning";
case EGL_DEBUG_MSG_INFO_KHR:
return "Info";
default:
return "UNKNOWN";
}
}
static void EGLAPIENTRY LogEGLDebugMessage(EGLenum error,
const char* command,
EGLint message_type,
EGLLabelKHR thread_label,
EGLLabelKHR object_label,
const char* message) {
std::string formatted_message = std::string("EGL Driver message (") +
GetDebugMessageTypeString(message_type) +
") " + command + ": " + message;
// Assume that all labels that have been set are strings
if (thread_label) {
formatted_message += " thread: ";
formatted_message += static_cast<const char*>(thread_label);
}
if (object_label) {
formatted_message += " object: ";
formatted_message += static_cast<const char*>(object_label);
}
if (message_type == EGL_DEBUG_MSG_CRITICAL_KHR ||
message_type == EGL_DEBUG_MSG_ERROR_KHR) {
LOG(ERROR) << formatted_message;
} else {
DVLOG(1) << formatted_message;
}
}
} // namespace
void GetEGLInitDisplays(bool supports_angle_d3d,
......@@ -823,6 +866,26 @@ EGLDisplay GLSurfaceEGL::InitializeDisplay(
const char* client_extensions =
eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
bool supports_egl_debug =
client_extensions &&
ExtensionsContain(client_extensions, "EGL_KHR_debug");
if (supports_egl_debug) {
EGLAttrib controls[] = {
EGL_DEBUG_MSG_CRITICAL_KHR,
EGL_TRUE,
EGL_DEBUG_MSG_ERROR_KHR,
EGL_TRUE,
EGL_DEBUG_MSG_WARN_KHR,
EGL_TRUE,
EGL_DEBUG_MSG_INFO_KHR,
EGL_TRUE,
EGL_NONE,
EGL_NONE,
};
eglDebugMessageControlKHR(&LogEGLDebugMessage, controls);
}
bool supports_angle_d3d = false;
bool supports_angle_opengl = false;
bool supports_angle_null = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment