Metal: Workaround broken shader log

Disable shader log parsing for now as
it conflicts with the `#line` directives
added during preprocessing.

Pull Request: https://projects.blender.org/blender/blender/pulls/145495
This commit is contained in:
Clément Foucault
2025-09-01 10:53:25 +02:00
committed by Clément Foucault
parent 5c450290ff
commit 13329ad984
2 changed files with 8 additions and 6 deletions

View File

@@ -379,8 +379,7 @@ bool MTLShader::finalize(const shader::ShaderCreateInfo *info)
NSNotFound)
{
const char *errors_c_str = [[error localizedDescription] UTF8String];
const StringRefNull source = (is_compute) ? shd_builder_->glsl_compute_source_ :
shd_builder_->glsl_fragment_source_;
const StringRefNull source = [source_to_compile UTF8String];
MTLLogParser parser;
print_log({source}, errors_c_str, to_string(src_stage), true, &parser);

View File

@@ -35,9 +35,6 @@ const char *MTLLogParser::parse_line(const char *source_combined,
log_line = error_line_number_end;
log_line = skip_separators(log_line, ": ");
log_item.cursor.column = parse_number(log_line, &error_line_number_end);
/* For some reason the row and column is 0 based in C++ / Metal compiler. */
log_item.cursor.row -= 1;
log_item.cursor.column -= 1;
log_line = error_line_number_end;
/* Simply copy the start of the error line since it is already in the format we want. */
log_item.cursor.file_name_and_error_line = StringRef(name_start, error_line_number_end);
@@ -68,7 +65,13 @@ const char *MTLLogParser::parse_line(const char *source_combined,
log_item.cursor.row++;
}
}
parsed_error_ = true;
/* The method above does not work with injected #line directives.
* Just output the raw error and forget about the formatting for now. */
log_item.cursor.row = -1;
log_item.cursor.file_name_and_error_line = "";
parsed_error_ = false;
wrapper_error_ = true;
return name_start;
}
}
}