Fix: GPU shader error logging doesn't show shader name or stage

This was relying on the souce file and line printing which is now disabled
by default. Also log the shader source without indent for readability.

Pull Request: https://projects.blender.org/blender/blender/pulls/142882
This commit is contained in:
Brecht Van Lommel
2025-07-24 16:10:19 +02:00
committed by Brecht Van Lommel
parent 9c9695b103
commit ba46217b51
3 changed files with 10 additions and 2 deletions

View File

@@ -111,6 +111,7 @@ void CLG_logf(const CLG_LogType *lg,
const char *fn,
const char *format,
...) _CLOG_ATTR_NONNULL(1, 3, 4, 5) _CLOG_ATTR_PRINTF_FORMAT(5, 6);
void CLG_log_raw(const CLG_LogType *lg, const char *message);
/* Main initializer and destructor (per session, not logger). */
void CLG_init();

View File

@@ -684,6 +684,13 @@ void CLG_logf(const CLG_LogType *lg,
}
}
void CLG_log_raw(const CLG_LogType *lg, const char *message)
{
/* Write raw text without any formatting. */
int bytes_written = write(lg->ctx->output, message, strlen(message));
(void)bytes_written;
}
/** \} */
/* -------------------------------------------------------------------- */

View File

@@ -250,10 +250,10 @@ void Shader::print_log(Span<StringRefNull> sources,
if (CLOG_CHECK(&LOG, level)) {
if (DEBUG_LOG_SHADER_SRC_ON_ERROR && error) {
CLG_log_str(LOG.type, level, this->name, stage, sources_combined.c_str());
CLG_log_raw(LOG.type, sources_combined.c_str());
}
const char *_str = BLI_dynstr_get_cstring(dynstr);
CLG_log_str(LOG.type, level, this->name, stage, _str);
CLOG_AT_LEVEL(&LOG, level, "%s %s: %s", this->name, stage, _str);
MEM_freeN(_str);
}