Merge pull request #50536 from Calinou/improve-shader-error-output-3.x
Improve the shader error console output
This commit is contained in:
commit
087f23fd15
|
@ -987,7 +987,13 @@ Error ShaderCompilerGLES2::compile(VS::ShaderMode p_mode, const String &p_code,
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
Vector<String> shader = p_code.split("\n");
|
Vector<String> shader = p_code.split("\n");
|
||||||
for (int i = 0; i < shader.size(); i++) {
|
for (int i = 0; i < shader.size(); i++) {
|
||||||
print_line(itos(i + 1) + " " + shader[i]);
|
if (i + 1 == parser.get_error_line()) {
|
||||||
|
// Mark the error line to be visible without having to look at
|
||||||
|
// the trace at the end.
|
||||||
|
print_line(vformat("E%4d-> %s", i + 1, shader[i]));
|
||||||
|
} else {
|
||||||
|
print_line(vformat("%5d | %s", i + 1, shader[i]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_err_print_error(nullptr, p_path.utf8().get_data(), parser.get_error_line(), parser.get_error_text().utf8().get_data(), ERR_HANDLER_SHADER);
|
_err_print_error(nullptr, p_path.utf8().get_data(), parser.get_error_line(), parser.get_error_text().utf8().get_data(), ERR_HANDLER_SHADER);
|
||||||
|
|
|
@ -119,7 +119,7 @@ static void _display_error_with_code(const String &p_error, const Vector<const c
|
||||||
Vector<String> lines = String(total_code).split("\n");
|
Vector<String> lines = String(total_code).split("\n");
|
||||||
|
|
||||||
for (int j = 0; j < lines.size(); j++) {
|
for (int j = 0; j < lines.size(); j++) {
|
||||||
print_line(itos(line) + ": " + lines[j]);
|
print_line(vformat("%4d | %s", line, lines[j]));
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1031,7 +1031,13 @@ Error ShaderCompilerGLES3::compile(VS::ShaderMode p_mode, const String &p_code,
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
Vector<String> shader = p_code.split("\n");
|
Vector<String> shader = p_code.split("\n");
|
||||||
for (int i = 0; i < shader.size(); i++) {
|
for (int i = 0; i < shader.size(); i++) {
|
||||||
print_line(itos(i + 1) + " " + shader[i]);
|
if (i + 1 == parser.get_error_line()) {
|
||||||
|
// Mark the error line to be visible without having to look at
|
||||||
|
// the trace at the end.
|
||||||
|
print_line(vformat("E%4d-> %s", i + 1, shader[i]));
|
||||||
|
} else {
|
||||||
|
print_line(vformat("%5d | %s", i + 1, shader[i]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_err_print_error(nullptr, p_path.utf8().get_data(), parser.get_error_line(), parser.get_error_text().utf8().get_data(), ERR_HANDLER_SHADER);
|
_err_print_error(nullptr, p_path.utf8().get_data(), parser.get_error_line(), parser.get_error_text().utf8().get_data(), ERR_HANDLER_SHADER);
|
||||||
|
|
|
@ -149,7 +149,7 @@ static void _display_error_with_code(const String &p_error, const Vector<const c
|
||||||
Vector<String> lines = String(total_code).split("\n");
|
Vector<String> lines = String(total_code).split("\n");
|
||||||
|
|
||||||
for (int j = 0; j < lines.size(); j++) {
|
for (int j = 0; j < lines.size(); j++) {
|
||||||
print_line(itos(line) + ": " + lines[j]);
|
print_line(vformat("%4d | %s", line, lines[j]));
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue