From c017820692a739762a3a3958baa4d29eb1526b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Fri, 4 Feb 2022 20:16:54 +0100 Subject: GPUShader: Improve error/warning logging experience Thanks to the new `ShaderCreateInfo` we now include source files without any modification. This let us query which are the source files passed to the `print_log` function. The log will now include a file with row and column number which is interpreted as a link in most IDE. DEBUG_CONTEXT_LINES will add more lines around the error lines for more context. This is also useful if the error line is imprecise (because of driver bugs) and the reported line is not sufficient to know the location of the error. The DEBUG_DEPENDENCIES option will display the list of included files in the shader sources. Note that it will not print generated source. This commit also fixes some issues with unhelpful logs, bogus row & column numbers, other error format, and bug if row was 0. --- source/blender/gpu/opengl/gl_shader_log.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/blender/gpu/opengl') diff --git a/source/blender/gpu/opengl/gl_shader_log.cc b/source/blender/gpu/opengl/gl_shader_log.cc index 174cc63ad81..0ee70b54f52 100644 --- a/source/blender/gpu/opengl/gl_shader_log.cc +++ b/source/blender/gpu/opengl/gl_shader_log.cc @@ -60,6 +60,15 @@ char *GLLogParser::parse_line(char *log_line, GPULogItem &log_item) log_item.cursor.row = log_item.cursor.column; log_item.cursor.column = -1; } + else if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OFFICIAL) && + /* WORKAROUND(@fclem): Both Mesa and amdgpu-pro are reported as official. */ + StringRefNull(GPU_platform_version()).find(" Mesa ") == -1) { + /* source:row */ + log_item.cursor.source = log_item.cursor.row; + log_item.cursor.row = log_item.cursor.column; + log_item.cursor.column = -1; + log_item.source_base_row = true; + } else { /* line:char */ } -- cgit v1.2.3