Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tgsi_parse.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /**************************************************************************
  2. *
  3. * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
  4. * All Rights Reserved.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the
  8. * "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sub license, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject to
  12. * the following conditions:
  13. *
  14. * The above copyright notice and this permission notice (including the
  15. * next paragraph) shall be included in all copies or substantial portions
  16. * of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  19. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  21. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
  22. * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  23. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  24. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25. *
  26. **************************************************************************/
  27. #ifndef TGSI_PARSE_H
  28. #define TGSI_PARSE_H
  29. #include "pipe/p_shader_tokens.h"
  30. #if defined __cplusplus
  31. extern "C" {
  32. #endif
  33. struct tgsi_full_header
  34. {
  35. struct tgsi_header Header;
  36. struct tgsi_processor Processor;
  37. };
  38. struct tgsi_full_dst_register
  39. {
  40. struct tgsi_dst_register Register;
  41. struct tgsi_src_register Indirect;
  42. };
  43. struct tgsi_full_src_register
  44. {
  45. struct tgsi_src_register Register;
  46. struct tgsi_src_register Indirect;
  47. struct tgsi_dimension Dimension;
  48. struct tgsi_src_register DimIndirect;
  49. };
  50. struct tgsi_full_declaration
  51. {
  52. struct tgsi_declaration Declaration;
  53. struct tgsi_declaration_range Range;
  54. struct tgsi_declaration_semantic Semantic;
  55. };
  56. struct tgsi_full_immediate
  57. {
  58. struct tgsi_immediate Immediate;
  59. union tgsi_immediate_data u[4];
  60. };
  61. struct tgsi_full_property
  62. {
  63. struct tgsi_property Property;
  64. struct tgsi_property_data u[8];
  65. };
  66. #define TGSI_FULL_MAX_DST_REGISTERS 2
  67. #define TGSI_FULL_MAX_SRC_REGISTERS 4 /* TXD has 4 */
  68. struct tgsi_full_instruction
  69. {
  70. struct tgsi_instruction Instruction;
  71. struct tgsi_instruction_predicate Predicate;
  72. struct tgsi_instruction_label Label;
  73. struct tgsi_instruction_texture Texture;
  74. struct tgsi_full_dst_register Dst[TGSI_FULL_MAX_DST_REGISTERS];
  75. struct tgsi_full_src_register Src[TGSI_FULL_MAX_SRC_REGISTERS];
  76. };
  77. union tgsi_full_token
  78. {
  79. struct tgsi_token Token;
  80. struct tgsi_full_declaration FullDeclaration;
  81. struct tgsi_full_immediate FullImmediate;
  82. struct tgsi_full_instruction FullInstruction;
  83. struct tgsi_full_property FullProperty;
  84. };
  85. struct tgsi_parse_context
  86. {
  87. const struct tgsi_token *Tokens;
  88. unsigned Position;
  89. struct tgsi_full_header FullHeader;
  90. union tgsi_full_token FullToken;
  91. };
  92. #define TGSI_PARSE_OK 0
  93. #define TGSI_PARSE_ERROR 1
  94. unsigned
  95. tgsi_parse_init(
  96. struct tgsi_parse_context *ctx,
  97. const struct tgsi_token *tokens );
  98. void
  99. tgsi_parse_free(
  100. struct tgsi_parse_context *ctx );
  101. boolean
  102. tgsi_parse_end_of_tokens(
  103. struct tgsi_parse_context *ctx );
  104. void
  105. tgsi_parse_token(
  106. struct tgsi_parse_context *ctx );
  107. unsigned
  108. tgsi_num_tokens(const struct tgsi_token *tokens);
  109. struct tgsi_token *
  110. tgsi_dup_tokens(const struct tgsi_token *tokens);
  111. #if defined __cplusplus
  112. }
  113. #endif
  114. #endif /* TGSI_PARSE_H */