summaryrefslogtreecommitdiff
path: root/servers/rendering
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2020-09-20 18:45:37 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2020-09-22 10:35:52 +0300
commit53740c69dfd7dcfcdac1fa97c46cd6861ad4d9e2 (patch)
treeb4163c13083e233558dbf71ff6434398af1015b0 /servers/rendering
parent80399781100796ea62184a2a908fc7fe23b27303 (diff)
Forbids varying declaration in particles and sky shaders
Diffstat (limited to 'servers/rendering')
-rw-r--r--servers/rendering/shader_language.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 28c41fb2dc..6c835fcadf 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -6099,6 +6099,14 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
case TK_UNIFORM:
case TK_VARYING: {
bool uniform = tk.type == TK_UNIFORM;
+
+ if (!uniform) {
+ if (shader_type_identifier == "particles" || shader_type_identifier == "sky") {
+ _set_error(vformat("Varyings cannot be used in '%s' shaders!", shader_type_identifier));
+ return ERR_PARSE_ERROR;
+ }
+ }
+
DataPrecision precision = PRECISION_DEFAULT;
DataInterpolation interpolation = INTERPOLATION_SMOOTH;
DataType type;