Clone of mesa.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

glsl_parser_extras.h 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright © 2010 Intel Corporation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  21. * DEALINGS IN THE SOFTWARE.
  22. */
  23. #pragma once
  24. #ifndef GLSL_PARSER_EXTRAS_H
  25. #define GLSL_PARSER_EXTRAS_H
  26. #include <cstdlib>
  27. #include "main/simple_list.h"
  28. #include "glsl_symbol_table.h"
  29. enum _mesa_glsl_parser_targets {
  30. vertex_shader,
  31. geometry_shader,
  32. fragment_shader
  33. };
  34. struct _mesa_glsl_parse_state {
  35. void *scanner;
  36. struct simple_node translation_unit;
  37. glsl_symbol_table *symbols;
  38. unsigned language_version;
  39. enum _mesa_glsl_parser_targets target;
  40. /**
  41. * During AST to IR conversion, pointer to current IR function
  42. *
  43. * Will be \c NULL whenever the AST to IR conversion is not inside a
  44. * function definition.
  45. */
  46. class ir_function_signature *current_function;
  47. /** Was there an error during compilation? */
  48. bool error;
  49. };
  50. typedef struct YYLTYPE {
  51. int first_line;
  52. int first_column;
  53. int last_line;
  54. int last_column;
  55. unsigned source;
  56. } YYLTYPE;
  57. # define YYLTYPE_IS_DECLARED 1
  58. # define YYLTYPE_IS_TRIVIAL 1
  59. extern void _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state,
  60. const char *fmt, ...);
  61. extern void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state,
  62. const char *string, size_t len);
  63. extern void _mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state *state);
  64. union YYSTYPE;
  65. extern int _mesa_glsl_lex(union YYSTYPE *yylval, YYLTYPE *yylloc,
  66. void *scanner);
  67. extern int _mesa_glsl_parse(struct _mesa_glsl_parse_state *);
  68. #endif /* GLSL_PARSER_EXTRAS_H */