diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-08-13 12:47:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-13 12:47:06 +0200 |
commit | 0a10a93fb0d2467fd836ad38501550ca79f0fa72 (patch) | |
tree | 07d5e9c60eeba784182363752b8d8b7e9dbf91eb | |
parent | 592909db16d1914287883b60a3bdb66f5b86d971 (diff) | |
parent | 24417f19752f16b6c637db42713f569af39184bf (diff) |
Merge pull request #31345 from Chaosus/shader_const_strict
Force user to initialize local shader constants
-rw-r--r-- | servers/visual/shader_language.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 5f39d3ff49..c0b503c323 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -4022,6 +4022,10 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui _set_error("Expected array initialization"); return ERR_PARSE_ERROR; } + if (is_const) { + _set_error("Expected initialization of constant"); + return ERR_PARSE_ERROR; + } } node->declarations.push_back(decl); @@ -4051,6 +4055,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui tk = _get_token(); node->declarations.push_back(decl); } else { + if (is_const) { + _set_error("Expected initialization of constant"); + return ERR_PARSE_ERROR; + } + VariableDeclarationNode *node = alloc_node<VariableDeclarationNode>(); node->datatype = type; node->precision = precision; |