diff options
author | Yuri Rubinsky <chaosus89@gmail.com> | 2022-07-23 09:38:59 +0300 |
---|---|---|
committer | Yuri Rubinsky <chaosus89@gmail.com> | 2022-07-23 09:38:59 +0300 |
commit | 6d992abb541d4e772ef1fbc16d0b82ca3a6b343d (patch) | |
tree | c1b6dcbe8301cb5d1cc081ef6f5ef497bca6f774 /servers/rendering/shader_preprocessor.cpp | |
parent | fe929d4787b2b11390891fb03da1dda78b18eb65 (diff) |
Fix some errors after shader preprocessor PR
Diffstat (limited to 'servers/rendering/shader_preprocessor.cpp')
-rw-r--r-- | servers/rendering/shader_preprocessor.cpp | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/servers/rendering/shader_preprocessor.cpp b/servers/rendering/shader_preprocessor.cpp index 9623d11010..a7b274b3e2 100644 --- a/servers/rendering/shader_preprocessor.cpp +++ b/servers/rendering/shader_preprocessor.cpp @@ -344,41 +344,23 @@ void ShaderPreprocessor::process_directive(Tokenizer *p_tokenizer) { } if (directive == "if") { - if (check_directive_before_type(p_tokenizer, directive)) { - process_if(p_tokenizer); - } + process_if(p_tokenizer); } else if (directive == "ifdef") { - if (check_directive_before_type(p_tokenizer, directive)) { - process_ifdef(p_tokenizer); - } + process_ifdef(p_tokenizer); } else if (directive == "ifndef") { - if (check_directive_before_type(p_tokenizer, directive)) { - process_ifndef(p_tokenizer); - } + process_ifndef(p_tokenizer); } else if (directive == "else") { - if (check_directive_before_type(p_tokenizer, directive)) { - process_else(p_tokenizer); - } + process_else(p_tokenizer); } else if (directive == "endif") { - if (check_directive_before_type(p_tokenizer, directive)) { - process_endif(p_tokenizer); - } + process_endif(p_tokenizer); } else if (directive == "define") { - if (check_directive_before_type(p_tokenizer, directive)) { - process_define(p_tokenizer); - } + process_define(p_tokenizer); } else if (directive == "undef") { - if (check_directive_before_type(p_tokenizer, directive)) { - process_undef(p_tokenizer); - } + process_undef(p_tokenizer); } else if (directive == "include") { - if (check_directive_before_type(p_tokenizer, directive)) { - process_include(p_tokenizer); - } + process_include(p_tokenizer); } else if (directive == "pragma") { - if (check_directive_before_type(p_tokenizer, directive)) { - process_pragma(p_tokenizer); - } + process_pragma(p_tokenizer); } else { set_error(RTR("Unknown directive."), p_tokenizer->get_line()); } @@ -880,14 +862,6 @@ void ShaderPreprocessor::set_error(const String &p_error, int p_line) { } } -bool ShaderPreprocessor::check_directive_before_type(Tokenizer *p_tokenizer, const String &p_directive) { - if (p_tokenizer->get_index() < state->shader_type_pos) { - set_error(vformat(RTR("`#%s` may not be defined before `shader_type`."), p_directive), p_tokenizer->get_line()); - return false; - } - return true; -} - ShaderPreprocessor::Define *ShaderPreprocessor::create_define(const String &p_body) { ShaderPreprocessor::Define *define = memnew(Define); define->body = p_body; |