+/** Compressed TexEnv effective Combine mode */
+enum gl_tex_env_mode
+{
+ TEXENV_MODE_REPLACE, /* r = a0 */
+ TEXENV_MODE_MODULATE, /* r = a0 * a1 */
+ TEXENV_MODE_ADD, /* r = a0 + a1 */
+ TEXENV_MODE_ADD_SIGNED, /* r = a0 + a1 - 0.5 */
+ TEXENV_MODE_INTERPOLATE, /* r = a0 * a2 + a1 * (1 - a2) */
+ TEXENV_MODE_SUBTRACT, /* r = a0 - a1 */
+ TEXENV_MODE_DOT3_RGB, /* r = a0 . a1 */
+ TEXENV_MODE_DOT3_RGB_EXT, /* r = a0 . a1 */
+ TEXENV_MODE_DOT3_RGBA, /* r = a0 . a1 */
+ TEXENV_MODE_DOT3_RGBA_EXT, /* r = a0 . a1 */
+ TEXENV_MODE_MODULATE_ADD_ATI, /* r = a0 * a2 + a1 */
+ TEXENV_MODE_MODULATE_SIGNED_ADD_ATI, /* r = a0 * a2 + a1 - 0.5 */
+ TEXENV_MODE_MODULATE_SUBTRACT_ATI, /* r = a0 * a2 - a1 */
+ TEXENV_MODE_ADD_PRODUCTS_NV, /* r = a0 * a1 + a2 * a3 */
+ TEXENV_MODE_ADD_PRODUCTS_SIGNED_NV, /* r = a0 * a1 + a2 * a3 - 0.5 */
+};
+
+
+/** Compressed TexEnv Combine source */
+enum gl_tex_env_source
+{
+ TEXENV_SRC_TEXTURE0,
+ TEXENV_SRC_TEXTURE1,
+ TEXENV_SRC_TEXTURE2,
+ TEXENV_SRC_TEXTURE3,
+ TEXENV_SRC_TEXTURE4,
+ TEXENV_SRC_TEXTURE5,
+ TEXENV_SRC_TEXTURE6,
+ TEXENV_SRC_TEXTURE7,
+ TEXENV_SRC_TEXTURE,
+ TEXENV_SRC_PREVIOUS,
+ TEXENV_SRC_PRIMARY_COLOR,
+ TEXENV_SRC_CONSTANT,
+ TEXENV_SRC_ZERO,
+ TEXENV_SRC_ONE,
+};
+
+
+/** Compressed TexEnv Combine operand */
+enum gl_tex_env_operand
+{
+ TEXENV_OPR_COLOR,
+ TEXENV_OPR_ONE_MINUS_COLOR,
+ TEXENV_OPR_ALPHA,
+ TEXENV_OPR_ONE_MINUS_ALPHA,
+};
+
+
+/** Compressed TexEnv Combine argument */
+struct gl_tex_env_argument
+{
+#ifdef __GNUC__
+ __extension__ uint8_t Source:4; /**< TEXENV_SRC_x */
+ __extension__ uint8_t Operand:2; /**< TEXENV_OPR_x */
+#else
+ uint8_t Source; /**< SRC_x */
+ uint8_t Operand; /**< OPR_x */
+#endif
+};
+
+
+/***
+ * Compressed TexEnv Combine state.
+ */
+struct gl_tex_env_combine_packed
+{
+ uint32_t ModeRGB:4; /**< Effective mode for RGB as 4 bits */
+ uint32_t ModeA:4; /**< Effective mode for RGB as 4 bits */
+ uint32_t ScaleShiftRGB:2; /**< 0, 1 or 2 */
+ uint32_t ScaleShiftA:2; /**< 0, 1 or 2 */
+ uint32_t NumArgsRGB:3; /**< Number of inputs used for the RGB combiner */
+ uint32_t NumArgsA:3; /**< Number of inputs used for the A combiner */
+ /** Source arguments in a packed manner */
+ struct gl_tex_env_argument ArgsRGB[MAX_COMBINER_TERMS];
+ struct gl_tex_env_argument ArgsA[MAX_COMBINER_TERMS];
+};
+
+