Advertisement
Guest User

gx2Enum.h

a guest
Aug 6th, 2014
2,190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 59.85 KB | None | 0 0
  1. // gx2Enum.h
  2. //
  3. // Declares enums for gx2 library.
  4.  
  5. #ifndef _CAFE_GX2_ENUM_H_
  6. #define _CAFE_GX2_ENUM_H_
  7.  
  8. #ifdef __cplusplus
  9. extern "C"
  10. {
  11. #endif // __cplusplus
  12.  
  13. #if defined _WIN32 || defined _WIN64
  14. #include <assert.h>
  15. #include <string.h>
  16. #ifndef ASSERT
  17. #define ASSERT  assert
  18. #endif // ASSERT
  19. #ifndef GX2_INLINE
  20. #define GX2_INLINE inline
  21. #endif // GX2_INLINE
  22. #else
  23. #ifndef GX2_INLINE
  24. #define GX2_INLINE static inline
  25. #endif // GX2_INLINE
  26. #endif // _WIN32 || defined _WIN64
  27.  
  28. // This define is used as a tag to mark function prototypes that
  29. // are exported from gx2.rpl.
  30. #define GX2API
  31.  
  32. #define GX2_CHECK_ENUM_RANGE(value, type) \
  33.     ASSERT(value>=type##_FIRST && value<=type##_LAST);
  34.  
  35. /*
  36.  * These are aliases for the MOV enums which are deprecated
  37.  */
  38. #define GX2MOVMode                      GX2DRCMode
  39. #define GX2_MOV_NONE                    GX2_DRC_NONE
  40. #define GX2_MOV_SINGLE                  GX2_DRC_SINGLE
  41. #define GX2_MOV_DOUBLE                  GX2_DRC_DOUBLE
  42. #define GX2_MOV_FIRST                   GX2_DRC_FIRST
  43. #define GX2_MOV_LAST                    GX2_DRC_LAST
  44. #define GX2_SCAN_TARGET_MOV_FIRST       GX2_SCAN_TARGET_DRC_FIRST
  45. #define GX2_SCAN_TARGET_MOV_SECOND      GX2_SCAN_TARGET_DRC_SECOND
  46.  
  47. /// @addtogroup GX2EnumGroup
  48. /// @{
  49.  
  50. // -----------------------------------------------------------------------------
  51. // Enums - general
  52.  
  53. /// \brief GX2's version of bool-type values.
  54. ///
  55. typedef enum _GX2Boolean
  56. {
  57.     GX2_FALSE                      = 0,
  58.     GX2_TRUE                       = 1,
  59.     GX2_DISABLE                    = 0,
  60.     GX2_ENABLE                     = 1
  61. } GX2Boolean;
  62.  
  63. /// \brief GX2's initialize attributes
  64. ///
  65. typedef enum _GX2InitAttrib {
  66.     GX2_INIT_ATTRIB_NULL,              ///< list terminator
  67.     GX2_INIT_ATTRIB_CB_BASE,           ///< command buffer pool base address
  68.     GX2_INIT_ATTRIB_CB_SIZE,           ///< command buffer pool size
  69.     GX2_INIT_ATTRIB_UDA_LEVEL,         ///< (Temporary Placeholder) set uda alert level
  70.     GX2_INIT_ATTRIB_UDA_TESTMODE,      ///< (Temporary Placeholder) enable uda test mode
  71.     GX2_INIT_ATTRIB_UDA_DISABLE_ALERT, ///< (Temporary Placeholder) disable specific uda alert
  72.     GX2_INIT_ATTRIB_UDA_MAXFIRECOUNT,  ///< (Temporary Placeholder) max number of times an alert will be reported
  73.     GX2_INIT_ATTRIB_ARGC,              ///< argc from main()
  74.     GX2_INIT_ATTRIB_ARGV,              ///< argv from main()
  75.     GX2_INIT_ATTRIB_PROFILE_MODE,      ///< Profiling mode
  76.     GX2_INIT_ATTRIB_TOSS_STAGE,        ///< Toss stage
  77.     GX2_INIT_ATTRIB_LAST = GX2_INIT_ATTRIB_TOSS_STAGE
  78. } GX2InitAttrib;
  79.  
  80. // -----------------------------------------------------------------------------
  81. // Enums - Render State
  82.  
  83. /// \brief Describes the vertex order of front-facing polygons.
  84. ///
  85. typedef enum _GX2FrontFaceMode
  86. {
  87.     GX2_FRONT_FACE_CCW             = 0,
  88.     GX2_FRONT_FACE_CW              = 1,
  89.     GX2_FRONT_FACE_FIRST           = GX2_FRONT_FACE_CCW,
  90.     GX2_FRONT_FACE_LAST            = GX2_FRONT_FACE_CW
  91. } GX2FrontFaceMode;
  92.  
  93. /// \brief When dual-sided polygon mode is enabled, describes the
  94. /// base primitive used to draw each side of the polygon.
  95. ///
  96. typedef enum _GX2PolygonMode
  97. {
  98.     GX2_POLYGON_MODE_POINT         = 0,
  99.     GX2_POLYGON_MODE_LINE          = 1,
  100.     GX2_POLYGON_MODE_TRIANGLE      = 2,
  101.     GX2_POLYGON_MODE_FIRST         = GX2_POLYGON_MODE_POINT,
  102.     GX2_POLYGON_MODE_LAST          = GX2_POLYGON_MODE_TRIANGLE
  103. } GX2PolygonMode;
  104.  
  105. /// \brief Compare function used for depth & stencil tests.
  106. ///
  107. typedef enum _GX2CompareFunction
  108. {
  109.     GX2_COMPARE_NEVER              = 0,
  110.     GX2_COMPARE_LESS               = 1,
  111.     GX2_COMPARE_EQUAL              = 2,
  112.     GX2_COMPARE_LEQUAL             = 3,
  113.     GX2_COMPARE_GREATER            = 4,
  114.     GX2_COMPARE_NOTEQUAL           = 5,
  115.     GX2_COMPARE_GEQUAL             = 6,
  116.     GX2_COMPARE_ALWAYS             = 7,
  117.     GX2_COMPARE_FIRST              = GX2_COMPARE_NEVER,
  118.     GX2_COMPARE_LAST               = GX2_COMPARE_ALWAYS
  119. } GX2CompareFunction;
  120.  
  121. /// \brief Stencil function to be performed if stencil tests pass.
  122. ///
  123. typedef enum _GX2StencilFunction
  124. {
  125.     GX2_STENCIL_KEEP               = 0,
  126.     GX2_STENCIL_ZERO               = 1,
  127.     GX2_STENCIL_REPLACE            = 2,
  128.     GX2_STENCIL_INCR               = 3,
  129.     GX2_STENCIL_DECR               = 4,
  130.     GX2_STENCIL_INVERT             = 5,
  131.     GX2_STENCIL_INCR_WRAP          = 6,
  132.     GX2_STENCIL_DECR_WRAP          = 7,
  133.     GX2_STENCIL_FIRST              = GX2_STENCIL_KEEP,
  134.     GX2_STENCIL_LAST               = GX2_STENCIL_DECR_WRAP
  135. } GX2StencilFunction;
  136.  
  137. /// \brief RGBA color channel mask values.
  138. ///
  139. typedef enum _GX2ChannelMask
  140. {
  141.     GX2_CHANNEL_MASK_NONE          = 0x0, ///< 0000
  142.     GX2_CHANNEL_MASK_R             = 0x1, ///< 0001
  143.     GX2_CHANNEL_MASK_G             = 0x2, ///< 0010
  144.     GX2_CHANNEL_MASK_RG            = 0x3, ///< 0011
  145.     GX2_CHANNEL_MASK_B             = 0x4, ///< 0100
  146.     GX2_CHANNEL_MASK_RB            = 0x5, ///< 0101
  147.     GX2_CHANNEL_MASK_GB            = 0x6, ///< 0110
  148.     GX2_CHANNEL_MASK_RGB           = 0x7, ///< 0111
  149.     GX2_CHANNEL_MASK_A             = 0x8, ///< 1000
  150.     GX2_CHANNEL_MASK_RA            = 0x9, ///< 1001
  151.     GX2_CHANNEL_MASK_GA            = 0xA, ///< 1010
  152.     GX2_CHANNEL_MASK_RGA           = 0xB, ///< 1011
  153.     GX2_CHANNEL_MASK_BA            = 0xC, ///< 1100
  154.     GX2_CHANNEL_MASK_RBA           = 0xD, ///< 1101
  155.     GX2_CHANNEL_MASK_GBA           = 0xE, ///< 1110
  156.     GX2_CHANNEL_MASK_RGBA          = 0xF, ///< 1111
  157.     GX2_CHANNEL_MASK_FIRST         = GX2_CHANNEL_MASK_NONE,
  158.     GX2_CHANNEL_MASK_LAST          = GX2_CHANNEL_MASK_RGBA
  159. } GX2ChannelMask;
  160.  
  161. /// \brief Describes the logic op function to perform.
  162. ///
  163. /// \note  Always specify GX2_LOGIC_OP_COPY when logic op is not used.
  164. ///
  165. typedef enum _GX2LogicOp
  166. {
  167.     GX2_LOGIC_OP_CLEAR             = 0x00, ///<   0x00 (BLACKNESS)
  168.     GX2_LOGIC_OP_SET               = 0xFF, ///<   0xff (WHITNESS)
  169.     GX2_LOGIC_OP_COPY              = 0xCC, ///<   Source (Default)
  170.     GX2_LOGIC_OP_INVCOPY           = 0x33, ///<  ~Source
  171.     GX2_LOGIC_OP_NOOP              = 0xAA, ///<   Destination
  172.     GX2_LOGIC_OP_INV               = 0x55, ///<  ~Destination
  173.     GX2_LOGIC_OP_AND               = 0x88, ///<   Source  &  Destination
  174.     GX2_LOGIC_OP_NAND              = 0x77, ///< ~(Source  &  Destination)
  175.     GX2_LOGIC_OP_OR                = 0xEE, ///<   Source  |  Destination
  176.     GX2_LOGIC_OP_NOR               = 0x11, ///< ~(Source  |  Destination)
  177.     GX2_LOGIC_OP_XOR               = 0x66, ///<   Source  ^  Destination
  178.     GX2_LOGIC_OP_EQUIV             = 0x99, ///< ~(Source  ^  Destination)
  179.     GX2_LOGIC_OP_REVAND            = 0x44, ///<   Source  & ~Destination
  180.     GX2_LOGIC_OP_INVAND            = 0x22, ///<  ~Source  &  Destination
  181.     GX2_LOGIC_OP_REVOR             = 0xDD, ///<   Source  | ~Destination
  182.     GX2_LOGIC_OP_INVOR             = 0xBB, ///<  ~Source  |  Destination
  183.  
  184.     GX2_LOGIC_OP_NONE = GX2_LOGIC_OP_COPY, ///< Useful synonym
  185.     GX2_LOGIC_OP_FIRST             = GX2_LOGIC_OP_CLEAR,
  186.     GX2_LOGIC_OP_LAST              = GX2_LOGIC_OP_SET
  187. } GX2LogicOp;
  188.  
  189. /// \brief Describes the factors used in the blend function.
  190. ///
  191. /// In the descriptions below, the first column describes color blend
  192. /// functions, while the second column describes alpha blend functions.
  193. /// The codes are:
  194. /// - s0 = source 0
  195. /// - s1 = source 1 (see note below)
  196. /// - d  = destination
  197. /// - c  = constant
  198. /// - f  = min(s0:A, 1-d:A).
  199. ///
  200. /// \note Using source 1 implies dual-source blending.  This is
  201. ///       mutually exclusive with MRTs.  It is also not compatible
  202. ///       with multiwriteEnable (\ref GX2SetColorControl).
  203. ///       It requires a pixel shader with 2 color output channels
  204. ///       (gl_FragData[0] and gl_FragData[1]).
  205. ///
  206. typedef enum _GX2BlendFunction
  207. {
  208.     GX2_BLEND_ZERO                     = 0,  ///<    (0,0,0)       |    (0)
  209.     GX2_BLEND_ONE                      = 1,  ///<    (1,1,1)       |    (1)
  210.     GX2_BLEND_SRC_COLOR                = 2,  ///< s0:(R,G,B)       | s0:(A)
  211.     GX2_BLEND_ONE_MINUS_SRC_COLOR      = 3,  ///< s0:(1-R,1-G,1-B) | s0:(1-A)
  212.     GX2_BLEND_SRC_ALPHA                = 4,  ///< s0:(A,A,A)       | s0:(A)
  213.     GX2_BLEND_ONE_MINUS_SRC_ALPHA      = 5,  ///< s0:(1-A,1-A,1-A) | s0:(1-A)
  214.     GX2_BLEND_DST_ALPHA                = 6,  ///< d :(A,A,A)       | d :(A)
  215.     GX2_BLEND_ONE_MINUS_DST_ALPHA      = 7,  ///< d :(1-A,1-A,1-A) | d :(1-A)
  216.     GX2_BLEND_DST_COLOR                = 8,  ///< d :(R,G,B)       | d :(A)
  217.     GX2_BLEND_ONE_MINUS_DST_COLOR      = 9,  ///< d :(1-R,1-G,1-B) | d :(1-A)
  218.     GX2_BLEND_SRC_ALPHA_SATURATE       = 10, ///<    (f,f,f)       |    (1)
  219.     GX2_BLEND_CONSTANT_COLOR           = 13, ///< c :(R,G,B)       | c :(A)
  220.     GX2_BLEND_ONE_MINUS_CONSTANT_COLOR = 14, ///< c :(1-R,1-G,1-B) | c :(1-A)
  221.     GX2_BLEND_SRC1_COLOR               = 15, ///< s1:(R,G,B)       | s1:(A)
  222.     GX2_BLEND_ONE_MINUS_SRC1_COLOR     = 16, ///< s1:(1-R,1-G,1-B) | s1:(1-A)
  223.     GX2_BLEND_SRC1_ALPHA               = 17, ///< s1:(A,A,A)       | s1:(A)
  224.     GX2_BLEND_ONE_MINUS_SRC1_ALPHA     = 18, ///< s1:(1-A,1-A,1-A) | s1:(1-A)
  225.     GX2_BLEND_CONSTANT_ALPHA           = 19, ///< c :(A,A,A)       | c :(A)
  226.     GX2_BLEND_ONE_MINUS_CONSTANT_ALPHA = 20, ///< c :(1-A,1-A,1-A) | c :(1-A)
  227.     GX2_BLEND_FIRST                    = GX2_BLEND_ZERO,
  228.     GX2_BLEND_LAST                     = GX2_BLEND_ONE_MINUS_CONSTANT_ALPHA
  229. } GX2BlendFunction;
  230.  
  231. /// \brief Describes how the terms of the blend function are combined.
  232. ///
  233. typedef enum _GX2BlendCombine
  234. {
  235.     GX2_BLEND_COMBINE_ADD              = 0,
  236.     GX2_BLEND_COMBINE_SRC_MINUS_DST    = 1,
  237.     GX2_BLEND_COMBINE_MIN              = 2,
  238.     GX2_BLEND_COMBINE_MAX              = 3,
  239.     GX2_BLEND_COMBINE_DST_MINUS_SRC    = 4,
  240.     GX2_BLEND_COMBINE_FIRST            = GX2_BLEND_COMBINE_ADD,
  241.     GX2_BLEND_COMBINE_LAST             = GX2_BLEND_COMBINE_DST_MINUS_SRC
  242. } GX2BlendCombine;
  243.  
  244. /// \brief Used to tweak the AlphaToMask operation.
  245. ///
  246. typedef enum _GX2AlphaToMaskMode
  247. {
  248.     GX2_ALPHA_TO_MASK_0                = 0, ///< non-dithered
  249.     GX2_ALPHA_TO_MASK_1                = 1, ///< dithered, rotation 0
  250.     GX2_ALPHA_TO_MASK_2                = 2, ///< dithered, rotation 90
  251.     GX2_ALPHA_TO_MASK_3                = 3, ///< dithered, rotation 180
  252.     GX2_ALPHA_TO_MASK_4                = 4, ///< dithered, rotation 270
  253.     GX2_ALPHA_TO_MASK_FIRST            = GX2_ALPHA_TO_MASK_0,
  254.     GX2_ALPHA_TO_MASK_LAST             = GX2_ALPHA_TO_MASK_4
  255. } GX2AlphaToMaskMode;
  256.  
  257. /// \brief Used to specify a destination render target.
  258. ///
  259. typedef enum _GX2RenderTarget
  260. {
  261.     GX2_RENDER_TARGET_0                = 0,
  262.     GX2_RENDER_TARGET_1                = 1,
  263.     GX2_RENDER_TARGET_2                = 2,
  264.     GX2_RENDER_TARGET_3                = 3,
  265.     GX2_RENDER_TARGET_4                = 4,
  266.     GX2_RENDER_TARGET_5                = 5,
  267.     GX2_RENDER_TARGET_6                = 6,
  268.     GX2_RENDER_TARGET_7                = 7,
  269.     GX2_RENDER_TARGET_FIRST            = GX2_RENDER_TARGET_0,
  270.     GX2_RENDER_TARGET_LAST             = GX2_RENDER_TARGET_7
  271. } GX2RenderTarget;
  272.  
  273. // -----------------------------------------------------------------------------
  274. // Enums - Vertex Streams
  275.  
  276. /// \brief Describes the overall format of a vertex attribute entry.
  277. ///
  278. /// Please refer to \ref GX2FormatPage for more details.
  279. ///
  280. /// Type conversion options:
  281. /// - UNORM : attrib unsigned integer is converted to/from [0.0, 1.0] in shader
  282. /// - UINT  : attrib unsigned integer is copied to/from shader as unsigned int
  283. /// - SNORM : attrib signed integer is converted to/from [-1.0, 1.0] in shader
  284. /// - SINT  : attrib signed integer is copied to/from shader as signed int
  285. /// - FLOAT : attrib float is copied to/from shader as float
  286. /// - UINT_TO_FLOAT : attrib unsigned integer is converted float in shader
  287. /// - SINT_TO_FLOAT : attrib signed integer is converted float in shader
  288. /// (32 bit integers cannot be converted to float during fetch)
  289. typedef enum _GX2AttribFormat
  290. {
  291.   // 8 bits (8 x 1):
  292.     GX2_ATTRIB_FORMAT_8_UNORM             = 0x00000000,
  293.     GX2_ATTRIB_FORMAT_8_UINT              = 0x00000100,
  294.     GX2_ATTRIB_FORMAT_8_SNORM             = 0x00000200,
  295.     GX2_ATTRIB_FORMAT_8_SINT              = 0x00000300,
  296.     GX2_ATTRIB_FORMAT_8_UINT_TO_FLOAT     = 0x00000800,
  297.     GX2_ATTRIB_FORMAT_8_SINT_TO_FLOAT     = 0x00000a00,
  298.   // 8 bits (4 x 2):
  299.     GX2_ATTRIB_FORMAT_4_4_UNORM           = 0x00000001,
  300.   // 16 bits (16 x 1):
  301.     GX2_ATTRIB_FORMAT_16_UNORM            = 0x00000002,
  302.     GX2_ATTRIB_FORMAT_16_UINT             = 0x00000102,
  303.     GX2_ATTRIB_FORMAT_16_SNORM            = 0x00000202,
  304.     GX2_ATTRIB_FORMAT_16_SINT             = 0x00000302,
  305.     GX2_ATTRIB_FORMAT_16_FLOAT            = 0x00000803,
  306.     GX2_ATTRIB_FORMAT_16_UINT_TO_FLOAT    = 0x00000802,
  307.     GX2_ATTRIB_FORMAT_16_SINT_TO_FLOAT    = 0x00000a02,
  308.   // 16 bits (8 x 2):
  309.     GX2_ATTRIB_FORMAT_8_8_UNORM           = 0x00000004,
  310.     GX2_ATTRIB_FORMAT_8_8_UINT            = 0x00000104,
  311.     GX2_ATTRIB_FORMAT_8_8_SNORM           = 0x00000204,
  312.     GX2_ATTRIB_FORMAT_8_8_SINT            = 0x00000304,
  313.     GX2_ATTRIB_FORMAT_8_8_UINT_TO_FLOAT   = 0x00000804,
  314.     GX2_ATTRIB_FORMAT_8_8_SINT_TO_FLOAT   = 0x00000a04,
  315.   // 32 bits (32 x 1):
  316.     GX2_ATTRIB_FORMAT_32_UINT             = 0x00000105,
  317.     GX2_ATTRIB_FORMAT_32_SINT             = 0x00000305,
  318.     GX2_ATTRIB_FORMAT_32_FLOAT            = 0x00000806,
  319.   // 32 bits (16 x 2):
  320.     GX2_ATTRIB_FORMAT_16_16_UNORM         = 0x00000007,
  321.     GX2_ATTRIB_FORMAT_16_16_UINT          = 0x00000107,
  322.     GX2_ATTRIB_FORMAT_16_16_SNORM         = 0x00000207,
  323.     GX2_ATTRIB_FORMAT_16_16_SINT          = 0x00000307,
  324.     GX2_ATTRIB_FORMAT_16_16_FLOAT         = 0x00000808,
  325.     GX2_ATTRIB_FORMAT_16_16_UINT_TO_FLOAT = 0x00000807,
  326.     GX2_ATTRIB_FORMAT_16_16_SINT_TO_FLOAT = 0x00000a07,
  327.   // 32 bits (10/11 x 3):
  328.     GX2_ATTRIB_FORMAT_10_11_11_FLOAT      = 0x00000809,
  329.   // 32 bits (8 x 4):
  330.     GX2_ATTRIB_FORMAT_8_8_8_8_UNORM         = 0x0000000a,
  331.     GX2_ATTRIB_FORMAT_8_8_8_8_UINT          = 0x0000010a,
  332.     GX2_ATTRIB_FORMAT_8_8_8_8_SNORM         = 0x0000020a,
  333.     GX2_ATTRIB_FORMAT_8_8_8_8_SINT          = 0x0000030a,
  334.     GX2_ATTRIB_FORMAT_8_8_8_8_UINT_TO_FLOAT = 0x0000080a,
  335.     GX2_ATTRIB_FORMAT_8_8_8_8_SINT_TO_FLOAT = 0x00000a0a,
  336.   // 32 bits (10 x 3 + 2):
  337.     GX2_ATTRIB_FORMAT_10_10_10_2_UNORM      = 0x0000000b,
  338.     GX2_ATTRIB_FORMAT_10_10_10_2_UINT       = 0x0000010b,
  339.     GX2_ATTRIB_FORMAT_10_10_10_2_SNORM      = 0x0000020b, // "2" part is UNORM
  340.     GX2_ATTRIB_FORMAT_10_10_10_2_SINT       = 0x0000030b,
  341.   // 64 bits (32 x 2):
  342.     GX2_ATTRIB_FORMAT_32_32_UINT            = 0x0000010c,
  343.     GX2_ATTRIB_FORMAT_32_32_SINT            = 0x0000030c,
  344.     GX2_ATTRIB_FORMAT_32_32_FLOAT           = 0x0000080d,
  345.   // 64 bits (16 x 4):
  346.     GX2_ATTRIB_FORMAT_16_16_16_16_UNORM         = 0x0000000e,
  347.     GX2_ATTRIB_FORMAT_16_16_16_16_UINT          = 0x0000010e,
  348.     GX2_ATTRIB_FORMAT_16_16_16_16_SNORM         = 0x0000020e,
  349.     GX2_ATTRIB_FORMAT_16_16_16_16_SINT          = 0x0000030e,
  350.     GX2_ATTRIB_FORMAT_16_16_16_16_FLOAT         = 0x0000080f,
  351.     GX2_ATTRIB_FORMAT_16_16_16_16_UINT_TO_FLOAT = 0x0000080e,
  352.     GX2_ATTRIB_FORMAT_16_16_16_16_SINT_TO_FLOAT = 0x00000a0e,
  353.   // 96 bits (32 x 3):
  354.     GX2_ATTRIB_FORMAT_32_32_32_UINT             = 0x00000110,
  355.     GX2_ATTRIB_FORMAT_32_32_32_SINT             = 0x00000310,
  356.     GX2_ATTRIB_FORMAT_32_32_32_FLOAT            = 0x00000811,
  357.   // 128 bits (32 x 4):
  358.     GX2_ATTRIB_FORMAT_32_32_32_32_UINT          = 0x00000112,
  359.     GX2_ATTRIB_FORMAT_32_32_32_32_SINT          = 0x00000312,
  360.     GX2_ATTRIB_FORMAT_32_32_32_32_FLOAT         = 0x00000813,
  361.   //
  362.     GX2_ATTRIB_FORMAT_FIRST = GX2_ATTRIB_FORMAT_8_UNORM,
  363.     GX2_ATTRIB_FORMAT_LAST  = GX2_ATTRIB_FORMAT_16_16_16_16_SINT_TO_FLOAT
  364. } GX2AttribFormat;
  365.  
  366. /// \brief Describes the index used to look up vertex attributes.
  367. ///
  368. typedef enum _GX2AttribIndexType
  369. {
  370.     /// per-vertex index
  371.     GX2_ATTRIB_INDEX_VERTEX_ID             = 0x00000000,
  372.     /// per-instance index
  373.     GX2_ATTRIB_INDEX_INSTANCE_ID           = 0x00000001,
  374.     GX2_ATTRIB_INDEX_FIRST                 = GX2_ATTRIB_INDEX_VERTEX_ID,
  375.     GX2_ATTRIB_INDEX_LAST                  = GX2_ATTRIB_INDEX_INSTANCE_ID
  376. } GX2AttribIndexType;
  377.  
  378. /// \brief Used to control attribute and texture component swizzling
  379. /// as well as specifying values for elements not present in the format.
  380. ///
  381. typedef enum _GX2Component
  382. {
  383.     GX2_COMPONENT_X_R             = 0x00000000, // X or red
  384.     GX2_COMPONENT_Y_G             = 0x00000001, // Y or green
  385.     GX2_COMPONENT_Z_B             = 0x00000002, // Z or blue
  386.     GX2_COMPONENT_W_A             = 0x00000003, // W or alpha
  387.     GX2_COMPONENT_C_0             = 0x00000004, // constant 0
  388.     GX2_COMPONENT_C_1             = 0x00000005, // constant 1
  389.     GX2_COMPONENT_FIRST           = GX2_COMPONENT_X_R,
  390.     GX2_COMPONENT_LAST            = GX2_COMPONENT_C_1
  391. } GX2Component;
  392.  
  393. // -----------------------------------------------------------------------------
  394. // Enums - Shaders
  395.  
  396. /// \brief Used to indicate the desired shader mode of operation
  397. ///
  398. /// \note: Changing the mode invokes a full pipeline flush (affects performance)
  399. /// \note: GX2_SHADER_MODE_GEOMETRY_SHADER - Enable full geometry shader support.
  400. ///        When this mode is enabled UNIFORM_BLOCKS will automatically be enabled.
  401. typedef enum _GX2ShaderMode
  402. {
  403.     GX2_SHADER_MODE_UNIFORM_REGISTER,
  404.     GX2_SHADER_MODE_UNIFORM_BLOCK,
  405.     GX2_SHADER_MODE_GEOMETRY_SHADER,
  406.     GX2_SHADER_MODE_FIRST               = GX2_SHADER_MODE_UNIFORM_REGISTER,
  407.     GX2_SHADER_MODE_LAST                = GX2_SHADER_MODE_GEOMETRY_SHADER
  408. } GX2ShaderMode;
  409.  
  410. /// \brief Type for shader variables (attribs, uniforms, etc.)
  411. ///
  412. typedef enum _GX2VarType
  413. {
  414.     GX2_VAR_TYPE_VOID,
  415.     GX2_VAR_TYPE_BOOL,
  416.     GX2_VAR_TYPE_INT,
  417.     GX2_VAR_TYPE_UINT,
  418.     GX2_VAR_TYPE_FLOAT,
  419.     GX2_VAR_TYPE_DOUBLE,
  420.     GX2_VAR_TYPE_DVEC2,
  421.     GX2_VAR_TYPE_DVEC3,
  422.     GX2_VAR_TYPE_DVEC4,
  423.     GX2_VAR_TYPE_VEC2,
  424.     GX2_VAR_TYPE_VEC3,
  425.     GX2_VAR_TYPE_VEC4,
  426.     GX2_VAR_TYPE_BVEC2,
  427.     GX2_VAR_TYPE_BVEC3,
  428.     GX2_VAR_TYPE_BVEC4,
  429.     GX2_VAR_TYPE_IVEC2,
  430.     GX2_VAR_TYPE_IVEC3,
  431.     GX2_VAR_TYPE_IVEC4,
  432.     GX2_VAR_TYPE_UVEC2,
  433.     GX2_VAR_TYPE_UVEC3,
  434.     GX2_VAR_TYPE_UVEC4,
  435.     GX2_VAR_TYPE_MAT2,
  436.     GX2_VAR_TYPE_MAT2X3,
  437.     GX2_VAR_TYPE_MAT2X4,
  438.     GX2_VAR_TYPE_MAT3X2,
  439.     GX2_VAR_TYPE_MAT3,
  440.     GX2_VAR_TYPE_MAT3X4,
  441.     GX2_VAR_TYPE_MAT4X2,
  442.     GX2_VAR_TYPE_MAT4X3,
  443.     GX2_VAR_TYPE_MAT4,
  444.     GX2_VAR_TYPE_DMAT2,
  445.     GX2_VAR_TYPE_DMAT2X3,
  446.     GX2_VAR_TYPE_DMAT2X4,
  447.     GX2_VAR_TYPE_DMAT3X2,
  448.     GX2_VAR_TYPE_DMAT3,
  449.     GX2_VAR_TYPE_DMAT3X4,
  450.     GX2_VAR_TYPE_DMAT4X2,
  451.     GX2_VAR_TYPE_DMAT4X3,
  452.     GX2_VAR_TYPE_DMAT4,
  453.     GX2_VAR_TYPE_FIRST = GX2_VAR_TYPE_VOID,
  454.     GX2_VAR_TYPE_LAST = GX2_VAR_TYPE_DMAT4
  455. } GX2VarType;
  456.  
  457. /// \brief Type for shader samplers.
  458. /// If it's not "INT", then it's float.
  459. ///
  460. /// This can be used for verification.
  461. /// It can also indicate when to set depth-sampling filter option.
  462. ///
  463. typedef enum _GX2SamplerType
  464. {
  465.     GX2_SAMPLER_TYPE_1D,
  466.     GX2_SAMPLER_TYPE_2D,
  467.     GX2_SAMPLER_TYPE_2D_RECT,
  468.     GX2_SAMPLER_TYPE_3D,
  469.     GX2_SAMPLER_TYPE_CUBE,
  470.     GX2_SAMPLER_TYPE_1D_SHADOW,
  471.     GX2_SAMPLER_TYPE_2D_SHADOW,
  472.     GX2_SAMPLER_TYPE_2D_RECT_SHADOW,
  473.     GX2_SAMPLER_TYPE_CUBE_SHADOW,
  474.     GX2_SAMPLER_TYPE_1D_ARRAY,
  475.     GX2_SAMPLER_TYPE_2D_ARRAY,
  476.     GX2_SAMPLER_TYPE_1D_ARRAY_SHADOW,
  477.     GX2_SAMPLER_TYPE_2D_ARRAY_SHADOW,
  478.     GX2_SAMPLER_TYPE_CUBE_ARRAY,
  479.     GX2_SAMPLER_TYPE_CUBE_ARRAY_SHADOW,
  480.     GX2_SAMPLER_TYPE_BUFFER,
  481.     GX2_SAMPLER_TYPE_RESERVED_1,
  482.     GX2_SAMPLER_TYPE_2D_MS,
  483.     GX2_SAMPLER_TYPE_2D_MS_ARRAY,
  484.     GX2_SAMPLER_TYPE_INT_1D,
  485.     GX2_SAMPLER_TYPE_INT_2D,
  486.     GX2_SAMPLER_TYPE_INT_2D_RECT,
  487.     GX2_SAMPLER_TYPE_INT_3D,
  488.     GX2_SAMPLER_TYPE_INT_CUBE,
  489.     GX2_SAMPLER_TYPE_INT_1D_ARRAY,
  490.     GX2_SAMPLER_TYPE_INT_2D_ARRAY,
  491.     GX2_SAMPLER_TYPE_INT_CUBE_ARRAY,
  492.     GX2_SAMPLER_TYPE_INT_BUFFER,
  493.     GX2_SAMPLER_TYPE_RESERVED_2,
  494.     GX2_SAMPLER_TYPE_INT_2D_MS,
  495.     GX2_SAMPLER_TYPE_INT_2D_MS_ARRAY,
  496.     GX2_SAMPLER_TYPE_UNSIGNED_INT_1D,
  497.     GX2_SAMPLER_TYPE_UNSIGNED_INT_2D,
  498.     GX2_SAMPLER_TYPE_UNSIGNED_INT_2D_RECT,
  499.     GX2_SAMPLER_TYPE_UNSIGNED_INT_3D,
  500.     GX2_SAMPLER_TYPE_UNSIGNED_INT_CUBE,
  501.     GX2_SAMPLER_TYPE_UNSIGNED_INT_1D_ARRAY,
  502.     GX2_SAMPLER_TYPE_UNSIGNED_INT_2D_ARRAY,
  503.     GX2_SAMPLER_TYPE_UNSIGNED_INT_CUBE_ARRAY,
  504.     GX2_SAMPLER_TYPE_UNSIGNED_INT_BUFFER,
  505.     GX2_SAMPLER_TYPE_RESERVED_3,
  506.     GX2_SAMPLER_TYPE_UNSIGNED_INT_2D_MS,
  507.     GX2_SAMPLER_TYPE_UNSIGNED_INT_2D_MS_ARRAY,
  508.     GX2_SAMPLER_TYPE_FIRST = GX2_SAMPLER_TYPE_1D,
  509.     GX2_SAMPLER_TYPE_LAST  = GX2_SAMPLER_TYPE_UNSIGNED_INT_2D_MS_ARRAY
  510. } GX2SamplerType;
  511.  
  512. // -----------------------------------------------------------------------------
  513. // Enums - Drawing
  514.  
  515. /// \brief Indicates whether vertex indices are 16-bit or 32-bit.
  516. ///
  517. typedef enum _GX2IndexFormat
  518. {
  519.     GX2_INDEX_FORMAT_U16_LE = 0, // indices are u16, little-endian
  520.     GX2_INDEX_FORMAT_U32_LE = 1, // indices are u32, little-endian
  521.     GX2_INDEX_FORMAT_U16 = 4, // indices are u16, big-endian
  522.     GX2_INDEX_FORMAT_U32 = 9, // indices are u32, big-endian
  523.     GX2_INDEX_FORMAT_FIRST  = GX2_INDEX_FORMAT_U16_LE,
  524.     GX2_INDEX_FORMAT_LAST   = GX2_INDEX_FORMAT_U32
  525. } GX2IndexFormat;
  526.  
  527. /// \brief Indicates type of primitive to draw.
  528. ///
  529. /// Below, "min" is the minimum number of vertices to draw a single primitive.
  530. /// The "incr" is how many more vertices are needed to draw the next primitive.
  531. ///
  532. typedef enum _GX2PrimitiveType
  533. {
  534.     GX2_PRIMITIVE_POINTS                      = 0x01, ///< min = 1; incr = 1
  535.     GX2_PRIMITIVE_LINES                       = 0x02, ///< min = 2; incr = 2
  536.     GX2_PRIMITIVE_LINE_STRIP                  = 0x03, ///< min = 2; incr = 1
  537.     GX2_PRIMITIVE_TRIANGLES                   = 0x04, ///< min = 3; incr = 3
  538.     GX2_PRIMITIVE_TRIANGLE_FAN                = 0x05, ///< min = 3; incr = 1
  539.     GX2_PRIMITIVE_TRIANGLE_STRIP              = 0x06, ///< min = 3; incr = 1
  540.     GX2_PRIMITIVE_LINES_ADJACENCY             = 0x0a, ///< min = 4; incr = 4
  541.     GX2_PRIMITIVE_LINE_STRIP_ADJACENCY        = 0x0b, ///< min = 4; incr = 1
  542.     GX2_PRIMITIVE_TRIANGLES_ADJACENCY         = 0x0c, ///< min = 6; incr = 6
  543.     GX2_PRIMITIVE_TRIANGLE_STRIP_ADJACENCY    = 0x0d, ///< min = 6; incr = 2
  544.     GX2_PRIMITIVE_RECTS                       = 0x11, ///< min = 3; incr = 3
  545.     GX2_PRIMITIVE_LINE_LOOP                   = 0x12, ///< min = 2; incr = 1
  546.     GX2_PRIMITIVE_QUADS                       = 0x13, ///< min = 4; incr = 4
  547.     GX2_PRIMITIVE_QUAD_STRIP                  = 0x14, ///< min = 4; incr = 2
  548.     GX2_PRIMITIVE_TESSELLATE_LINES            = 0x82, ///< min = 2; incr = 2
  549.     GX2_PRIMITIVE_TESSELLATE_LINE_STRIP       = 0x83, ///< min = 2; incr = 1
  550.     GX2_PRIMITIVE_TESSELLATE_TRIANGLES        = 0x84, ///< min = 3; incr = 3
  551.     GX2_PRIMITIVE_TESSELLATE_TRIANGLE_STRIP   = 0x86, ///< min = 3; incr = 1
  552.     GX2_PRIMITIVE_TESSELLATE_QUADS            = 0x93, ///< min = 4; incr = 4
  553.     GX2_PRIMITIVE_TESSELLATE_QUAD_STRIP       = 0x94, ///< min = 4; incr = 2
  554.     GX2_PRIMITIVE_FIRST                    = GX2_PRIMITIVE_POINTS,
  555.     GX2_PRIMITIVE_LAST                        = GX2_PRIMITIVE_TESSELLATE_QUAD_STRIP
  556. } GX2PrimitiveType;
  557.  
  558. // -----------------------------------------------------------------------------
  559. // Enums - Clear
  560.  
  561. /// \brief Describes which buffers to clear for depth/stencil clear
  562. ///
  563. typedef enum _GX2ClearMode
  564. {
  565.     GX2_CLEAR_NONE    = 0, // No-op
  566.     GX2_CLEAR_DEPTH   = 1, // clear depth buffer
  567.     GX2_CLEAR_STENCIL = 2, // clear stencil buffer
  568.     GX2_CLEAR_D_REG   = 4, // Set depth clear value into the current context
  569.                            // register. The depth buffer values are not actually
  570.                            // changed. This register value needs to match the
  571.                            // clear value of the buffer for correct HiZ operation.
  572.     GX2_CLEAR_S_REG   = 8, // Set stencil clear value into the current context
  573.                            // register. The stencil buffer values are not
  574.                            // actually changed.  This register value needs to
  575.                            // match clear value of the buffer for correct HiZ
  576.                            // operation.
  577.     GX2_CLEAR_BOTH          = GX2_CLEAR_DEPTH   | GX2_CLEAR_STENCIL,
  578.     GX2_CLEAR_D_S_REG       = GX2_CLEAR_D_REG   | GX2_CLEAR_S_REG,
  579.     GX2_CLEAR_DEPTH_D_REG   = GX2_CLEAR_DEPTH   | GX2_CLEAR_D_REG,
  580.     GX2_CLEAR_STENCIL_S_REG = GX2_CLEAR_STENCIL | GX2_CLEAR_S_REG,
  581.     GX2_CLEAR_BOTH_D_S_REG  = GX2_CLEAR_DEPTH_D_REG | GX2_CLEAR_STENCIL_S_REG,
  582.     GX2_CLEAR_FIRST         = GX2_CLEAR_NONE,
  583.     GX2_CLEAR_LAST          = GX2_CLEAR_BOTH_D_S_REG
  584. } GX2ClearMode;
  585.  
  586. // -----------------------------------------------------------------------------
  587. // Enums - Textures & other surfaces
  588.  
  589. /// \brief Indicates desired texture, color-buffer, depth-buffer, or scan-buffer format.
  590. ///
  591. /// After the word "format", the following letters indicate the possible uses:
  592. /// T=texture, C=color-buffer, D=depth/stencil-buffer, S=scan-buffer.
  593. ///
  594. /// There are some formats with the same enum value, but different use labels.
  595. /// These are provided as a convenience to explain the type information for each use.
  596. ///
  597. /// Type conversion options:
  598. /// - UNORM (0): surface unsigned integer is converted to/from [0.0, 1.0] in shader
  599. /// - UINT  (1): surface unsigned integer is copied to/from shader as unsigned int
  600. /// - SNORM (2): surface signed integer is converted to/from [-1.0, 1.0] in shader
  601. /// - SINT  (3): surface signed integer is copied to/from shader as signed int
  602. /// - SRGB  (4): SRGB degamma performed on surface read, then treated as UNORM;
  603. ///              SRGB gamma is performed on surface write
  604. /// - FLOAT (8): surface float is copied to/from shader as float
  605. ///
  606. /// Note: As textures, all UINT/SINT formats may be point-sampled only!
  607. ///
  608. /// The numbers in the names indicate the number of bits per channel, as well as
  609. /// how many channels are present.  An "X" in front of a number indicates padding
  610. /// bits that are present, but do not map to any channel.
  611. ///
  612. /// Texture color channel mappings:
  613. /// - 1-channel formats map to R [GBA are undefined]
  614. /// - 2-channel formats map to RG [BA are undefined]
  615. /// - 3-channel formats map to RGB [A is undefined]
  616. /// - 4-channel formats map to RGBA
  617. ///
  618. /// Channel mapping can be changed using the GX2InitTextureCompSel API.
  619. /// We advise you avoid referring to channels that don't exist in the format.
  620. /// You should use the component select to choose constant values in those cases.
  621. /// The default component selectors in GX2InitTexture map:
  622. /// - 1-channel formats to R001
  623. /// - 2-channel formats to RG01
  624. /// - 3-channel formats to RGB1
  625. /// - 4-channel formats to RGBA
  626. ///
  627. /// To understand exact component bit placement, you must first understand the
  628. /// basic machine unit that the components are packed into.  If each component
  629. /// fits into a single unit, then the order is simply R,G,B,A.  If multiple
  630. /// components are packed into a single unit, then the components are packed
  631. /// in order starting from the LSB end.  In all cases, multi-byte machine units
  632. /// are then written out in little-endian format.
  633. ///
  634. /// Note 1: It is not presently possible to switch between depth and color buffer
  635. /// uses for the same surface.  This requires a retiling, since the tile formats
  636. /// are different and incompatible.  The texture unit can read depth-tiled buffers
  637. /// (except for D24_S8 format).  The D24_S8 format requires tile-conversion before
  638. /// it can be read by the texture unit.  Note that the two components have different
  639. /// number formats, and only the depth part can be sampled with any filter more
  640. /// complex than point-sampling.
  641. /// It is needed to use GX2_SURFACE_FORMAT_T_R24_UNORM_X8 for reading depth buffer as
  642. /// texture and GX2_SURFACE_FORMAT_T_X24_G8_UINT for reading stencil buffer as texture.
  643. /// See \ref GX2ConvertDepthBufferToTextureSurface() for more information.
  644. ///
  645. /// Note 2: Similar to depth format D_D24_S8_UNORM and texture formats T_R24_UNORM_X8
  646. /// and T_X24_G8_UINT, format GX2_SURFACE_FORMAT_D_D32_FLOAT_S8_UINT_X24 is a
  647. /// depth/stencil buffer format while T_R32_FLOAT_X8_X24 and T_X32_G8_UINT_X24 are
  648. /// texture formats used to read the depth and stencil data, respectively.
  649. /// See \ref GX2ConvertDepthBufferToTextureSurface() for more information.
  650. ///
  651. /// Note 3: The NV12 format is a special case for video.  It actually consists of
  652. /// two surfaces (an 8-bit surface & a 1/4-size 16-bit surface).  It is only usable
  653. /// in certain situations.
  654. ///
  655. /// Final note: there may be additional restrictions not yet specified.
  656. ///
  657. typedef enum _GX2SurfaceFormat
  658. {
  659.     /// color write performance relative to hardware peak write (x%)
  660.     /// texture read performance relative to hardware peak read (y%)
  661.     /// these numbers do not consider memory bandwidth limit
  662.     /// there are still some investigations for missing areas
  663.     GX2_SURFACE_FORMAT_INVALID                  = 0x00000000,
  664.     /// color write (100%), texture read (100%)
  665.     GX2_SURFACE_FORMAT_TC_R8_UNORM              = 0x00000001,
  666.     /// color write (50%), texture read (100%)
  667.     GX2_SURFACE_FORMAT_TC_R8_UINT               = 0x00000101,
  668.     /// color write (100%), texture read (100%)
  669.     GX2_SURFACE_FORMAT_TC_R8_SNORM              = 0x00000201,
  670.     /// color write (50%), texture read (100%)
  671.     GX2_SURFACE_FORMAT_TC_R8_SINT               = 0x00000301,
  672.     /// texture read (100%)
  673.     GX2_SURFACE_FORMAT_T_R4_G4_UNORM            = 0x00000002,
  674.     /// color write (50%), texture read (100%)
  675.     GX2_SURFACE_FORMAT_TCD_R16_UNORM            = 0x00000005,
  676.     /// color write (50%), texture read (100%)
  677.     GX2_SURFACE_FORMAT_TC_R16_UINT              = 0x00000105,
  678.     /// color write (50%), texture read (100%)
  679.     GX2_SURFACE_FORMAT_TC_R16_SNORM             = 0x00000205,
  680.     /// color write (50%), texture read (100%)
  681.     GX2_SURFACE_FORMAT_TC_R16_SINT              = 0x00000305,
  682.     /// color write (100%), texture read (100%)
  683.     GX2_SURFACE_FORMAT_TC_R16_FLOAT             = 0x00000806,
  684.     /// color write (100%), texture read (100%)
  685.     GX2_SURFACE_FORMAT_TC_R8_G8_UNORM           = 0x00000007,
  686.     /// color write (50%), texture read (100%)
  687.     GX2_SURFACE_FORMAT_TC_R8_G8_UINT            = 0x00000107,
  688.     /// color write (100%), texture read (100%)
  689.     GX2_SURFACE_FORMAT_TC_R8_G8_SNORM           = 0x00000207,
  690.     /// color write (50%), texture read (100%)
  691.     GX2_SURFACE_FORMAT_TC_R8_G8_SINT            = 0x00000307,
  692.     /// color write (100%), texture read (100%)
  693.     GX2_SURFACE_FORMAT_TCS_R5_G6_B5_UNORM       = 0x00000008,
  694.     /// color write (100%), texture read (100%)
  695.     GX2_SURFACE_FORMAT_TC_R5_G5_B5_A1_UNORM     = 0x0000000a,
  696.     /// color write (100%), texture read (100%)
  697.     GX2_SURFACE_FORMAT_TC_R4_G4_B4_A4_UNORM     = 0x0000000b,
  698.     /// color write (100%), texture read (100%)
  699.     GX2_SURFACE_FORMAT_TC_A1_B5_G5_R5_UNORM     = 0x0000000c, ///< flipped
  700.     /// color write (50%)
  701.     GX2_SURFACE_FORMAT_TC_R32_UINT              = 0x0000010d,
  702.     /// color write (50%)
  703.     GX2_SURFACE_FORMAT_TC_R32_SINT              = 0x0000030d,
  704.     /// color write (50%)
  705.     GX2_SURFACE_FORMAT_TCD_R32_FLOAT            = 0x0000080e,
  706.     /// color write (50%)
  707.     GX2_SURFACE_FORMAT_TC_R16_G16_UNORM         = 0x0000000f,
  708.     /// color write (50%)
  709.     GX2_SURFACE_FORMAT_TC_R16_G16_UINT          = 0x0000010f,
  710.     /// color write (50%)
  711.     GX2_SURFACE_FORMAT_TC_R16_G16_SNORM         = 0x0000020f,
  712.     /// color write (50%)
  713.     GX2_SURFACE_FORMAT_TC_R16_G16_SINT          = 0x0000030f,
  714.     /// color write (100%)
  715.     GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT         = 0x00000810,
  716.     GX2_SURFACE_FORMAT_D_D24_S8_UNORM           = 0x00000011, ///< note: same value as below
  717.     GX2_SURFACE_FORMAT_T_R24_UNORM_X8           = 0x00000011, ///< see Note 1
  718.     GX2_SURFACE_FORMAT_T_X24_G8_UINT            = 0x00000111, ///< see Note 1
  719.     GX2_SURFACE_FORMAT_D_D24_S8_FLOAT           = 0x00000811,
  720.     /// color write (100%)
  721.     GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT     = 0x00000816,
  722.     /// color write (100%)
  723.     GX2_SURFACE_FORMAT_TCS_R10_G10_B10_A2_UNORM = 0x00000019,
  724.     /// color write (50%)
  725.     GX2_SURFACE_FORMAT_TC_R10_G10_B10_A2_UINT   = 0x00000119,
  726.     /// color write (100%)
  727.     GX2_SURFACE_FORMAT_TC_R10_G10_B10_A2_SNORM  = 0x00000219, ///< A2 part is UNORM
  728.     /// color write (50%)
  729.     GX2_SURFACE_FORMAT_TC_R10_G10_B10_A2_SINT   = 0x00000319,
  730.     /// color write (100%)
  731.     GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM    = 0x0000001a,
  732.     /// color write (50%)
  733.     GX2_SURFACE_FORMAT_TC_R8_G8_B8_A8_UINT      = 0x0000011a,
  734.     /// color write (100%)
  735.     GX2_SURFACE_FORMAT_TC_R8_G8_B8_A8_SNORM     = 0x0000021a,
  736.     /// color write (50%)
  737.     GX2_SURFACE_FORMAT_TC_R8_G8_B8_A8_SINT      = 0x0000031a,
  738.     /// color write (100%)
  739.     GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB     = 0x0000041a,
  740.     /// color write (100%)
  741.     GX2_SURFACE_FORMAT_TCS_A2_B10_G10_R10_UNORM = 0x0000001b, ///< flipped
  742.     /// color write (50%)
  743.     GX2_SURFACE_FORMAT_TC_A2_B10_G10_R10_UINT   = 0x0000011b, ///< flipped
  744.     GX2_SURFACE_FORMAT_D_D32_FLOAT_S8_UINT_X24  = 0x0000081c, ///< note: same value as below
  745.     GX2_SURFACE_FORMAT_T_R32_FLOAT_X8_X24       = 0x0000081c, ///< note: same value as above
  746.     GX2_SURFACE_FORMAT_T_X32_G8_UINT_X24        = 0x0000011c, ///< see Note 2
  747.     /// color write (50%)
  748.     GX2_SURFACE_FORMAT_TC_R32_G32_UINT          = 0x0000011d,
  749.     /// color write (50%)
  750.     GX2_SURFACE_FORMAT_TC_R32_G32_SINT          = 0x0000031d,
  751.     /// color write (50%)
  752.     GX2_SURFACE_FORMAT_TC_R32_G32_FLOAT         = 0x0000081e,
  753.     /// color write (50%)
  754.     GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_UNORM = 0x0000001f,
  755.     /// color write (50%)
  756.     GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_UINT  = 0x0000011f,
  757.     /// color write (50%)
  758.     GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_SNORM = 0x0000021f,
  759.     /// color write (50%)
  760.     GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_SINT  = 0x0000031f,
  761.     /// color write (50%)
  762.     GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT = 0x00000820,
  763.     /// color write (25%)
  764.     GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_UINT  = 0x00000122,
  765.     /// color write (25%)
  766.     GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_SINT  = 0x00000322,
  767.     /// color write (25%)
  768.     GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT = 0x00000823,
  769.     /// texture read (100%)
  770.     GX2_SURFACE_FORMAT_T_BC1_UNORM              = 0x00000031,
  771.     /// texture read (100%)
  772.     GX2_SURFACE_FORMAT_T_BC1_SRGB               = 0x00000431,
  773.     /// texture read (100%)
  774.     GX2_SURFACE_FORMAT_T_BC2_UNORM              = 0x00000032,
  775.     /// texture read (100%)
  776.     GX2_SURFACE_FORMAT_T_BC2_SRGB               = 0x00000432,
  777.     /// texture read (100%)
  778.     GX2_SURFACE_FORMAT_T_BC3_UNORM              = 0x00000033,
  779.     /// texture read (100%)
  780.     GX2_SURFACE_FORMAT_T_BC3_SRGB               = 0x00000433,
  781.     /// texture read (100%)
  782.     GX2_SURFACE_FORMAT_T_BC4_UNORM              = 0x00000034,
  783.     /// texture read (100%)
  784.     GX2_SURFACE_FORMAT_T_BC4_SNORM              = 0x00000234,
  785.     /// texture read (100%)
  786.     GX2_SURFACE_FORMAT_T_BC5_UNORM              = 0x00000035,
  787.     /// texture read (100%)
  788.     GX2_SURFACE_FORMAT_T_BC5_SNORM              = 0x00000235,
  789.     /// texture read (100%)
  790.     GX2_SURFACE_FORMAT_T_NV12_UNORM             = 0x00000081, ///< see Note 3
  791.     GX2_SURFACE_FORMAT_FIRST                    = GX2_SURFACE_FORMAT_TC_R8_UNORM,
  792.     GX2_SURFACE_FORMAT_LAST                     = 0x0000083f
  793. } GX2SurfaceFormat;
  794.  
  795. /// \brief Indicates the desired tiling mode for a surface
  796. ///
  797. /// You should use only DEFAULT in most cases.
  798. /// \note: Don't use other modes unless you know what you're doing!
  799. ///
  800. typedef enum _GX2TileMode
  801. {
  802.     GX2_TILE_MODE_DEFAULT        = 0x00000000, // driver will choose best mode
  803.     GX2_TILE_MODE_LINEAR_SPECIAL = 0x00000010, // typically not supported by HW
  804.     GX2_TILE_MODE_LINEAR_ALIGNED = 0x00000001, // supported by HW, but not fast
  805.     GX2_TILE_MODE_1D_TILED_THIN1 = 0x00000002,
  806.     GX2_TILE_MODE_1D_TILED_THICK = 0x00000003,
  807.     GX2_TILE_MODE_2D_TILED_THIN1 = 0x00000004, // (a typical default, but not always)
  808.     GX2_TILE_MODE_2D_TILED_THIN2 = 0x00000005,
  809.     GX2_TILE_MODE_2D_TILED_THIN4 = 0x00000006,
  810.     GX2_TILE_MODE_2D_TILED_THICK = 0x00000007,
  811.     GX2_TILE_MODE_2B_TILED_THIN1 = 0x00000008,
  812.     GX2_TILE_MODE_2B_TILED_THIN2 = 0x00000009,
  813.     GX2_TILE_MODE_2B_TILED_THIN4 = 0x0000000a,
  814.     GX2_TILE_MODE_2B_TILED_THICK = 0x0000000b,
  815.     GX2_TILE_MODE_3D_TILED_THIN1 = 0x0000000c,
  816.     GX2_TILE_MODE_3D_TILED_THICK = 0x0000000d,
  817.     GX2_TILE_MODE_3B_TILED_THIN1 = 0x0000000e,
  818.     GX2_TILE_MODE_3B_TILED_THICK = 0x0000000f,
  819.     GX2_TILE_MODE_FIRST          = GX2_TILE_MODE_DEFAULT,
  820.     GX2_TILE_MODE_LAST           = GX2_TILE_MODE_LINEAR_SPECIAL
  821. } GX2TileMode;
  822.  
  823. /// \brief Indicates how a given surface may be used.
  824. ///
  825. /// A "final" TV render target is one that will be copied to a TV scan buffer.
  826. /// It needs to be designated to handle certain display corner cases.
  827. /// (When a HD surface must be scaled down to display in NTSC/PAL.)
  828. ///
  829. typedef enum _GX2SurfaceUse
  830. {
  831.     GX2_SURFACE_USE_TEXTURE                  = 0x001,
  832.     GX2_SURFACE_USE_COLOR_BUFFER             = 0x002,
  833.     GX2_SURFACE_USE_DEPTH_BUFFER             = 0x004,
  834.  
  835.     GX2_SURFACE_USE_SCAN_BUFFER              = 0x008,   // internal use only
  836.     GX2_SURFACE_USE_FTV                      = (1<<31), // modifier, designates a final TV render target
  837.     //** If changing or adding flags, ensure they match up / don't clash with GX2RResourceFlags
  838.  
  839.     GX2_SURFACE_USE_COLOR_BUFFER_TEXTURE     = GX2_SURFACE_USE_COLOR_BUFFER | GX2_SURFACE_USE_TEXTURE,
  840.     GX2_SURFACE_USE_DEPTH_BUFFER_TEXTURE     = GX2_SURFACE_USE_DEPTH_BUFFER | GX2_SURFACE_USE_TEXTURE,
  841.  
  842.     GX2_SURFACE_USE_COLOR_BUFFER_FTV         = GX2_SURFACE_USE_COLOR_BUFFER | GX2_SURFACE_USE_FTV,
  843.     GX2_SURFACE_USE_COLOR_BUFFER_TEXTURE_FTV = GX2_SURFACE_USE_COLOR_BUFFER_TEXTURE | GX2_SURFACE_USE_FTV,
  844.  
  845.     GX2_SURFACE_USE_FIRST                    = GX2_SURFACE_USE_TEXTURE,
  846.     GX2_SURFACE_USE_LAST                     = GX2_SURFACE_USE_SCAN_BUFFER // note: without modifiers!
  847. } GX2SurfaceUse;
  848.  
  849. /// \brief Indicates the "shape" of a given surface or texture.
  850. ///
  851. typedef enum _GX2SurfaceDim
  852. {
  853.     GX2_SURFACE_DIM_1D            = 0x000,
  854.     GX2_SURFACE_DIM_2D            = 0x001,
  855.     GX2_SURFACE_DIM_3D            = 0x002,
  856.     GX2_SURFACE_DIM_CUBE          = 0x003,
  857.     GX2_SURFACE_DIM_1D_ARRAY      = 0x004,
  858.     GX2_SURFACE_DIM_2D_ARRAY      = 0x005,
  859.     GX2_SURFACE_DIM_2D_MSAA       = 0x006,
  860.     GX2_SURFACE_DIM_2D_MSAA_ARRAY = 0x007,
  861.     GX2_SURFACE_DIM_FIRST         = GX2_SURFACE_DIM_1D,
  862.     GX2_SURFACE_DIM_LAST          = GX2_SURFACE_DIM_2D_MSAA_ARRAY
  863. } GX2SurfaceDim;
  864.  
  865. /// \brief Indicates the AA mode (number of samples) for a surface.
  866. ///
  867. typedef enum _GX2AAMode
  868. {
  869.     GX2_AA_MODE_1X    = 0x000,
  870.     GX2_AA_MODE_2X    = 0x001,
  871.     GX2_AA_MODE_4X    = 0x002,
  872.     GX2_AA_MODE_8X    = 0x003,
  873.     GX2_AA_MODE_FIRST = GX2_AA_MODE_1X,
  874.     GX2_AA_MODE_LAST  = GX2_AA_MODE_8X
  875. } GX2AAMode;
  876.  
  877. // ----------------------------- //
  878. // Texture Sampler options
  879.  
  880. /// \brief Indicates how to treat texture coordinates outside of [0...1] range.
  881. ///
  882. typedef enum _GX2TexClamp
  883. {
  884.     GX2_TEX_CLAMP_WRAP                    = 0, ///< repeat
  885.     GX2_TEX_CLAMP_MIRROR                  = 1, ///< mirrored repeat
  886.     GX2_TEX_CLAMP_CLAMP                   = 2, ///< clamps at the last texel value
  887.     GX2_TEX_CLAMP_MIRROR_ONCE             = 3, ///< mirrors once, then clamps like previous option
  888.     GX2_TEX_CLAMP_CLAMP_HALF_BORDER       = 4, ///< clamps: values outside are part border, part last texel
  889.     GX2_TEX_CLAMP_MIRROR_ONCE_HALF_BORDER = 5, ///< mirrors once, then clamps like previous option
  890.     GX2_TEX_CLAMP_CLAMP_BORDER            = 6, ///< clamps: values outside may be 100% border
  891.     GX2_TEX_CLAMP_MIRROR_ONCE_BORDER      = 7, ///< mirrors once, then clamps like previous option
  892.     GX2_TEX_CLAMP_FIRST  = GX2_TEX_CLAMP_WRAP,
  893.     GX2_TEX_CLAMP_LAST   = GX2_TEX_CLAMP_MIRROR_ONCE_BORDER
  894. } GX2TexClamp;
  895.  
  896. /// \brief Indicates type of border color to use.
  897. /// \note It's better to avoid using the register color type, as setting
  898. /// those registers requires a pipeline stall.
  899. ///
  900. typedef enum _GX2TexBorderType
  901. {
  902.     GX2_TEX_BORDER_CLEAR_BLACK  = 0, ///< RGBA = (0.0, 0.0, 0.0, 0.0)
  903.     GX2_TEX_BORDER_SOLID_BLACK  = 1, ///< RGBA = (0.0, 0.0, 0.0, 1.0)
  904.     GX2_TEX_BORDER_SOLID_WHITE  = 2, ///< RGBA = (1.0, 1.0, 1.0, 1.0)
  905.     GX2_TEX_BORDER_USE_REGISTER = 3, ///< RGBA specified using register
  906.     GX2_TEX_BORDER_FIRST  = GX2_TEX_BORDER_CLEAR_BLACK,
  907.     GX2_TEX_BORDER_LAST   = GX2_TEX_BORDER_USE_REGISTER
  908. } GX2TexBorderType;
  909.  
  910. /// \brief Indicates desired texture filter option within a plane.
  911. ///
  912. typedef enum _GX2TexXYFilterType
  913. {
  914.     GX2_TEX_XY_FILTER_POINT    = 0,
  915.     GX2_TEX_XY_FILTER_BILINEAR = 1,
  916.     GX2_TEX_XY_FILTER_FIRST    = GX2_TEX_XY_FILTER_POINT,
  917.     GX2_TEX_XY_FILTER_LAST     = GX2_TEX_XY_FILTER_BILINEAR
  918. } GX2TexXYFilterType;
  919.  
  920. /// \brief Indicates desired texture filter option between Z planes.
  921. ///
  922. typedef enum _GX2TexZFilterType
  923. {
  924.     GX2_TEX_Z_FILTER_USE_XY = 0, // use same as XY filter modes
  925.     GX2_TEX_Z_FILTER_POINT  = 1, // (default)
  926.     GX2_TEX_Z_FILTER_LINEAR = 2, // note: slower than POINT
  927.     GX2_TEX_Z_FILTER_FIRST  = GX2_TEX_Z_FILTER_USE_XY,
  928.     GX2_TEX_Z_FILTER_LAST   = GX2_TEX_Z_FILTER_LINEAR
  929. } GX2TexZFilterType;
  930.  
  931. /// \brief Indicates desired texture filter option between mip levels.
  932. ///
  933. typedef enum _GX2TexMipFilterType
  934. {
  935.     GX2_TEX_MIP_FILTER_NO_MIP = 0, // disable mipmapping (use base level only)
  936.     GX2_TEX_MIP_FILTER_POINT  = 1, // (default)
  937.     GX2_TEX_MIP_FILTER_LINEAR = 2, // note: slower than POINT
  938.     GX2_TEX_MIP_FILTER_FIRST  = GX2_TEX_MIP_FILTER_NO_MIP,
  939.     GX2_TEX_MIP_FILTER_LAST   = GX2_TEX_MIP_FILTER_LINEAR
  940. } GX2TexMipFilterType;
  941.  
  942. /// \brief Indicates desired performance option for (linear) Z filtering.
  943. /// If enabled, the Z fractional bits go through a lookup table to adjust
  944. /// the performance/quality trade-off.
  945. ///
  946. typedef enum _GX2TexZPerfType
  947. {
  948.     // TODO: come up with better names to describe trade-offs
  949.     GX2_TEX_Z_PERF_0 = 0, // disabled: no changes (default)
  950.     GX2_TEX_Z_PERF_1 = 1, // use lookup table 1
  951.     GX2_TEX_Z_PERF_2 = 2, // use lookup table 2
  952.     GX2_TEX_Z_PERF_3 = 3, // use lookup table 3
  953.     GX2_TEX_Z_PERF_FIRST = GX2_TEX_Z_PERF_0,
  954.     GX2_TEX_Z_PERF_LAST  = GX2_TEX_Z_PERF_3
  955. } GX2TexZPerfType;
  956.  
  957. /// \brief Indicates desired performance option for (linear) mip filtering.
  958. /// If enabled, the mip LOD fractional bits go through a lookup table to adjust
  959. /// the performance/quality trade-off.
  960. ///
  961. typedef enum _GX2TexMipPerfType
  962. {
  963.     // TODO: come up with better names to describe trade-offs
  964.     GX2_TEX_MIP_PERF_0 = 0, // disabled: no changes (default)
  965.     GX2_TEX_MIP_PERF_1 = 1, // use lookup table 1
  966.     GX2_TEX_MIP_PERF_2 = 2, // use lookup table 2
  967.     GX2_TEX_MIP_PERF_3 = 3, // use lookup table 3
  968.     GX2_TEX_MIP_PERF_4 = 4, // use lookup table 4
  969.     GX2_TEX_MIP_PERF_5 = 5, // use lookup table 5
  970.     GX2_TEX_MIP_PERF_6 = 6, // use lookup table 6
  971.     GX2_TEX_MIP_PERF_7 = 7, // use lookup table 7
  972.     GX2_TEX_MIP_PERF_FIRST = GX2_TEX_MIP_PERF_0,
  973.     GX2_TEX_MIP_PERF_LAST  = GX2_TEX_MIP_PERF_7
  974. } GX2TexMipPerfType;
  975.  
  976. /// \brief Indicates maximum desired anisotropic filter ratio.
  977. /// Higher ratios give better image quality, but slower performance.
  978. ///
  979. typedef enum _GX2TexAnisoRatio
  980. {
  981.     GX2_TEX_ANISO_1_TO_1  = 0, // disables anisotropic filtering
  982.     GX2_TEX_ANISO_2_TO_1  = 1, // 2:1
  983.     GX2_TEX_ANISO_4_TO_1  = 2, // 4:1
  984.     GX2_TEX_ANISO_8_TO_1  = 3, // 8:1
  985.     GX2_TEX_ANISO_16_TO_1 = 4, // 16:1
  986.     GX2_TEX_ANISO_FIRST = GX2_TEX_ANISO_1_TO_1,
  987.     GX2_TEX_ANISO_LAST  = GX2_TEX_ANISO_16_TO_1
  988. } GX2TexAnisoRatio;
  989.  
  990. // -----------------------------------------------------------------------------
  991. // Enums - Display / Scan-out
  992.  
  993. /// \brief Describes actual video output from the TV encoder.
  994. ///
  995. /// This is read-only from the system settings.
  996. ///
  997. typedef enum _GX2TVScanMode
  998. {
  999.     GX2_TV_SCAN_MODE_NONE, // TV output is disabled
  1000.     GX2_TV_SCAN_MODE_576I, // Just to let users know that it is PAL
  1001.     GX2_TV_SCAN_MODE_480I,
  1002.     GX2_TV_SCAN_MODE_480P,
  1003.     GX2_TV_SCAN_MODE_720P,
  1004.     GX2_TV_SCAN_MODE_RESERVED,
  1005.     GX2_TV_SCAN_MODE_1080I,
  1006.     GX2_TV_SCAN_MODE_1080P,
  1007.     GX2_TV_SCAN_MODE_FIRST = GX2_TV_SCAN_MODE_NONE,
  1008.     GX2_TV_SCAN_MODE_LAST  = GX2_TV_SCAN_MODE_1080P
  1009. } GX2TVScanMode;
  1010.  
  1011. /// \brief Describes user-setting for TV aspect ratio.
  1012. /// It should only be relevant for 480I/480P.
  1013. ///
  1014. /// This is read-only from the system settings.
  1015. ///
  1016. typedef enum _GX2AspectRatio
  1017. {
  1018.     GX2_ASPECT_RATIO_4_BY_3,
  1019.     GX2_ASPECT_RATIO_16_BY_9,
  1020.     GX2_ASPECT_RATIO_FIRST = GX2_ASPECT_RATIO_4_BY_3,
  1021.     GX2_ASPECT_RATIO_LAST  = GX2_ASPECT_RATIO_16_BY_9
  1022. } GX2AspectRatio;
  1023.  
  1024. /// \brief Used to describe both the current DRC set up
  1025. /// as well as desired DRC buffering set up.
  1026. ///
  1027. typedef enum _GX2DRCMode
  1028. {
  1029.     GX2_DRC_NONE        = 0,
  1030.     GX2_DRC_SINGLE      = 1, // 60Hz
  1031.     GX2_DRC_DOUBLE      = 2, // 30Hz
  1032.     GX2_DRC_SINGLE_30HZ = 3,
  1033.     GX2_DRC_FIRST       = GX2_DRC_NONE,
  1034.     GX2_DRC_LAST        = GX2_DRC_SINGLE_30HZ
  1035. } GX2DRCMode;
  1036.  
  1037. /// \brief Used to describe scan buffer setup for TV.
  1038. /// (used mainly to reserve framebuffer memory)
  1039. ///
  1040. typedef enum _GX2TVRenderMode
  1041. {
  1042.     GX2_TV_RENDER_NONE,         // TV output is unused
  1043.     GX2_TV_RENDER_480_NARROW,   // 4:3 ratio (640x480)
  1044.     GX2_TV_RENDER_480_WIDE,     // 16:9 ratio (854x480)
  1045.     GX2_TV_RENDER_720,          // 16:9 for all the rest...
  1046.     GX2_TV_RENDER_RESERVED,
  1047.     GX2_TV_RENDER_1080,
  1048.     GX2_TV_RENDER_FIRST = GX2_TV_RENDER_NONE,
  1049.     GX2_TV_RENDER_LAST  = GX2_TV_RENDER_1080
  1050. } GX2TVRenderMode;
  1051.  
  1052. /// \brief Specify the buffering mode.
  1053. ///
  1054. /// \note: Uncertain if this will remain.
  1055. ///
  1056. typedef enum _GX2BufferingMode
  1057. {
  1058.     GX2_BUFFERING_SINGLE = 1,     // Just for debug
  1059.     GX2_BUFFERING_DOUBLE = 2,
  1060.     GX2_BUFFERING_TRIPLE = 3,
  1061.     GX2_BUFFERING_QUAD   = 4,
  1062.     GX2_BUFFERING_FIRST  = GX2_BUFFERING_SINGLE,
  1063.     GX2_BUFFERING_LAST   = GX2_BUFFERING_QUAD
  1064. } GX2BufferingMode;
  1065.  
  1066. /// \brief Used to describe where to copy renderbuffers to.
  1067. ///
  1068. /// \todo Adjust as necessary.
  1069. ///
  1070. typedef enum _GX2ScanTarget
  1071. {
  1072.     GX2_SCAN_TARGET_TV         = 0x1,
  1073.     GX2_SCAN_TARGET_TV_LEFT    = 0x1, // same as above
  1074.     GX2_SCAN_TARGET_TV_RIGHT   = 0x2,
  1075.     GX2_SCAN_TARGET_DRC_FIRST  = 0x4,
  1076.     GX2_SCAN_TARGET_DRC_SECOND = 0x8,
  1077.     GX2_SCAN_TARGET_FIRST      = GX2_SCAN_TARGET_TV,
  1078.     GX2_SCAN_TARGET_LAST       = GX2_SCAN_TARGET_DRC_SECOND
  1079. } GX2ScanTarget;
  1080.  
  1081. /// \brief indicate which hint is valid
  1082. ///
  1083. typedef enum _GX2DRCEncodingHint
  1084. {
  1085.     GX2_DRC_ENCODING_INVALLIDATE        = 0x1, ///< (1) invalidates GX2_DRC_ENCODING_MOTION_VECTOR and refresh DRC screen by I-frame
  1086.     GX2_DRC_ENCODING_MOTION_VECTOR      = 0x4, ///< (4) Motion vector
  1087.     GX2_DRC_ENCODING_FIRST              = GX2_DRC_ENCODING_INVALLIDATE,
  1088.     GX2_DRC_ENCODING_LAST               = GX2_DRC_ENCODING_MOTION_VECTOR
  1089. } GX2DRCEncodingHint;
  1090.  
  1091. // -----------------------------------------------------------------------------
  1092. // Enums - Manage
  1093.  
  1094. /// \brief What point in the graphics pipe should a time-stamp event happen?
  1095. ///
  1096. typedef enum _GX2PipeEvent  {
  1097.     GX2_PIPE_EVENT_TOP,                ///< top of pipe
  1098.     GX2_PIPE_EVENT_BOTTOM,             ///< bottom after reads done, before writes are flushed
  1099.     GX2_PIPE_EVENT_BOTTOM_AFTER_FLUSH, ///< bottom after GPU cache flush & invalidate
  1100.     GX2_PIPE_EVENT_LAST = GX2_PIPE_EVENT_BOTTOM_AFTER_FLUSH
  1101. } GX2PipeEvent;
  1102.  
  1103. /// \brief Type of user callback event for interrupts
  1104. ///
  1105. typedef enum _GX2CallbackEvent {
  1106.     GX2_CB_EVENT_USER_TS_TOP,     ///< results from user timestamp (top of pipe) interrupt
  1107.     GX2_CB_EVENT_USER_TS_BOTTOM,  ///< results from user timestamp (bottom of pipe) interrupt
  1108.     GX2_CB_EVENT_VSYNC,           ///< results from 60hz vsync
  1109.     GX2_CB_EVENT_FLIP,            ///< results from scan buffer flipping
  1110.     GX2_CB_EVENT_LAST = GX2_CB_EVENT_FLIP
  1111. } GX2CallbackEvent;
  1112.  
  1113. /// \brief Type of GX2 semaphore action
  1114. ///
  1115. typedef enum _GX2SemaphoreAction {
  1116.     GX2_SEMAPHORE_WAIT   = 0,   ///< Wait before processing next command
  1117.     GX2_SEMAPHORE_SIGNAL = 1    ///< Signal after all previous work is done
  1118. } GX2SemaphoreAction;
  1119.  
  1120. // -----------------------------------------------------------------------------
  1121. // Enums - Misc
  1122.  
  1123. /// \brief Specifies the type of object being flushed or invalidated.
  1124. ///
  1125. typedef enum _GX2InvalidateType
  1126. {
  1127.     GX2_INVALIDATE_ATTRIB_BUFFER   = 0x01, // invalidate input caches. main memory read is forced next time
  1128.     GX2_INVALIDATE_TEXTURE         = 0x02, // invalidate input caches. main memory read is forced next time
  1129.     GX2_INVALIDATE_UNIFORM_BLOCK    = 0x04, // invalidate input caches. main memory read is forced next time
  1130.     GX2_INVALIDATE_SHADER          = 0x08, // invalidate input caches. main memory read is forced next time
  1131.     GX2_INVALIDATE_COLOR_BUFFER    = 0x10, // flush color buffer 0-7's cache into main memory
  1132.     GX2_INVALIDATE_DEPTH_BUFFER    = 0x20, // flush depth buffer's cache into main memory
  1133.     GX2_INVALIDATE_CPU             = 0x40, // just flush cpu cache into main memory
  1134.     GX2_INVALIDATE_STREAMOUT_BUFFER = 0x80, // flush and invalidate the stream out buffer caches into main memory
  1135.  
  1136.     // For convenience, invalidate CPU cache & GPU (input) item together:
  1137.     GX2_INVALIDATE_CPU_ATTRIB_BUFFER
  1138.         = GX2_INVALIDATE_ATTRIB_BUFFER   | GX2_INVALIDATE_CPU,
  1139.     GX2_INVALIDATE_CPU_TEXTURE
  1140.         = GX2_INVALIDATE_TEXTURE         | GX2_INVALIDATE_CPU,
  1141.     GX2_INVALIDATE_CPU_UNIFORM_BLOCK
  1142.         = GX2_INVALIDATE_UNIFORM_BLOCK   | GX2_INVALIDATE_CPU,
  1143.     GX2_INVALIDATE_CPU_SHADER
  1144.         = GX2_INVALIDATE_SHADER          | GX2_INVALIDATE_CPU,
  1145.  
  1146.     GX2_INVALIDATE_CONSTANT_BUFFER  = 0x04, // deprecated name
  1147.     GX2_INVALIDATE_CPU_CONSTANT_BUFFER      // deprecated name
  1148.         = GX2_INVALIDATE_CONSTANT_BUFFER | GX2_INVALIDATE_CPU,
  1149.  
  1150.     GX2_INVALIDATE_FIRST          = GX2_INVALIDATE_ATTRIB_BUFFER,
  1151.     GX2_INVALIDATE_LAST           = 0xff
  1152. } GX2InvalidateType;
  1153.  
  1154. /// \brief Specify possible debug options for processing graphics commands.
  1155. ///
  1156. typedef enum _GX2DebugMode
  1157. {
  1158.     GX2_DEBUG_MODE_NONE                     = 0x00, // debug off
  1159.     GX2_DEBUG_MODE_FLUSH_PER_DRAW           = 0x01, // perform flush after each draw
  1160.     GX2_DEBUG_MODE_DONE_PER_FLUSH           = 0x02, // perform DrawDone after each flush
  1161.     GX2_DEBUG_MODE_FIRST                    = 0x00,
  1162.     GX2_DEBUG_MODE_LAST                     = 0x03
  1163. } GX2DebugMode;
  1164.  
  1165. /// \brief Specify possible profiling options to force off features in the graphics pipeline
  1166. ///
  1167. typedef enum _GX2ProfileMode
  1168. {
  1169.     GX2_PROFILE_MODE_NONE                     = 0x00000, ///< (0x00000) None of the options below
  1170.     GX2_PROFILE_MODE_INFINITELY_FAST_HARDWARE = 0x00001, ///< (0x00001) Command buffer are built in GX2, but they are not dispatched to the HW
  1171.     GX2_PROFILE_MODE_WIREFRAME                = 0x00002, ///< (0x00002) Render everything in wireframe mode
  1172.     GX2_PROFILE_MODE_DISABLE_ALPHABLEND       = 0x00004, ///< (0x00004) Force off color buffer reads
  1173.     GX2_PROFILE_MODE_DISABLE_COLORWRITES      = 0x00008, ///< (0x00008) Force off color buffer writes
  1174.     GX2_PROFILE_MODE_DISABLE_COLOR            = 0x00010, ///< (0x00010) Disable color buffer reads and writes
  1175.     GX2_PROFILE_MODE_MIN_VERTEX_SHADER        = 0x00020, ///< (0x00020) Always execute a minimal vertex shader
  1176.     GX2_PROFILE_MODE_MIN_GEOMETRY_SHADER      = 0x00040, ///< (0x00040) Always execute a minimal geometry shader
  1177.     GX2_PROFILE_MODE_MIN_PIXEL_SHADER         = 0x00080, ///< (0x00080) Always execute a minimal pixel shader
  1178.     GX2_PROFILE_MODE_MIN_VERTEX_FETCH         = 0x00100, ///< (0x00100) Force all vertex fetches from the cache, the stride is set to 0.
  1179.     GX2_PROFILE_MODE_MIN_TEXTURE_FETCH        = 0x00200, ///< (0x00200) Force all textures to 1 mip level with a 1x1 size
  1180.     GX2_PROFILE_MODE_DISABLE_Z                = 0x00400, ///< (0x00400) Force off Z buffering, no Z buffer reads or writes
  1181.     GX2_PROFILE_MODE_DISABLE_ZWRITES          = 0x00800, ///< (0x00800) Force off Z writes
  1182.     GX2_PROFILE_MODE_DISABLE_STENCIL          = 0x01000, ///< (0x01000) Force off stenciling, no reads or writes from the stencil buffer
  1183.     GX2_PROFILE_MODE_DISABLE_TRILINEAR        = 0x02000, ///< (0x02000) Force off trilinear texture filtering
  1184.     GX2_PROFILE_MODE_DISABLE_ANISO            = 0x04000, ///< (0x04000) Force off anisotropic texture filtering
  1185.     GX2_PROFILE_MODE_DISABLE_COLOR_CLEARS     = 0x08000, ///< (0x08000) Disable color clears
  1186.     GX2_PROFILE_MODE_DISABLE_Z_CLEARS         = 0x10000, ///< (0x10000) Disable Z clears
  1187.     GX2_PROFILE_MODE_DISABLE_STENCIL_CLEARS   = 0x20000, ///< (0x20000) Disable stencil clears
  1188.     GX2_PROFILE_MODE_DISABLE_EARLY_Z          = 0x40000, ///< (0x40000) Only use late Z (when Z is enabled)
  1189.     GX2_PROFILE_MODE_FIRST                    = 0x00000,
  1190.     GX2_PROFILE_MODE_LAST                     = 0x7ffff
  1191. } GX2ProfileMode;
  1192.  
  1193. /// \brief Define different toss points within the graphics pipeline.  A toss point is a stage in
  1194. /// the pipeline were all operations that follow are disabled.
  1195. ///
  1196. typedef enum _GX2TossStage
  1197. {
  1198.     GX2_TOSS_STAGE_NONE                  = 0, ///< (0) Full pipeline is enabled
  1199.     GX2_TOSS_STAGE_AFTER_VERTEX_FETCH    = 1, ///< (1) Vertex fetch only, the rest of the graphics pipeline is disabled
  1200.     GX2_TOSS_STAGE_AFTER_VERTEX_SHADER   = 2, ///< (2) Vertex fetch and vertex shader only
  1201.     GX2_TOSS_STAGE_AFTER_GEOMETRY_SHADER = 3, ///< (3) Vertex fetch, vertex shader, and geometry shader are enabled. The rasterizer (including clipping) is disabled
  1202.     GX2_TOSS_STAGE_AFTER_CLIPPING        = 4, ///< (4) Enable vertex processing, geometry shader and clipping. All primitives will be culled after clipping
  1203.     GX2_TOSS_STAGE_AFTER_PRIMITIVE_SETUP = 5, ///< (5) Enable vertex processing, geometry shader, clipping and primitive setup, but rasterization is disabled
  1204.     GX2_TOSS_STAGE_AFTER_SCAN_CONVERSION = 6, ///< (6) Scan conversion, HiZ, and Early Z, but no parameter interpolation
  1205.     GX2_TOSS_STAGE_AFTER_RASTERIZATION   = 7, ///< (7) Full rasterization, but pixel shader is disabled
  1206.     GX2_TOSS_STAGE_AFTER_PIXEL_SHADER    = 8, ///< (8) Full rasterization and pixel shader, but color buffer reads and writes are disabled
  1207.     GX2_TOSS_STAGE_FIRST              = GX2_TOSS_STAGE_NONE,
  1208.     GX2_TOSS_STAGE_LAST               = GX2_TOSS_STAGE_AFTER_PIXEL_SHADER
  1209. } GX2TossStage;
  1210.  
  1211.  
  1212. /// \brief  Specify the endian swap mode
  1213. typedef enum _GX2EndianSwapMode
  1214. {
  1215.     GX2_ENDIANSWAP_NONE    = 0, ///< No endian swap
  1216.     GX2_ENDIANSWAP_8IN16   = 1, ///< 8 in 16 swap
  1217.     GX2_ENDIANSWAP_8IN32   = 2, ///< 8 in 32 swap
  1218.     GX2_ENDIANSWAP_DEFAULT = 3,  ///< endian swap mode is determined based on the format
  1219.     GX2_ENDIANSWAP_FIRST   = GX2_ENDIANSWAP_NONE,
  1220.     GX2_ENDIANSWAP_LAST    = GX2_ENDIANSWAP_DEFAULT
  1221. } GX2EndianSwapMode;
  1222.  
  1223. /// \brief Specify tessellation type of mesh
  1224. ///
  1225. typedef enum _GX2TessellationMode {
  1226.     GX2_TESSELLATION_MODE_DISCRETE,
  1227.     GX2_TESSELLATION_MODE_CONTINUOUS,
  1228.     GX2_TESSELLATION_MODE_ADAPTIVE,
  1229.     GX2_TESSELLATION_MODE_FIRST      = GX2_TESSELLATION_MODE_DISCRETE,
  1230.     GX2_TESSELLATION_MODE_LAST       = GX2_TESSELLATION_MODE_ADAPTIVE
  1231. } GX2TessellationMode;
  1232.  
  1233. /// \brief Specify fetch shader type.
  1234. ///
  1235. typedef enum GX2FetchShaderType {
  1236.     GX2_FETCH_SHADER_TESSELATION_NONE      =  0x0,
  1237.     GX2_FETCH_SHADER_TESSELATION_LINES     =  0x1,
  1238.     GX2_FETCH_SHADER_TESSELATION_TRIANGLES =  0x2,
  1239.     GX2_FETCH_SHADER_TESSELATION_QUADS     =  0x3,
  1240.     GX2_FETCH_SHADER_TYPE_FIRST     =  GX2_FETCH_SHADER_TESSELATION_NONE,
  1241.     GX2_FETCH_SHADER_TYPE_LAST      =  GX2_FETCH_SHADER_TESSELATION_QUADS
  1242. } GX2FetchShaderType;
  1243.  
  1244. /// \brief Specify the query type.
  1245. ///
  1246. /// The CPU query types will be read by the CPU and are not available to be read by the GPU.
  1247. /// The GPU query types will be read by the GPU and are not available to be read by the CPU.
  1248. typedef enum _GX2QueryType
  1249. {
  1250.     GX2_QUERY_TYPE_OCCLUSION_CPU,        ///< depth-based occlusion CPU query
  1251.     GX2_QUERY_TYPE_STREAMOUT_STATS_CPU,  ///< stream-out buffer stats CPU query
  1252.     GX2_QUERY_TYPE_OCCLUSION_GPU,        ///< depth-based occlusion GPU query
  1253.     GX2_QUERY_TYPE_STREAMOUT_STATS_GPU,  ///< stream-out buffer stats GPU query
  1254.  
  1255.     GX2_QUERY_TYPE_FIRST          = GX2_QUERY_TYPE_OCCLUSION_CPU,
  1256.     GX2_QUERY_TYPE_LAST           = GX2_QUERY_TYPE_STREAMOUT_STATS_GPU
  1257. } GX2QueryType;
  1258.  
  1259. /// \brief Specify method of setting streamout offset.
  1260. ///
  1261. typedef enum _GX2StreamOutOffsetInit {
  1262.     GX2_STREAMOUT_OFFSET_READ_FROM_CONTEXT = 0x0,
  1263.     GX2_STREAMOUT_OFFSET_RESET    =  0x1,
  1264.     GX2_STREAMOUT_OFFSET_EXPLICIT =  0x2,
  1265. } GX2StreamOutOffsetInit;
  1266.  
  1267. // -----------------
  1268. // User Debug Alerts
  1269.  
  1270. /// \brief (Temporary Placeholder) UDA alert ids
  1271. ///
  1272. typedef enum _GX2UDAAlertID {
  1273.     GX2_UDAID_NOALERT               =  -1,
  1274.     GX2_UDAID_ENABLESTATESHADOWING  =   0,
  1275.     GX2_UDAID_LAST                  =   GX2_UDAID_ENABLESTATESHADOWING
  1276. } GX2UDAAlertID;
  1277.  
  1278. /// \brief (Temporary Placeholder) UDA alert levels
  1279. ///
  1280. typedef enum _GX2UDAAlertLevel
  1281. {
  1282.     GX2_UDALEVEL_NONE       = 0,    // Disable monitoring
  1283.     GX2_UDALEVEL_SEVERE     = 1,    // report usage that may cause hang
  1284.     GX2_UDALEVEL_ORDINARY   = 2,    // report usage that may cause incorrect results (includes SEVERE level)
  1285.     GX2_UDALEVEL_PEDANTIC   = 3,    // report usage that is not recommended (includes SEVERE and ORDINARY level)
  1286.     GX2_UDALEVEL_LAST       = GX2_UDALEVEL_PEDANTIC
  1287. } GX2UDAAlertLevel;
  1288.  
  1289. // -----------------
  1290. // GX2 Log
  1291.  
  1292. /// \brief Attributes to control GX2 Log function
  1293. ///
  1294. typedef enum _GXLogAttrib {
  1295.     GX2_LOG_ATTRIB_ENABLE, ///< Turn logging on or off
  1296.     GX2_LOG_ATTRIB_LAST   =   GX2_LOG_ATTRIB_ENABLE
  1297. } GX2LogAttrib;
  1298.  
  1299. // -----------------
  1300. // Capture related
  1301.  
  1302. /// Tag type for \ref GX2DebugTagUserString
  1303. typedef enum _GX2DebugTagUserStringType
  1304. {
  1305.   GX2_DEBUG_TAG_INDENT,
  1306.   GX2_DEBUG_TAG_UNDENT,
  1307.   GX2_DEBUG_TAG_COMMENT,
  1308.   GX2_DEBUG_TAG_BOOKMARK,
  1309.  
  1310.   GX2_DEBUG_TAG_FIRST=GX2_DEBUG_TAG_INDENT,
  1311.   GX2_DEBUG_TAG_LAST=GX2_DEBUG_TAG_BOOKMARK,
  1312. } GX2DebugTagUserStringType;
  1313.  
  1314. #define GX2_DEBUG_TAG_MAX_SIZE    1024
  1315.  
  1316. /// Options for \ref GX2DebugCaptureStart and \ref GX2DebugCaptureEnd
  1317. typedef enum _GX2DebugCaptureOptions
  1318. {
  1319.     GX2_DEBUG_CAPTURE_DEFAULT   =0,    ///< By default \ref GX2DebugCaptureStart calls GX2DrawDone to sync the GPU and flush any
  1320.                                        ///< previous commands before the capture starts, and \ref GX2DebugCaptureEnd calls GX2Flush
  1321.                                        ///< to capture the current CB before the capture finishes.
  1322.     GX2_DEBUG_CAPTURE_NO_FLUSH  =0x01, ///< Suppress GX2DrawDone/GX2Flush calls in \ref GX2DebugCaptureStart and \ref GX2DebugCaptureEnd
  1323. } GX2DebugCaptureOptions;
  1324.  
  1325. // -----------------
  1326. // Misc
  1327.  
  1328. /// Misc param selection
  1329. typedef enum _GX2MiscType
  1330. {
  1331.     GX2_MISC_HANG_STATE,              ///< Is the GPU ok or hung?
  1332.     GX2_MISC_HANG_RESPONSE,           ///< Action to take upon hang
  1333.     GX2_MISC_HANG_RESET_SWAP_TIMEOUT, ///< For auto-hang-detection+reset, time-out value (since last flip happened)
  1334.     GX2_MISC_HANG_RESET_SWAP_COUNT    ///< For auto-hang-detection+reset, max number of pending swaps permitted
  1335. } GX2MiscType;
  1336.  
  1337. /// Misc values for GPU Hang states
  1338. typedef enum _GX2HangState
  1339. {
  1340.     GX2_HANG_STATE_OK = 0,  ///< GPU is ok
  1341.     GX2_HANG_STATE_TS = 1,  ///< time-out waiting for time stamp
  1342.     GX2_HANG_STATE_CB = 2,  ///< time-out waiting for command buffer space
  1343.     GX2_HANG_STATE_RB = 3,  ///< time-out waiting for ring buffer space
  1344.     GX2_HANG_STATE_WF = 4,  ///< time-out waiting for scanbuffer flip
  1345.     GX2_HANG_STATE_ETC = 5, ///< GPU is hung based on other (user-set) condition
  1346. } GX2HangState;
  1347.  
  1348. /// Misc values for GPU Hang response
  1349. typedef enum _GX2HangResponse
  1350. {
  1351.     GX2_HANG_RESPONSE_NONE,  ///< Do nothing automatically
  1352.     GX2_HANG_RESPONSE_DEBUG, ///< Do a GPU state dump & infinite loop
  1353.     GX2_HANG_RESPONSE_RESET  ///< Do a GPU reset during GX2SwapScanBuffers
  1354. } GX2HangResponse;
  1355.  
  1356. /// @}
  1357.  
  1358. #ifdef __cplusplus
  1359. }
  1360. #endif // __cplusplus
  1361.  
  1362. #endif // _CAFE_GX2_ENUM_H_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement