From b6096c3d409ad850470013ffa4808b6d90c03bc5 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 26 Feb 2021 13:33:25 +0100 Subject: [PATCH] glgsg: Suppress useless shader linking warnings on macOS --- panda/src/glstuff/glShaderContext_src.cxx | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 8b253eab72..2abe4659ea 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -3095,6 +3095,37 @@ glsl_report_program_errors(GLuint program, bool fatal) { if (strcmp(info_log, "Success.\n") != 0 && strcmp(info_log, "No errors.\n") != 0 && strcmp(info_log, "Validation successful.\n") != 0) { + +#ifdef __APPLE__ + // Filter out these unhelpful warnings that Apple always generates. + while (true) { + if (info_log[0] == '\n') { + ++info_log; + continue; + } + if (info_log[0] == '\0') { + // We reached the end without finding anything interesting. + return; + } + int linelen = 0; + if ((sscanf(info_log, "WARNING: Could not find vertex shader attribute %*s to match BindAttributeLocation request.%*[\n]%n", &linelen) == 0 && linelen > 0) || + (sscanf(info_log, "WARNING: Could not find fragment shader output %*s to match FragDataBinding request.%*[\n]%n", &linelen) == 0 && linelen > 0)) { + info_log += linelen; + continue; + } + else { + break; + } + + info_log = strchr(info_log, '\n'); + if (info_log == nullptr) { + // We reached the end without finding anything interesting. + return; + } + ++info_log; + } +#endif + if (!fatal) { GLCAT.warning() << "Shader " << _shader->get_filename() << " produced the "