godot/servers/rendering/shader_language.cpp

/**************************************************************************/
/*  shader_language.cpp                                                   */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
/*                                                                        */
/* Permission is hereby granted, free of charge, to any person obtaining  */
/* a copy of this software and associated documentation files (the        */
/* "Software"), to deal in the Software without restriction, including    */
/* without limitation the rights to use, copy, modify, merge, publish,    */
/* distribute, sublicense, and/or sell copies of the Software, and to     */
/* permit persons to whom the Software is furnished to do so, subject to  */
/* the following conditions:                                              */
/*                                                                        */
/* The above copyright notice and this permission notice shall be         */
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

#include "shader_language.h"

#include "core/os/os.h"
#include "core/string/print_string.h"
#include "core/templates/local_vector.h"
#include "servers/rendering/renderer_compositor.h"
#include "servers/rendering_server.h"
#include "shader_types.h"

#define HAS_WARNING(flag)

int ShaderLanguage::instance_counter =;

String ShaderLanguage::get_operator_text(Operator p_op) {}

const char *ShaderLanguage::token_names[TK_MAX] =;

String ShaderLanguage::get_token_text(Token p_token) {}

ShaderLanguage::Token ShaderLanguage::_make_token(TokenType p_type, const StringName &p_text) {}

enum ContextFlag : uint32_t {};

const uint32_t KCF_DATATYPE =;
const uint32_t KCF_SAMPLER_DATATYPE =;

const ShaderLanguage::KeyWord ShaderLanguage::keyword_list[] =;

ShaderLanguage::Token ShaderLanguage::_get_token() {}

bool ShaderLanguage::_lookup_next(Token &r_tk) {}

ShaderLanguage::Token ShaderLanguage::_peek() {}

String ShaderLanguage::token_debug(const String &p_code) {}

bool ShaderLanguage::is_token_variable_datatype(TokenType p_type) {}

bool ShaderLanguage::is_token_datatype(TokenType p_type) {}

ShaderLanguage::DataType ShaderLanguage::get_token_datatype(TokenType p_type) {}

bool ShaderLanguage::is_token_interpolation(TokenType p_type) {}

ShaderLanguage::DataInterpolation ShaderLanguage::get_token_interpolation(TokenType p_type) {}

bool ShaderLanguage::is_token_precision(TokenType p_type) {}

bool ShaderLanguage::is_token_arg_qual(TokenType p_type) {}

ShaderLanguage::DataPrecision ShaderLanguage::get_token_precision(TokenType p_type) {}

String ShaderLanguage::get_precision_name(DataPrecision p_type) {}

String ShaderLanguage::get_interpolation_name(DataInterpolation p_interpolation) {}

String ShaderLanguage::get_datatype_name(DataType p_type) {}

String ShaderLanguage::get_uniform_hint_name(ShaderNode::Uniform::Hint p_hint) {}

String ShaderLanguage::get_texture_filter_name(TextureFilter p_filter) {}

String ShaderLanguage::get_texture_repeat_name(TextureRepeat p_repeat) {}

bool ShaderLanguage::is_token_nonvoid_datatype(TokenType p_type) {}

void ShaderLanguage::clear() {}

#ifdef DEBUG_ENABLED
void ShaderLanguage::_parse_used_identifier(const StringName &p_identifier, IdentifierType p_type, const StringName &p_function) {}
#endif // DEBUG_ENABLED

bool ShaderLanguage::_find_identifier(const BlockNode *p_block, bool p_allow_reassign, const FunctionInfo &p_function_info, const StringName &p_identifier, DataType *r_data_type, IdentifierType *r_type, bool *r_is_const, int *r_array_size, StringName *r_struct_name, ConstantNode::Value *r_constant_value) {}

bool ShaderLanguage::_validate_operator(OperatorNode *p_op, DataType *r_ret_type, int *r_ret_size) {}

const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] =;

HashSet<StringName> global_func_set;

const ShaderLanguage::BuiltinFuncOutArgs ShaderLanguage::builtin_func_out_args[] =;

const ShaderLanguage::BuiltinFuncConstArgs ShaderLanguage::builtin_func_const_args[] =;

const ShaderLanguage::BuiltinEntry ShaderLanguage::frag_only_func_defs[] =;

bool ShaderLanguage::is_const_suffix_lut_initialized =;

bool ShaderLanguage::_validate_function_call(BlockNode *p_block, const FunctionInfo &p_function_info, OperatorNode *p_func, DataType *r_ret_type, StringName *r_ret_type_str, bool *r_is_custom_function) {}

bool ShaderLanguage::_compare_datatypes(DataType p_datatype_a, String p_datatype_name_a, int p_array_size_a, DataType p_datatype_b, String p_datatype_name_b, int p_array_size_b) {}

bool ShaderLanguage::_compare_datatypes_in_nodes(Node *a, Node *b) {}

bool ShaderLanguage::_parse_function_arguments(BlockNode *p_block, const FunctionInfo &p_function_info, OperatorNode *p_func, int *r_complete_arg) {}

bool ShaderLanguage::is_token_operator(TokenType p_type) {}

bool ShaderLanguage::is_token_operator_assign(TokenType p_type) {}

bool ShaderLanguage::is_token_hint(TokenType p_type) {}

bool ShaderLanguage::convert_constant(ConstantNode *p_constant, DataType p_to_type, ConstantNode::Value *p_value) {}

bool ShaderLanguage::is_scalar_type(DataType p_type) {}

bool ShaderLanguage::is_float_type(DataType p_type) {}
bool ShaderLanguage::is_sampler_type(DataType p_type) {}

