summaryrefslogtreecommitdiff
path: root/servers/visual/shader_language.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'servers/visual/shader_language.cpp')
-rw-r--r--servers/visual/shader_language.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index 6ad433268f..b2a11deea1 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" },
@@ -1377,6 +1378,10 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
{ "sqrt", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } },
{ "sqrt", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } },
{ "sqrt", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } },
+ { "inversesqrt", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } },
+ { "inversesqrt", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } },
+ { "inversesqrt", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } },
+ { "inversesqrt", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } },
//builtins - common
{ "abs", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } },
{ "abs", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } },
@@ -1740,8 +1745,6 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
{ "textureGrad", TYPE_UVEC4, { TYPE_USAMPLER2D, TYPE_VEC2, TYPE_VEC2, TYPE_VEC2, TYPE_VOID } },
{ "textureGrad", TYPE_VEC4, { TYPE_SAMPLERCUBE, TYPE_VEC3, TYPE_VEC3, TYPE_VEC3, TYPE_VOID } },
- { "textureScreen", TYPE_VEC4, { TYPE_VEC2, TYPE_VOID } },
-
{ "dFdx", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } },
{ "dFdx", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } },
{ "dFdx", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } },
@@ -3800,6 +3803,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;