diff options
Diffstat (limited to 'servers/rendering/shader_language.h')
| -rw-r--r-- | servers/rendering/shader_language.h | 31 | 
1 files changed, 24 insertions, 7 deletions
diff --git a/servers/rendering/shader_language.h b/servers/rendering/shader_language.h index faf06a9a85..0d044a21c7 100644 --- a/servers/rendering/shader_language.h +++ b/servers/rendering/shader_language.h @@ -730,8 +730,25 @@ public:  				constant(p_constant) {}  	}; +	struct StageFunctionInfo { +		struct Argument { +			StringName name; +			DataType type; + +			Argument(const StringName &p_name = StringName(), DataType p_type = TYPE_VOID) { +				name = p_name; +				type = p_type; +			} +		}; + +		Vector<Argument> arguments; +		DataType return_type = TYPE_VOID; +	}; +  	struct FunctionInfo {  		Map<StringName, BuiltInInfo> built_ins; +		Map<StringName, StageFunctionInfo> stage_functions; +  		bool can_discard;  	};  	static bool has_builtin(const Map<StringName, ShaderLanguage::FunctionInfo> &p_functions, const StringName &p_name); @@ -802,9 +819,9 @@ private:  		IDENTIFIER_CONSTANT,  	}; -	bool _find_identifier(const BlockNode *p_block, bool p_allow_reassign, const Map<StringName, BuiltInInfo> &p_builtin_types, const StringName &p_identifier, DataType *r_data_type = nullptr, IdentifierType *r_type = nullptr, bool *r_is_const = nullptr, int *r_array_size = nullptr, StringName *r_struct_name = nullptr); +	bool _find_identifier(const BlockNode *p_block, bool p_allow_reassign, const FunctionInfo &p_function_info, const StringName &p_identifier, DataType *r_data_type = nullptr, IdentifierType *r_type = nullptr, bool *r_is_const = nullptr, int *r_array_size = nullptr, StringName *r_struct_name = nullptr);  	bool _is_operator_assign(Operator p_op) const; -	bool _validate_assign(Node *p_node, const Map<StringName, BuiltInInfo> &p_builtin_types, String *r_message = nullptr); +	bool _validate_assign(Node *p_node, const FunctionInfo &p_function_info, String *r_message = nullptr);  	bool _validate_operator(OperatorNode *p_op, DataType *r_ret_type = nullptr);  	struct BuiltinFuncDef { @@ -837,16 +854,16 @@ private:  	Error _validate_datatype(DataType p_type);  	bool _compare_datatypes_in_nodes(Node *a, Node *b) const; -	bool _validate_function_call(BlockNode *p_block, const Map<StringName, BuiltInInfo> &p_builtin_types, OperatorNode *p_func, DataType *r_ret_type, StringName *r_ret_type_str); -	bool _parse_function_arguments(BlockNode *p_block, const Map<StringName, BuiltInInfo> &p_builtin_types, OperatorNode *p_func, int *r_complete_arg = nullptr); +	bool _validate_function_call(BlockNode *p_block, const FunctionInfo &p_function_info, OperatorNode *p_func, DataType *r_ret_type, StringName *r_ret_type_str); +	bool _parse_function_arguments(BlockNode *p_block, const FunctionInfo &p_function_info, OperatorNode *p_func, int *r_complete_arg = nullptr);  	bool _propagate_function_call_sampler_uniform_settings(StringName p_name, int p_argument, TextureFilter p_filter, TextureRepeat p_repeat);  	bool _propagate_function_call_sampler_builtin_reference(StringName p_name, int p_argument, const StringName &p_builtin); -	Node *_parse_expression(BlockNode *p_block, const Map<StringName, BuiltInInfo> &p_builtin_types); +	Node *_parse_expression(BlockNode *p_block, const FunctionInfo &p_function_info);  	ShaderLanguage::Node *_reduce_expression(BlockNode *p_block, ShaderLanguage::Node *p_node); -	Node *_parse_and_reduce_expression(BlockNode *p_block, const Map<StringName, BuiltInInfo> &p_builtin_types); -	Error _parse_block(BlockNode *p_block, const Map<StringName, BuiltInInfo> &p_builtin_types, bool p_just_one = false, bool p_can_break = false, bool p_can_continue = false); +	Node *_parse_and_reduce_expression(BlockNode *p_block, const FunctionInfo &p_function_info); +	Error _parse_block(BlockNode *p_block, const FunctionInfo &p_function_info, bool p_just_one = false, bool p_can_break = false, bool p_can_continue = false);  	String _get_shader_type_list(const Set<String> &p_shader_types) const;  	String _get_qualifier_str(ArgumentQualifier p_qualifier) const;  |