Variant ShaderLanguage::constant_value_to_variant(const Vector<ShaderLanguage::ConstantNode::Value> &p_value, DataType p_type, int p_array_size, ShaderLanguage::ShaderNode::Uniform::Hint p_hint) {}

PropertyInfo ShaderLanguage::uniform_to_property_info(const ShaderNode::Uniform &p_uniform) {}

uint32_t ShaderLanguage::get_datatype_size(ShaderLanguage::DataType p_type) {}

void ShaderLanguage::get_keyword_list(List<String> *r_keywords) {}

bool ShaderLanguage::is_control_flow_keyword(String p_keyword) {}

void ShaderLanguage::get_builtin_funcs(List<String> *r_keywords) {}

ShaderLanguage::DataType ShaderLanguage::get_scalar_type(DataType p_type) {}

int ShaderLanguage::get_cardinality(DataType p_type) {}

bool ShaderLanguage::_get_completable_identifier(BlockNode *p_block, CompletionType p_type, StringName &identifier) {}

bool ShaderLanguage::_is_operator_assign(Operator p_op) const {}

bool ShaderLanguage::_validate_varying_assign(ShaderNode::Varying &p_varying, String *r_message) {}

bool ShaderLanguage::_check_node_constness(const Node *p_node) const {}

bool ShaderLanguage::_check_restricted_func(const StringName &p_name, const StringName &p_current_function) const {}

bool ShaderLanguage::_validate_restricted_func(const StringName &p_name, const CallInfo *p_func_info, bool p_is_builtin_hint) {}

bool ShaderLanguage::_validate_assign(Node *p_node, const FunctionInfo &p_function_info, String *r_message) {}

ShaderLanguage::ShaderNode::Uniform::Hint ShaderLanguage::_sanitize_hint(ShaderNode::Uniform::Hint p_hint) {}

bool ShaderLanguage::_propagate_function_call_sampler_uniform_settings(const StringName &p_name, int p_argument, TextureFilter p_filter, TextureRepeat p_repeat, ShaderNode::Uniform::Hint p_hint) {}

bool ShaderLanguage::_propagate_function_call_sampler_builtin_reference(const StringName &p_name, int p_argument, const StringName &p_builtin) {}

Error ShaderLanguage::_parse_array_size(BlockNode *p_block, const FunctionInfo &p_function_info, bool p_forbid_unknown_size, Node **r_size_expression, int *r_array_size, bool *r_unknown_size) {}

ShaderLanguage::Node *ShaderLanguage::_parse_array_constructor(BlockNode *p_block, const FunctionInfo &p_function_info) {}

ShaderLanguage::Node *ShaderLanguage::_parse_array_constructor(BlockNode *p_block, const FunctionInfo &p_function_info, DataType p_type, const StringName &p_struct_name, int p_array_size) {}

ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, const FunctionInfo &p_function_info, const ExpressionInfo *p_previous_expression_info) {}

ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, ShaderLanguage::Node *p_node) {}

ShaderLanguage::Node *ShaderLanguage::_parse_and_reduce_expression(BlockNode *p_block, const FunctionInfo &p_function_info, const ExpressionInfo *p_previous_expression_info) {}

Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_function_info, bool p_just_one, bool p_can_break, bool p_can_continue) {}

String ShaderLanguage::_get_shader_type_list(const HashSet<String> &p_shader_types) const {}

String ShaderLanguage::_get_qualifier_str(ArgumentQualifier p_qualifier) const {}

Error ShaderLanguage::_validate_precision(DataType p_type, DataPrecision p_precision) {}

Error ShaderLanguage::_parse_shader(const HashMap<StringName, FunctionInfo> &p_functions, const Vector<ModeInfo> &p_render_modes, const HashSet<String> &p_shader_types) {}

bool ShaderLanguage::has_builtin(const HashMap<StringName, ShaderLanguage::FunctionInfo> &p_functions, const StringName &p_name, bool p_check_global_funcs) {}

Error ShaderLanguage::_find_last_flow_op_in_op(ControlFlowNode *p_flow, FlowOperation p_op) {}

Error ShaderLanguage::_find_last_flow_op_in_block(BlockNode *p_block, FlowOperation p_op) {}

// skips over whitespace and /* */ and // comments
static int _get_first_ident_pos(const String &p_code) {}

String ShaderLanguage::get_shader_type(const String &p_code) {}

bool ShaderLanguage::is_builtin_func_out_parameter(const String &p_name, int p_param) {}

#ifdef DEBUG_ENABLED
void ShaderLanguage::_check_warning_accums() {}
List<ShaderWarning>::Element *ShaderLanguage::get_warnings_ptr() {}
void ShaderLanguage::enable_warning_checking(bool p_enabled) {}
bool ShaderLanguage::is_warning_checking_enabled() const {}
void ShaderLanguage::set_warning_flags(uint32_t p_flags) {}
uint32_t ShaderLanguage::get_warning_flags() const {}
#endif // DEBUG_ENABLED

Error ShaderLanguage::compile(const String &p_code, const ShaderCompileInfo &p_info) {}

Error ShaderLanguage::complete(const String &p_code, const ShaderCompileInfo &p_info, List<ScriptLanguage::CodeCompletionOption> *r_options, String &r_call_hint) {}

String ShaderLanguage::get_error_text() {}

Vector<ShaderLanguage::FilePosition> ShaderLanguage::get_include_positions() {}

int ShaderLanguage::get_error_line() {}

ShaderLanguage::ShaderNode *ShaderLanguage::get_shader() {}

ShaderLanguage::ShaderLanguage() {}

ShaderLanguage::~ShaderLanguage() {}