Fix shader preprocessor cyclic include handling

This commit is contained in:
bitsawer 2023-05-29 12:05:22 +03:00
parent 1ae0bb0e8f
commit 67038471ff
3 changed files with 19 additions and 17 deletions

View file

@ -700,7 +700,7 @@ void ShaderPreprocessor::process_include(Tokenizer *p_tokenizer) {
if (!included.is_empty()) {
uint64_t code_hash = included.hash64();
if (state->cyclic_include_hashes.find(code_hash)) {
set_error(RTR("Cyclic include found."), line);
set_error(RTR("Cyclic include found") + ": " + path, line);
return;
}
}
@ -733,7 +733,7 @@ void ShaderPreprocessor::process_include(Tokenizer *p_tokenizer) {
FilePosition fp;
fp.file = state->current_filename;
fp.line = line;
fp.line = line + 1;
state->include_positions.push_back(fp);
String result;
@ -1157,6 +1157,7 @@ void ShaderPreprocessor::set_error(const String &p_error, int p_line) {
if (state->error.is_empty()) {
state->error = p_error;
FilePosition fp;
fp.file = state->current_filename;
fp.line = p_line + 1;
state->include_positions.push_back(fp);
}