img_3dtypes.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /*************************************************************************/ /*!
  2. @File
  3. @Title Global 3D types for use by IMG APIs
  4. @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
  5. @Description Defines 3D types for use by IMG APIs
  6. @License Strictly Confidential.
  7. */ /**************************************************************************/
  8. #ifndef IMG_3DTYPES_H
  9. #define IMG_3DTYPES_H
  10. #include <powervr/buffer_attribs.h>
  11. #include "img_types.h"
  12. #include "img_defs.h"
  13. /**
  14. * Comparison functions
  15. * This comparison function is defined as:
  16. * A {CmpFunc} B
  17. * A is a reference value, e.g., incoming depth etc.
  18. * B is the sample value, e.g., value in depth buffer.
  19. */
  20. typedef enum _IMG_COMPFUNC_
  21. {
  22. IMG_COMPFUNC_NEVER, /**< The comparison never succeeds */
  23. IMG_COMPFUNC_LESS, /**< The comparison is a less-than operation */
  24. IMG_COMPFUNC_EQUAL, /**< The comparison is an equal-to operation */
  25. IMG_COMPFUNC_LESS_EQUAL, /**< The comparison is a less-than or equal-to
  26. operation */
  27. IMG_COMPFUNC_GREATER, /**< The comparison is a greater-than operation
  28. */
  29. IMG_COMPFUNC_NOT_EQUAL, /**< The comparison is a no-equal-to operation
  30. */
  31. IMG_COMPFUNC_GREATER_EQUAL, /**< The comparison is a greater-than or
  32. equal-to operation */
  33. IMG_COMPFUNC_ALWAYS, /**< The comparison always succeeds */
  34. } IMG_COMPFUNC;
  35. /**
  36. * Stencil op functions
  37. */
  38. typedef enum _IMG_STENCILOP_
  39. {
  40. IMG_STENCILOP_KEEP, /**< Keep original value */
  41. IMG_STENCILOP_ZERO, /**< Set stencil to 0 */
  42. IMG_STENCILOP_REPLACE, /**< Replace stencil entry */
  43. IMG_STENCILOP_INCR_SAT, /**< Increment stencil entry, clamping to max */
  44. IMG_STENCILOP_DECR_SAT, /**< Decrement stencil entry, clamping to zero */
  45. IMG_STENCILOP_INVERT, /**< Invert bits in stencil entry */
  46. IMG_STENCILOP_INCR, /**< Increment stencil entry,
  47. wrapping if necessary */
  48. IMG_STENCILOP_DECR, /**< Decrement stencil entry,
  49. wrapping if necessary */
  50. } IMG_STENCILOP;
  51. /**
  52. * Alpha blending allows colours and textures on one surface
  53. * to be blended with transparency onto another surface.
  54. * These definitions apply to both source and destination blending
  55. * states
  56. */
  57. typedef enum _IMG_BLEND_
  58. {
  59. IMG_BLEND_ZERO = 0, /**< Blend factor is (0,0,0,0) */
  60. IMG_BLEND_ONE, /**< Blend factor is (1,1,1,1) */
  61. IMG_BLEND_SRC_COLOUR, /**< Blend factor is the source colour */
  62. IMG_BLEND_INV_SRC_COLOUR, /**< Blend factor is the inverted source colour
  63. (i.e. 1-src_col) */
  64. IMG_BLEND_SRC_ALPHA, /**< Blend factor is the source alpha */
  65. IMG_BLEND_INV_SRC_ALPHA, /**< Blend factor is the inverted source alpha
  66. (i.e. 1-src_alpha) */
  67. IMG_BLEND_DEST_ALPHA, /**< Blend factor is the destination alpha */
  68. IMG_BLEND_INV_DEST_ALPHA, /**< Blend factor is the inverted destination
  69. alpha */
  70. IMG_BLEND_DEST_COLOUR, /**< Blend factor is the destination colour */
  71. IMG_BLEND_INV_DEST_COLOUR, /**< Blend factor is the inverted destination
  72. colour */
  73. IMG_BLEND_SRC_ALPHASAT, /**< Blend factor is the alpha saturation (the
  74. minimum of (Src alpha,
  75. 1 - destination alpha)) */
  76. IMG_BLEND_BLEND_FACTOR, /**< Blend factor is a constant */
  77. IMG_BLEND_INVBLEND_FACTOR, /**< Blend factor is a constant (inverted)*/
  78. IMG_BLEND_SRC1_COLOUR, /**< Blend factor is the colour outputted from
  79. the pixel shader */
  80. IMG_BLEND_INV_SRC1_COLOUR, /**< Blend factor is the inverted colour
  81. outputted from the pixel shader */
  82. IMG_BLEND_SRC1_ALPHA, /**< Blend factor is the alpha outputted from
  83. the pixel shader */
  84. IMG_BLEND_INV_SRC1_ALPHA /**< Blend factor is the inverted alpha
  85. outputted from the pixel shader */
  86. } IMG_BLEND;
  87. /**
  88. * The arithmetic operation to perform when blending
  89. */
  90. typedef enum _IMG_BLENDOP_
  91. {
  92. IMG_BLENDOP_ADD = 0, /**< Result = (Source + Destination) */
  93. IMG_BLENDOP_SUBTRACT, /**< Result = (Source - Destination) */
  94. IMG_BLENDOP_REV_SUBTRACT, /**< Result = (Destination - Source) */
  95. IMG_BLENDOP_MIN, /**< Result = min (Source, Destination) */
  96. IMG_BLENDOP_MAX /**< Result = max (Source, Destination) */
  97. } IMG_BLENDOP;
  98. /**
  99. * Logical operation to perform when logic ops are enabled
  100. */
  101. typedef enum _IMG_LOGICOP_
  102. {
  103. IMG_LOGICOP_CLEAR = 0, /**< Result = 0 */
  104. IMG_LOGICOP_SET, /**< Result = -1 */
  105. IMG_LOGICOP_COPY, /**< Result = Source */
  106. IMG_LOGICOP_COPY_INVERTED, /**< Result = ~Source */
  107. IMG_LOGICOP_NOOP, /**< Result = Destination */
  108. IMG_LOGICOP_INVERT, /**< Result = ~Destination */
  109. IMG_LOGICOP_AND, /**< Result = Source & Destination */
  110. IMG_LOGICOP_NAND, /**< Result = ~(Source & Destination) */
  111. IMG_LOGICOP_OR, /**< Result = Source | Destination */
  112. IMG_LOGICOP_NOR, /**< Result = ~(Source | Destination) */
  113. IMG_LOGICOP_XOR, /**< Result = Source ^ Destination */
  114. IMG_LOGICOP_EQUIV, /**< Result = ~(Source ^ Destination) */
  115. IMG_LOGICOP_AND_REVERSE, /**< Result = Source & ~Destination */
  116. IMG_LOGICOP_AND_INVERTED, /**< Result = ~Source & Destination */
  117. IMG_LOGICOP_OR_REVERSE, /**< Result = Source | ~Destination */
  118. IMG_LOGICOP_OR_INVERTED /**< Result = ~Source | Destination */
  119. } IMG_LOGICOP;
  120. /**
  121. * Type of fog blending supported
  122. */
  123. typedef enum _IMG_FOGMODE_
  124. {
  125. IMG_FOGMODE_NONE, /**< No fog blending - fog calculations are
  126. * based on the value output from the vertex phase */
  127. IMG_FOGMODE_LINEAR, /**< Linear interpolation */
  128. IMG_FOGMODE_EXP, /**< Exponential */
  129. IMG_FOGMODE_EXP2, /**< Exponential squaring */
  130. } IMG_FOGMODE;
  131. /**
  132. * Types of filtering
  133. */
  134. typedef enum _IMG_FILTER_
  135. {
  136. IMG_FILTER_DONTCARE, /**< Any filtering mode is acceptable */
  137. IMG_FILTER_POINT, /**< Point filtering */
  138. IMG_FILTER_LINEAR, /**< Bi-linear filtering */
  139. IMG_FILTER_BICUBIC, /**< Bi-cubic filtering */
  140. } IMG_FILTER;
  141. /**
  142. * Addressing modes for textures
  143. */
  144. typedef enum _IMG_ADDRESSMODE_
  145. {
  146. IMG_ADDRESSMODE_REPEAT, /**< Texture repeats continuously */
  147. IMG_ADDRESSMODE_FLIP, /**< Texture flips on odd integer part */
  148. IMG_ADDRESSMODE_CLAMP, /**< Texture clamped at 0 or 1 */
  149. IMG_ADDRESSMODE_FLIPCLAMP, /**< Flipped once, then clamp */
  150. IMG_ADDRESSMODE_CLAMPBORDER,
  151. IMG_ADDRESSMODE_OGL_CLAMP,
  152. IMG_ADDRESSMODE_OVG_TILEFILL,
  153. IMG_ADDRESSMODE_DONTCARE,
  154. } IMG_ADDRESSMODE;
  155. /**
  156. * Culling based on winding order of triangle.
  157. */
  158. typedef enum _IMG_CULLMODE_
  159. {
  160. IMG_CULLMODE_NONE, /**< Don't cull */
  161. IMG_CULLMODE_FRONTFACING, /**< Front facing triangles */
  162. IMG_CULLMODE_BACKFACING, /**< Back facing triangles */
  163. } IMG_CULLMODE;
  164. /**
  165. * Colour for clearing surfaces.
  166. * The four elements of the 4 x 32 bit array will map to colour
  167. * R,G,B,A components, in order.
  168. * For YUV colour space the order is Y,U,V.
  169. * For Depth and Stencil formats D maps to R and S maps to G.
  170. */
  171. typedef union IMG_CLEAR_COLOUR_TAG {
  172. IMG_UINT32 aui32[4];
  173. IMG_INT32 ai32[4];
  174. IMG_FLOAT af32[4];
  175. } IMG_CLEAR_COLOUR;
  176. static_assert(sizeof(IMG_FLOAT) == sizeof(IMG_INT32), "Size of IMG_FLOAT is not 32 bits.");
  177. /*! ************************************************************************//**
  178. @brief Specifies the MSAA resolve operation.
  179. */ /**************************************************************************/
  180. typedef enum _IMG_RESOLVE_OP_
  181. {
  182. IMG_RESOLVE_BLEND = 0, /*!< box filter on the samples */
  183. IMG_RESOLVE_MIN = 1, /*!< minimum of the samples */
  184. IMG_RESOLVE_MAX = 2, /*!< maximum of the samples */
  185. IMG_RESOLVE_SAMPLE0 = 3, /*!< choose sample 0 */
  186. IMG_RESOLVE_SAMPLE1 = 4, /*!< choose sample 1 */
  187. IMG_RESOLVE_SAMPLE2 = 5, /*!< choose sample 2 */
  188. IMG_RESOLVE_SAMPLE3 = 6, /*!< choose sample 3 */
  189. IMG_RESOLVE_SAMPLE4 = 7, /*!< choose sample 4 */
  190. IMG_RESOLVE_SAMPLE5 = 8, /*!< choose sample 5 */
  191. IMG_RESOLVE_SAMPLE6 = 9, /*!< choose sample 6 */
  192. IMG_RESOLVE_SAMPLE7 = 10, /*!< choose sample 7 */
  193. } IMG_RESOLVE_OP;
  194. #endif /* IMG_3DTYPES_H */
  195. /******************************************************************************
  196. End of file (img_3dtypes.h)
  197. ******************************************************************************/