summaryrefslogtreecommitdiff
path: root/servers/visual
diff options
context:
space:
mode:
authorDaniel Doran <ddoran3@gmail.com>2017-09-24 01:27:12 -0600
committerDaniel Doran <ddoran3@gmail.com>2017-09-24 01:37:53 -0600
commitd0c42da961e87b936ad3f82fd45ac6f577a99e6b (patch)
tree90460d6d9bb665edf1c4093d594d9d390ee10832 /servers/visual
parentdf5dab738a9aa35b75e439732cfc4d23e16789cd (diff)
Discarding now works in shaders
"discard" has been added to the list of recognised keywords. A flag specifing when discarding is allowed is now set correctly.
Diffstat (limited to 'servers/visual')
-rw-r--r--servers/visual/shader_language.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index ec3337686f..595decb529 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -267,6 +267,7 @@ const ShaderLanguage::KeyWord ShaderLanguage::keyword_list[] = {
{ TK_CF_BREAK, "break" },
{ TK_CF_CONTINUE, "continue" },
{ TK_CF_RETURN, "return" },
+ { TK_CF_DISCARD, "discard" },
{ TK_UNIFORM, "uniform" },
{ TK_VARYING, "varying" },
{ TK_ARG_IN, "in" },
@@ -3804,6 +3805,10 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
func_node->return_type = type;
func_node->return_precision = precision;
+ if (p_functions.has(name)) {
+ func_node->can_discard = p_functions[name].can_discard;
+ }
+
func_node->body = alloc_node<BlockNode>();
func_node->body->parent_function = func_node;