Clone of mesa.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

radeon_program_constants.h 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /*
  2. * Copyright (C) 2009 Nicolai Haehnle.
  3. *
  4. * All Rights Reserved.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining
  7. * a 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, sublicense, 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
  16. * portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  19. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  21. * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
  22. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  23. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  24. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25. *
  26. */
  27. #ifndef RADEON_PROGRAM_CONSTANTS_H
  28. #define RADEON_PROGRAM_CONSTANTS_H
  29. typedef enum {
  30. RC_SATURATE_NONE = 0,
  31. RC_SATURATE_ZERO_ONE,
  32. RC_SATURATE_MINUS_PLUS_ONE
  33. } rc_saturate_mode;
  34. typedef enum {
  35. RC_TEXTURE_2D_ARRAY,
  36. RC_TEXTURE_1D_ARRAY,
  37. RC_TEXTURE_CUBE,
  38. RC_TEXTURE_3D,
  39. RC_TEXTURE_RECT,
  40. RC_TEXTURE_2D,
  41. RC_TEXTURE_1D
  42. } rc_texture_target;
  43. typedef enum {
  44. /**
  45. * Used to indicate unused register descriptions and
  46. * source register that use a constant swizzle.
  47. */
  48. RC_FILE_NONE = 0,
  49. RC_FILE_TEMPORARY,
  50. /**
  51. * Input register.
  52. *
  53. * \note The compiler attaches no implicit semantics to input registers.
  54. * Fragment/vertex program specific semantics must be defined explicitly
  55. * using the appropriate compiler interfaces.
  56. */
  57. RC_FILE_INPUT,
  58. /**
  59. * Output register.
  60. *
  61. * \note The compiler attaches no implicit semantics to input registers.
  62. * Fragment/vertex program specific semantics must be defined explicitly
  63. * using the appropriate compiler interfaces.
  64. */
  65. RC_FILE_OUTPUT,
  66. RC_FILE_ADDRESS,
  67. /**
  68. * Indicates a constant from the \ref rc_constant_list .
  69. */
  70. RC_FILE_CONSTANT,
  71. /**
  72. * Indicates a special register, see RC_SPECIAL_xxx.
  73. */
  74. RC_FILE_SPECIAL,
  75. /**
  76. * Indicates this register should use the result of the presubtract
  77. * operation.
  78. */
  79. RC_FILE_PRESUB,
  80. /**
  81. * Indicates that the source index has been encoded as a 7-bit float.
  82. */
  83. RC_FILE_INLINE
  84. } rc_register_file;
  85. enum {
  86. /** R500 fragment program ALU result "register" */
  87. RC_SPECIAL_ALU_RESULT = 0,
  88. /** Must be last */
  89. RC_NUM_SPECIAL_REGISTERS
  90. };
  91. #define RC_REGISTER_INDEX_BITS 10
  92. #define RC_REGISTER_MAX_INDEX (1 << RC_REGISTER_INDEX_BITS)
  93. typedef enum {
  94. RC_SWIZZLE_X = 0,
  95. RC_SWIZZLE_Y,
  96. RC_SWIZZLE_Z,
  97. RC_SWIZZLE_W,
  98. RC_SWIZZLE_ZERO,
  99. RC_SWIZZLE_ONE,
  100. RC_SWIZZLE_HALF,
  101. RC_SWIZZLE_UNUSED
  102. } rc_swizzle;
  103. #define RC_MAKE_SWIZZLE(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9))
  104. #define RC_MAKE_SWIZZLE_SMEAR(a) RC_MAKE_SWIZZLE((a),(a),(a),(a))
  105. #define GET_SWZ(swz, idx) (((swz) >> ((idx)*3)) & 0x7)
  106. #define GET_BIT(msk, idx) (((msk) >> (idx)) & 0x1)
  107. #define SET_SWZ(swz, idx, newv) \
  108. do { \
  109. (swz) = ((swz) & ~(7 << ((idx)*3))) | ((newv) << ((idx)*3)); \
  110. } while(0)
  111. #define RC_SWIZZLE_XYZW RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_W)
  112. #define RC_SWIZZLE_XYZ0 RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ZERO)
  113. #define RC_SWIZZLE_XYZ1 RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ONE)
  114. #define RC_SWIZZLE_XYZZ RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_Z)
  115. #define RC_SWIZZLE_XXXX RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_X)
  116. #define RC_SWIZZLE_YYYY RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_Y)
  117. #define RC_SWIZZLE_ZZZZ RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_Z)
  118. #define RC_SWIZZLE_WWWW RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_W)
  119. #define RC_SWIZZLE_0000 RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_ZERO)
  120. #define RC_SWIZZLE_1111 RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_ONE)
  121. #define RC_SWIZZLE_HHHH RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_HALF)
  122. #define RC_SWIZZLE_UUUU RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_UNUSED)
  123. /**
  124. * \name Bitmasks for components of vectors.
  125. *
  126. * Used for write masks, negation masks, etc.
  127. */
  128. /*@{*/
  129. #define RC_MASK_NONE 0
  130. #define RC_MASK_X 1
  131. #define RC_MASK_Y 2
  132. #define RC_MASK_Z 4
  133. #define RC_MASK_W 8
  134. #define RC_MASK_XY (RC_MASK_X|RC_MASK_Y)
  135. #define RC_MASK_XYZ (RC_MASK_X|RC_MASK_Y|RC_MASK_Z)
  136. #define RC_MASK_XYW (RC_MASK_X|RC_MASK_Y|RC_MASK_W)
  137. #define RC_MASK_XYZW (RC_MASK_X|RC_MASK_Y|RC_MASK_Z|RC_MASK_W)
  138. /*@}*/
  139. typedef enum {
  140. RC_ALURESULT_NONE = 0,
  141. RC_ALURESULT_X,
  142. RC_ALURESULT_W
  143. } rc_write_aluresult;
  144. typedef enum {
  145. RC_PRESUB_NONE = 0,
  146. /** 1 - 2 * src0 */
  147. RC_PRESUB_BIAS,
  148. /** src1 - src0 */
  149. RC_PRESUB_SUB,
  150. /** src1 + src0 */
  151. RC_PRESUB_ADD,
  152. /** 1 - src0 */
  153. RC_PRESUB_INV
  154. } rc_presubtract_op;
  155. typedef enum {
  156. RC_OMOD_MUL_1,
  157. RC_OMOD_MUL_2,
  158. RC_OMOD_MUL_4,
  159. RC_OMOD_MUL_8,
  160. RC_OMOD_DIV_2,
  161. RC_OMOD_DIV_4,
  162. RC_OMOD_DIV_8,
  163. RC_OMOD_DISABLE
  164. } rc_omod_op;
  165. static inline int rc_presubtract_src_reg_count(rc_presubtract_op op){
  166. switch(op){
  167. case RC_PRESUB_BIAS:
  168. case RC_PRESUB_INV:
  169. return 1;
  170. case RC_PRESUB_ADD:
  171. case RC_PRESUB_SUB:
  172. return 2;
  173. default:
  174. return 0;
  175. }
  176. }
  177. #define RC_SOURCE_NONE 0x0
  178. #define RC_SOURCE_RGB 0x1
  179. #define RC_SOURCE_ALPHA 0x2
  180. typedef enum {
  181. RC_PRED_DISABLED,
  182. RC_PRED_SET,
  183. RC_PRED_INV
  184. } rc_predicate_mode;
  185. #endif /* RADEON_PROGRAM_CONSTANTS_H */