diff options
Diffstat (limited to 'servers/visual/shader_language.cpp')
| -rw-r--r-- | servers/visual/shader_language.cpp | 70 | 
1 files changed, 35 insertions, 35 deletions
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 404686a31c..639946916d 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2184,11 +2184,11 @@ bool ShaderLanguage::_validate_function_call(BlockNode *p_block, OperatorNode *p  		bool fail = false; -		for (int i = 0; i < args.size(); i++) { +		for (int j = 0; j < args.size(); j++) { -			if (get_scalar_type(args[i]) == args[i] && p_func->arguments[i + 1]->type == Node::TYPE_CONSTANT && convert_constant(static_cast<ConstantNode *>(p_func->arguments[i + 1]), pfunc->arguments[i].type)) { +			if (get_scalar_type(args[j]) == args[j] && p_func->arguments[j + 1]->type == Node::TYPE_CONSTANT && convert_constant(static_cast<ConstantNode *>(p_func->arguments[j + 1]), pfunc->arguments[j].type)) {  				//all good -			} else if (args[i] != pfunc->arguments[i].type) { +			} else if (args[j] != pfunc->arguments[j].type) {  				fail = true;  				break;  			} @@ -2897,7 +2897,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons  		/* OK now see what's NEXT to the operator.. */  		while (true) { -			TkPos pos = _get_tkpos(); +			TkPos pos2 = _get_tkpos();  			tk = _get_token();  			if (tk.type == TK_CURSOR) { @@ -3181,7 +3181,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons  				expr = op;  			} else { -				_set_tkpos(pos); +				_set_tkpos(pos2);  				break;  			}  		} @@ -3374,10 +3374,10 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons  				if (!_validate_operator(op, &op->return_cache)) {  					String at; -					for (int i = 0; i < op->arguments.size(); i++) { -						if (i > 0) +					for (int j = 0; j < op->arguments.size(); j++) { +						if (j > 0)  							at += " and "; -						at += get_datatype_name(op->arguments[i]->get_datatype()); +						at += get_datatype_name(op->arguments[j]->get_datatype());  					}  					_set_error("Invalid arguments to unary operator '" + get_operator_text(op->op) + "' :" + at);  					return NULL; @@ -4103,17 +4103,17 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct  				if (uniform) { -					ShaderNode::Uniform uniform; +					ShaderNode::Uniform uniform2;  					if (is_sampler_type(type)) { -						uniform.texture_order = texture_uniforms++; -						uniform.order = -1; +						uniform2.texture_order = texture_uniforms++; +						uniform2.order = -1;  					} else { -						uniform.texture_order = -1; -						uniform.order = uniforms++; +						uniform2.texture_order = -1; +						uniform2.order = uniforms++;  					} -					uniform.type = type; -					uniform.precision = precision; +					uniform2.type = type; +					uniform2.precision = precision;  					//todo parse default value @@ -4124,26 +4124,26 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct  						tk = _get_token();  						if (tk.type == TK_HINT_WHITE_TEXTURE) { -							uniform.hint = ShaderNode::Uniform::HINT_WHITE; +							uniform2.hint = ShaderNode::Uniform::HINT_WHITE;  						} else if (tk.type == TK_HINT_BLACK_TEXTURE) { -							uniform.hint = ShaderNode::Uniform::HINT_BLACK; +							uniform2.hint = ShaderNode::Uniform::HINT_BLACK;  						} else if (tk.type == TK_HINT_NORMAL_TEXTURE) { -							uniform.hint = ShaderNode::Uniform::HINT_NORMAL; +							uniform2.hint = ShaderNode::Uniform::HINT_NORMAL;  						} else if (tk.type == TK_HINT_ANISO_TEXTURE) { -							uniform.hint = ShaderNode::Uniform::HINT_ANISO; +							uniform2.hint = ShaderNode::Uniform::HINT_ANISO;  						} else if (tk.type == TK_HINT_ALBEDO_TEXTURE) { -							uniform.hint = ShaderNode::Uniform::HINT_ALBEDO; +							uniform2.hint = ShaderNode::Uniform::HINT_ALBEDO;  						} else if (tk.type == TK_HINT_BLACK_ALBEDO_TEXTURE) { -							uniform.hint = ShaderNode::Uniform::HINT_BLACK_ALBEDO; +							uniform2.hint = ShaderNode::Uniform::HINT_BLACK_ALBEDO;  						} else if (tk.type == TK_HINT_COLOR) {  							if (type != TYPE_VEC4) {  								_set_error("Color hint is for vec4 only");  								return ERR_PARSE_ERROR;  							} -							uniform.hint = ShaderNode::Uniform::HINT_COLOR; +							uniform2.hint = ShaderNode::Uniform::HINT_COLOR;  						} else if (tk.type == TK_HINT_RANGE) { -							uniform.hint = ShaderNode::Uniform::HINT_RANGE; +							uniform2.hint = ShaderNode::Uniform::HINT_RANGE;  							if (type != TYPE_FLOAT && type != TYPE_INT) {  								_set_error("Range hint is for float and int only");  								return ERR_PARSE_ERROR; @@ -4169,8 +4169,8 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct  								return ERR_PARSE_ERROR;  							} -							uniform.hint_range[0] = tk.constant; -							uniform.hint_range[0] *= sign; +							uniform2.hint_range[0] = tk.constant; +							uniform2.hint_range[0] *= sign;  							tk = _get_token(); @@ -4193,8 +4193,8 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct  								return ERR_PARSE_ERROR;  							} -							uniform.hint_range[1] = tk.constant; -							uniform.hint_range[1] *= sign; +							uniform2.hint_range[1] = tk.constant; +							uniform2.hint_range[1] *= sign;  							tk = _get_token(); @@ -4206,13 +4206,13 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct  									return ERR_PARSE_ERROR;  								} -								uniform.hint_range[2] = tk.constant; +								uniform2.hint_range[2] = tk.constant;  								tk = _get_token();  							} else {  								if (type == TYPE_INT) { -									uniform.hint_range[2] = 1; +									uniform2.hint_range[2] = 1;  								} else { -									uniform.hint_range[2] = 0.001; +									uniform2.hint_range[2] = 0.001;  								}  							} @@ -4225,7 +4225,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct  							_set_error("Expected valid type hint after ':'.");  						} -						if (uniform.hint != ShaderNode::Uniform::HINT_RANGE && uniform.hint != ShaderNode::Uniform::HINT_NONE && uniform.hint != ShaderNode::Uniform::HINT_COLOR && type <= TYPE_MAT4) { +						if (uniform2.hint != ShaderNode::Uniform::HINT_RANGE && uniform2.hint != ShaderNode::Uniform::HINT_NONE && uniform2.hint != ShaderNode::Uniform::HINT_COLOR && type <= TYPE_MAT4) {  							_set_error("This hint is only for sampler types");  							return ERR_PARSE_ERROR;  						} @@ -4245,16 +4245,16 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct  						ConstantNode *cn = static_cast<ConstantNode *>(expr); -						uniform.default_value.resize(cn->values.size()); +						uniform2.default_value.resize(cn->values.size()); -						if (!convert_constant(cn, uniform.type, uniform.default_value.ptrw())) { -							_set_error("Can't convert constant to " + get_datatype_name(uniform.type)); +						if (!convert_constant(cn, uniform2.type, uniform2.default_value.ptrw())) { +							_set_error("Can't convert constant to " + get_datatype_name(uniform2.type));  							return ERR_PARSE_ERROR;  						}  						tk = _get_token();  					} -					shader->uniforms[name] = uniform; +					shader->uniforms[name] = uniform2;  					if (tk.type != TK_SEMICOLON) {  						_set_error("Expected ';'");  |