shader_language.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. /*************************************************************************/
  2. /* shader_language.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef SHADER_LANGUAGE_H
  31. #define SHADER_LANGUAGE_H
  32. #include "core/list.h"
  33. #include "core/map.h"
  34. #include "core/string_db.h"
  35. #include "core/typedefs.h"
  36. #include "core/ustring.h"
  37. #include "core/variant.h"
  38. class ShaderLanguage {
  39. public:
  40. enum TokenType {
  41. TK_EMPTY,
  42. TK_IDENTIFIER,
  43. TK_TRUE,
  44. TK_FALSE,
  45. TK_REAL_CONSTANT,
  46. TK_INT_CONSTANT,
  47. TK_TYPE_VOID,
  48. TK_TYPE_BOOL,
  49. TK_TYPE_BVEC2,
  50. TK_TYPE_BVEC3,
  51. TK_TYPE_BVEC4,
  52. TK_TYPE_INT,
  53. TK_TYPE_IVEC2,
  54. TK_TYPE_IVEC3,
  55. TK_TYPE_IVEC4,
  56. TK_TYPE_UINT,
  57. TK_TYPE_UVEC2,
  58. TK_TYPE_UVEC3,
  59. TK_TYPE_UVEC4,
  60. TK_TYPE_FLOAT,
  61. TK_TYPE_VEC2,
  62. TK_TYPE_VEC3,
  63. TK_TYPE_VEC4,
  64. TK_TYPE_MAT2,
  65. TK_TYPE_MAT3,
  66. TK_TYPE_MAT4,
  67. TK_TYPE_SAMPLER2D,
  68. TK_TYPE_ISAMPLER2D,
  69. TK_TYPE_USAMPLER2D,
  70. TK_TYPE_SAMPLER2DARRAY,
  71. TK_TYPE_ISAMPLER2DARRAY,
  72. TK_TYPE_USAMPLER2DARRAY,
  73. TK_TYPE_SAMPLER3D,
  74. TK_TYPE_ISAMPLER3D,
  75. TK_TYPE_USAMPLER3D,
  76. TK_TYPE_SAMPLERCUBE,
  77. TK_INTERPOLATION_FLAT,
  78. TK_INTERPOLATION_SMOOTH,
  79. TK_PRECISION_LOW,
  80. TK_PRECISION_MID,
  81. TK_PRECISION_HIGH,
  82. TK_OP_EQUAL,
  83. TK_OP_NOT_EQUAL,
  84. TK_OP_LESS,
  85. TK_OP_LESS_EQUAL,
  86. TK_OP_GREATER,
  87. TK_OP_GREATER_EQUAL,
  88. TK_OP_AND,
  89. TK_OP_OR,
  90. TK_OP_NOT,
  91. TK_OP_ADD,
  92. TK_OP_SUB,
  93. TK_OP_MUL,
  94. TK_OP_DIV,
  95. TK_OP_MOD,
  96. TK_OP_SHIFT_LEFT,
  97. TK_OP_SHIFT_RIGHT,
  98. TK_OP_ASSIGN,
  99. TK_OP_ASSIGN_ADD,
  100. TK_OP_ASSIGN_SUB,
  101. TK_OP_ASSIGN_MUL,
  102. TK_OP_ASSIGN_DIV,
  103. TK_OP_ASSIGN_MOD,
  104. TK_OP_ASSIGN_SHIFT_LEFT,
  105. TK_OP_ASSIGN_SHIFT_RIGHT,
  106. TK_OP_ASSIGN_BIT_AND,
  107. TK_OP_ASSIGN_BIT_OR,
  108. TK_OP_ASSIGN_BIT_XOR,
  109. TK_OP_BIT_AND,
  110. TK_OP_BIT_OR,
  111. TK_OP_BIT_XOR,
  112. TK_OP_BIT_INVERT,
  113. TK_OP_INCREMENT,
  114. TK_OP_DECREMENT,
  115. TK_CF_IF,
  116. TK_CF_ELSE,
  117. TK_CF_FOR,
  118. TK_CF_WHILE,
  119. TK_CF_DO,
  120. TK_CF_SWITCH,
  121. TK_CF_CASE,
  122. TK_CF_BREAK,
  123. TK_CF_CONTINUE,
  124. TK_CF_RETURN,
  125. TK_CF_DISCARD,
  126. TK_BRACKET_OPEN,
  127. TK_BRACKET_CLOSE,
  128. TK_CURLY_BRACKET_OPEN,
  129. TK_CURLY_BRACKET_CLOSE,
  130. TK_PARENTHESIS_OPEN,
  131. TK_PARENTHESIS_CLOSE,
  132. TK_QUESTION,
  133. TK_COMMA,
  134. TK_COLON,
  135. TK_SEMICOLON,
  136. TK_PERIOD,
  137. TK_UNIFORM,
  138. TK_VARYING,
  139. TK_ARG_IN,
  140. TK_ARG_OUT,
  141. TK_ARG_INOUT,
  142. TK_RENDER_MODE,
  143. TK_HINT_WHITE_TEXTURE,
  144. TK_HINT_BLACK_TEXTURE,
  145. TK_HINT_NORMAL_TEXTURE,
  146. TK_HINT_ANISO_TEXTURE,
  147. TK_HINT_ALBEDO_TEXTURE,
  148. TK_HINT_BLACK_ALBEDO_TEXTURE,
  149. TK_HINT_COLOR,
  150. TK_HINT_RANGE,
  151. TK_SHADER_TYPE,
  152. TK_CURSOR,
  153. TK_ERROR,
  154. TK_EOF,
  155. TK_MAX
  156. };
  157. /* COMPILER */
  158. // lame work around to Apple defining this as a macro in 10.12 SDK
  159. #ifdef TYPE_BOOL
  160. #undef TYPE_BOOL
  161. #endif
  162. enum DataType {
  163. TYPE_VOID,
  164. TYPE_BOOL,
  165. TYPE_BVEC2,
  166. TYPE_BVEC3,
  167. TYPE_BVEC4,
  168. TYPE_INT,
  169. TYPE_IVEC2,
  170. TYPE_IVEC3,
  171. TYPE_IVEC4,
  172. TYPE_UINT,
  173. TYPE_UVEC2,
  174. TYPE_UVEC3,
  175. TYPE_UVEC4,
  176. TYPE_FLOAT,
  177. TYPE_VEC2,
  178. TYPE_VEC3,
  179. TYPE_VEC4,
  180. TYPE_MAT2,
  181. TYPE_MAT3,
  182. TYPE_MAT4,
  183. TYPE_SAMPLER2D,
  184. TYPE_ISAMPLER2D,
  185. TYPE_USAMPLER2D,
  186. TYPE_SAMPLER2DARRAY,
  187. TYPE_ISAMPLER2DARRAY,
  188. TYPE_USAMPLER2DARRAY,
  189. TYPE_SAMPLER3D,
  190. TYPE_ISAMPLER3D,
  191. TYPE_USAMPLER3D,
  192. TYPE_SAMPLERCUBE,
  193. };
  194. enum DataPrecision {
  195. PRECISION_LOWP,
  196. PRECISION_MEDIUMP,
  197. PRECISION_HIGHP,
  198. PRECISION_DEFAULT,
  199. };
  200. enum DataInterpolation {
  201. INTERPOLATION_FLAT,
  202. INTERPOLATION_SMOOTH,
  203. };
  204. enum Operator {
  205. OP_EQUAL,
  206. OP_NOT_EQUAL,
  207. OP_LESS,
  208. OP_LESS_EQUAL,
  209. OP_GREATER,
  210. OP_GREATER_EQUAL,
  211. OP_AND,
  212. OP_OR,
  213. OP_NOT,
  214. OP_NEGATE,
  215. OP_ADD,
  216. OP_SUB,
  217. OP_MUL,
  218. OP_DIV,
  219. OP_MOD,
  220. OP_SHIFT_LEFT,
  221. OP_SHIFT_RIGHT,
  222. OP_ASSIGN,
  223. OP_ASSIGN_ADD,
  224. OP_ASSIGN_SUB,
  225. OP_ASSIGN_MUL,
  226. OP_ASSIGN_DIV,
  227. OP_ASSIGN_MOD,
  228. OP_ASSIGN_SHIFT_LEFT,
  229. OP_ASSIGN_SHIFT_RIGHT,
  230. OP_ASSIGN_BIT_AND,
  231. OP_ASSIGN_BIT_OR,
  232. OP_ASSIGN_BIT_XOR,
  233. OP_BIT_AND,
  234. OP_BIT_OR,
  235. OP_BIT_XOR,
  236. OP_BIT_INVERT,
  237. OP_INCREMENT,
  238. OP_DECREMENT,
  239. OP_SELECT_IF,
  240. OP_SELECT_ELSE, //used only internally, then only IF appears with 3 arguments
  241. OP_POST_INCREMENT,
  242. OP_POST_DECREMENT,
  243. OP_CALL,
  244. OP_CONSTRUCT,
  245. OP_INDEX,
  246. OP_MAX
  247. };
  248. enum FlowOperation {
  249. FLOW_OP_IF,
  250. FLOW_OP_RETURN,
  251. FLOW_OP_FOR,
  252. FLOW_OP_WHILE,
  253. FLOW_OP_DO,
  254. FLOW_OP_BREAK,
  255. FLOW_OP_SWITCH,
  256. FLOW_OP_CONTINUE,
  257. FLOW_OP_DISCARD
  258. };
  259. enum ArgumentQualifier {
  260. ARGUMENT_QUALIFIER_IN,
  261. ARGUMENT_QUALIFIER_OUT,
  262. ARGUMENT_QUALIFIER_INOUT,
  263. };
  264. struct Node {
  265. Node *next;
  266. enum Type {
  267. TYPE_SHADER,
  268. TYPE_FUNCTION,
  269. TYPE_BLOCK,
  270. TYPE_VARIABLE,
  271. TYPE_VARIABLE_DECLARATION,
  272. TYPE_CONSTANT,
  273. TYPE_OPERATOR,
  274. TYPE_CONTROL_FLOW,
  275. TYPE_MEMBER
  276. };
  277. Type type;
  278. virtual DataType get_datatype() const { return TYPE_VOID; }
  279. virtual ~Node() {}
  280. };
  281. template <class T>
  282. T *alloc_node() {
  283. T *node = memnew(T);
  284. node->next = nodes;
  285. nodes = node;
  286. return node;
  287. }
  288. Node *nodes;
  289. struct OperatorNode : public Node {
  290. DataType return_cache;
  291. DataPrecision return_precision_cache;
  292. Operator op;
  293. Vector<Node *> arguments;
  294. virtual DataType get_datatype() const { return return_cache; }
  295. OperatorNode() {
  296. type = TYPE_OPERATOR;
  297. return_cache = TYPE_VOID;
  298. return_precision_cache = PRECISION_DEFAULT;
  299. }
  300. };
  301. struct VariableNode : public Node {
  302. DataType datatype_cache;
  303. StringName name;
  304. virtual DataType get_datatype() const { return datatype_cache; }
  305. VariableNode() {
  306. type = TYPE_VARIABLE;
  307. datatype_cache = TYPE_VOID;
  308. }
  309. };
  310. struct VariableDeclarationNode : public Node {
  311. DataPrecision precision;
  312. DataType datatype;
  313. struct Declaration {
  314. StringName name;
  315. Node *initializer;
  316. };
  317. Vector<Declaration> declarations;
  318. virtual DataType get_datatype() const { return datatype; }
  319. VariableDeclarationNode() {
  320. type = TYPE_VARIABLE_DECLARATION;
  321. }
  322. };
  323. struct ConstantNode : public Node {
  324. DataType datatype;
  325. union Value {
  326. bool boolean;
  327. float real;
  328. int32_t sint;
  329. uint32_t uint;
  330. };
  331. Vector<Value> values;
  332. virtual DataType get_datatype() const { return datatype; }
  333. ConstantNode() { type = TYPE_CONSTANT; }
  334. };
  335. struct FunctionNode;
  336. struct BlockNode : public Node {
  337. FunctionNode *parent_function;
  338. BlockNode *parent_block;
  339. struct Variable {
  340. DataType type;
  341. DataPrecision precision;
  342. int line; //for completion
  343. };
  344. Map<StringName, Variable> variables;
  345. List<Node *> statements;
  346. bool single_statement;
  347. BlockNode() {
  348. type = TYPE_BLOCK;
  349. parent_block = NULL;
  350. parent_function = NULL;
  351. single_statement = false;
  352. }
  353. };
  354. struct ControlFlowNode : public Node {
  355. FlowOperation flow_op;
  356. Vector<Node *> expressions;
  357. Vector<BlockNode *> blocks;
  358. ControlFlowNode() {
  359. type = TYPE_CONTROL_FLOW;
  360. flow_op = FLOW_OP_IF;
  361. }
  362. };
  363. struct MemberNode : public Node {
  364. DataType basetype;
  365. DataType datatype;
  366. StringName name;
  367. Node *owner;
  368. virtual DataType get_datatype() const { return datatype; }
  369. MemberNode() { type = TYPE_MEMBER; }
  370. };
  371. struct FunctionNode : public Node {
  372. struct Argument {
  373. ArgumentQualifier qualifier;
  374. StringName name;
  375. DataType type;
  376. DataPrecision precision;
  377. };
  378. StringName name;
  379. DataType return_type;
  380. DataPrecision return_precision;
  381. Vector<Argument> arguments;
  382. BlockNode *body;
  383. bool can_discard;
  384. FunctionNode() {
  385. type = TYPE_FUNCTION;
  386. return_type = TYPE_VOID;
  387. return_precision = PRECISION_DEFAULT;
  388. can_discard = false;
  389. }
  390. };
  391. struct ShaderNode : public Node {
  392. struct Function {
  393. StringName name;
  394. FunctionNode *function;
  395. Set<StringName> uses_function;
  396. bool callable;
  397. };
  398. struct Varying {
  399. DataType type;
  400. DataInterpolation interpolation;
  401. DataPrecision precission;
  402. };
  403. struct Uniform {
  404. enum Hint {
  405. HINT_NONE,
  406. HINT_COLOR,
  407. HINT_RANGE,
  408. HINT_ALBEDO,
  409. HINT_BLACK_ALBEDO,
  410. HINT_NORMAL,
  411. HINT_BLACK,
  412. HINT_WHITE,
  413. HINT_ANISO,
  414. HINT_MAX
  415. };
  416. int order;
  417. int texture_order;
  418. DataType type;
  419. DataPrecision precission;
  420. Vector<ConstantNode::Value> default_value;
  421. Hint hint;
  422. float hint_range[3];
  423. Uniform() {
  424. hint = HINT_NONE;
  425. hint_range[0] = 0;
  426. hint_range[1] = 1;
  427. hint_range[2] = 0.001;
  428. }
  429. };
  430. Map<StringName, Varying> varyings;
  431. Map<StringName, Uniform> uniforms;
  432. Vector<StringName> render_modes;
  433. Vector<Function> functions;
  434. ShaderNode() { type = TYPE_SHADER; }
  435. };
  436. struct Expression {
  437. bool is_op;
  438. union {
  439. Operator op;
  440. Node *node;
  441. };
  442. };
  443. struct VarInfo {
  444. StringName name;
  445. DataType type;
  446. };
  447. enum CompletionType {
  448. COMPLETION_NONE,
  449. COMPLETION_RENDER_MODE,
  450. COMPLETION_MAIN_FUNCTION,
  451. COMPLETION_IDENTIFIER,
  452. COMPLETION_FUNCTION_CALL,
  453. COMPLETION_CALL_ARGUMENTS,
  454. COMPLETION_INDEX,
  455. };
  456. struct Token {
  457. TokenType type;
  458. StringName text;
  459. double constant;
  460. uint16_t line;
  461. };
  462. static String get_operator_text(Operator p_op);
  463. static String get_token_text(Token p_token);
  464. static bool is_token_datatype(TokenType p_type);
  465. static bool is_token_variable_datatype(TokenType p_type);
  466. static DataType get_token_datatype(TokenType p_type);
  467. static bool is_token_interpolation(TokenType p_type);
  468. static DataInterpolation get_token_interpolation(TokenType p_type);
  469. static bool is_token_precision(TokenType p_type);
  470. static DataPrecision get_token_precision(TokenType p_type);
  471. static String get_datatype_name(DataType p_type);
  472. static bool is_token_nonvoid_datatype(TokenType p_type);
  473. static bool is_token_operator(TokenType p_type);
  474. static bool convert_constant(ConstantNode *p_constant, DataType p_to_type, ConstantNode::Value *p_value = NULL);
  475. static DataType get_scalar_type(DataType p_type);
  476. static int get_cardinality(DataType p_type);
  477. static bool is_scalar_type(DataType p_type);
  478. static bool is_sampler_type(DataType p_type);
  479. static Variant constant_value_to_variant(const Vector<ShaderLanguage::ConstantNode::Value> &p_value, DataType p_type, ShaderLanguage::ShaderNode::Uniform::Hint p_hint = ShaderLanguage::ShaderNode::Uniform::HINT_NONE);
  480. static void get_keyword_list(List<String> *r_keywords);
  481. static void get_builtin_funcs(List<String> *r_keywords);
  482. struct BuiltInInfo {
  483. DataType type;
  484. bool constant;
  485. BuiltInInfo() {}
  486. BuiltInInfo(DataType p_type, bool p_constant = false) {
  487. type = p_type;
  488. constant = p_constant;
  489. }
  490. };
  491. struct FunctionInfo {
  492. Map<StringName, BuiltInInfo> built_ins;
  493. bool can_discard;
  494. };
  495. private:
  496. struct KeyWord {
  497. TokenType token;
  498. const char *text;
  499. };
  500. static const KeyWord keyword_list[];
  501. bool error_set;
  502. String error_str;
  503. int error_line;
  504. String code;
  505. int char_idx;
  506. int tk_line;
  507. StringName current_function;
  508. struct TkPos {
  509. int char_idx;
  510. int tk_line;
  511. };
  512. TkPos _get_tkpos() {
  513. TkPos tkp;
  514. tkp.char_idx = char_idx;
  515. tkp.tk_line = tk_line;
  516. return tkp;
  517. }
  518. void _set_tkpos(TkPos p_pos) {
  519. char_idx = p_pos.char_idx;
  520. tk_line = p_pos.tk_line;
  521. }
  522. void _set_error(const String &p_str) {
  523. if (error_set)
  524. return;
  525. error_line = tk_line;
  526. error_set = true;
  527. error_str = p_str;
  528. }
  529. static const char *token_names[TK_MAX];
  530. Token _make_token(TokenType p_type, const StringName &p_text = StringName());
  531. Token _get_token();
  532. ShaderNode *shader;
  533. enum IdentifierType {
  534. IDENTIFIER_FUNCTION,
  535. IDENTIFIER_UNIFORM,
  536. IDENTIFIER_VARYING,
  537. IDENTIFIER_FUNCTION_ARGUMENT,
  538. IDENTIFIER_LOCAL_VAR,
  539. IDENTIFIER_BUILTIN_VAR,
  540. };
  541. bool _find_identifier(const BlockNode *p_block, const Map<StringName, BuiltInInfo> &p_builtin_types, const StringName &p_identifier, DataType *r_data_type = NULL, IdentifierType *r_type = NULL);
  542. bool _is_operator_assign(Operator p_op) const;
  543. bool _validate_assign(Node *p_node, const Map<StringName, BuiltInInfo> &p_builtin_types, String *r_message = NULL);
  544. bool _validate_operator(OperatorNode *p_op, DataType *r_ret_type = NULL);
  545. struct BuiltinFuncDef {
  546. enum { MAX_ARGS = 5 };
  547. const char *name;
  548. DataType rettype;
  549. const DataType args[MAX_ARGS];
  550. };
  551. struct BuiltinFuncOutArgs { //arguments used as out in built in funcions
  552. const char *name;
  553. int argument;
  554. };
  555. CompletionType completion_type;
  556. int completion_line;
  557. BlockNode *completion_block;
  558. DataType completion_base;
  559. StringName completion_function;
  560. int completion_argument;
  561. bool _get_completable_identifier(BlockNode *p_block, CompletionType p_type, StringName &identifier);
  562. static const BuiltinFuncDef builtin_func_defs[];
  563. static const BuiltinFuncOutArgs builtin_func_out_args[];
  564. bool _validate_function_call(BlockNode *p_block, OperatorNode *p_func, DataType *r_ret_type);
  565. bool _parse_function_arguments(BlockNode *p_block, const Map<StringName, BuiltInInfo> &p_builtin_types, OperatorNode *p_func, int *r_complete_arg = NULL);
  566. Node *_parse_expression(BlockNode *p_block, const Map<StringName, BuiltInInfo> &p_builtin_types);
  567. ShaderLanguage::Node *_reduce_expression(BlockNode *p_block, ShaderLanguage::Node *p_node);
  568. Node *_parse_and_reduce_expression(BlockNode *p_block, const Map<StringName, BuiltInInfo> &p_builtin_types);
  569. 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);
  570. Error _parse_shader(const Map<StringName, FunctionInfo> &p_functions, const Vector<StringName> &p_render_modes, const Set<String> &p_shader_types);
  571. public:
  572. //static void get_keyword_list(ShaderType p_type,List<String> *p_keywords);
  573. void clear();
  574. static String get_shader_type(const String &p_code);
  575. Error compile(const String &p_code, const Map<StringName, FunctionInfo> &p_functions, const Vector<StringName> &p_render_modes, const Set<String> &p_shader_types);
  576. Error complete(const String &p_code, const Map<StringName, FunctionInfo> &p_functions, const Vector<StringName> &p_render_modes, const Set<String> &p_shader_types, List<String> *r_options, String &r_call_hint);
  577. String get_error_text();
  578. int get_error_line();
  579. ShaderNode *get_shader();
  580. String token_debug(const String &p_code);
  581. ShaderLanguage();
  582. ~ShaderLanguage();
  583. };
  584. #endif // SHADER_LANGUAGE_H