From d4712af5af93bc2aea47d15b52dedcc61d9f81f1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 12 May 2016 11:17:49 +0200 Subject: vo_opengl: angle: dump translated shaders Helpful for debugging and such. --- video/out/opengl/common.c | 7 +++++++ video/out/opengl/common.h | 3 +++ video/out/opengl/header_fixes.h | 5 +++++ video/out/opengl/utils.c | 10 ++++++++++ 4 files changed, 25 insertions(+) diff --git a/video/out/opengl/common.c b/video/out/opengl/common.c index f9c830f25a..ee8b4c6468 100644 --- a/video/out/opengl/common.c +++ b/video/out/opengl/common.c @@ -344,6 +344,13 @@ static const struct gl_functions gl_functions[] = { {0} }, }, + { + .extension = "GL_ANGLE_translated_shader_source", + .functions = (const struct gl_function[]) { + DEF_FN(GetTranslatedShaderSourceANGLE), + {0} + }, + }, }; #undef FN_OFFS diff --git a/video/out/opengl/common.h b/video/out/opengl/common.h index ef75ae1645..cc6f7b6459 100644 --- a/video/out/opengl/common.h +++ b/video/out/opengl/common.h @@ -212,6 +212,9 @@ struct GL { GLuint (GLAPIENTRY *GetUniformBlockIndex)(GLuint, const GLchar *); void (GLAPIENTRY *UniformBlockBinding)(GLuint, GLuint, GLuint); + void (GLAPIENTRY *GetTranslatedShaderSourceANGLE)(GLuint, GLsizei, + GLsizei*, GLchar* source); + void (GLAPIENTRY *DebugMessageCallback)(MP_GLDEBUGPROC callback, const void *userParam); diff --git a/video/out/opengl/header_fixes.h b/video/out/opengl/header_fixes.h index 494658a64b..92867a0d01 100644 --- a/video/out/opengl/header_fixes.h +++ b/video/out/opengl/header_fixes.h @@ -93,6 +93,11 @@ #define GL_TEXTURE_EXTERNAL_OES 0x8D65 #endif +// GL_ANGLE_translated_shader_source +#ifndef GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE +#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 +#endif + #undef MP_GET_GL_WORKAROUNDS #endif // MP_GET_GL_WORKAROUNDS diff --git a/video/out/opengl/utils.c b/video/out/opengl/utils.c index d93db76869..60e1792a14 100644 --- a/video/out/opengl/utils.c +++ b/video/out/opengl/utils.c @@ -871,6 +871,16 @@ static void compile_attach_shader(struct gl_shader_cache *sc, GLuint program, typestr, status, logstr); talloc_free(logstr); } + if (gl->GetTranslatedShaderSourceANGLE && mp_msg_test(sc->log, MSGL_DEBUG)) { + GLint len = 0; + gl->GetShaderiv(shader, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, &len); + if (len > 0) { + GLchar *sstr = talloc_zero_size(NULL, len + 1); + gl->GetTranslatedShaderSourceANGLE(shader, len, NULL, sstr); + MP_DBG(sc, "Translated shader:\n"); + mp_log_source(sc->log, MSGL_DEBUG, sstr); + } + } gl->AttachShader(program, shader); gl->DeleteShader(shader); -- cgit v1.2.3