Fix Windows newlines.
[mesa.git] / src / mesa / shader / program_instruction.h
index 07a22145faabe2a7628e1ff189016b8f5deea023..93bcfc240a9e8a163f1f63588f3c15bdd2b45555 100644 (file)
@@ -54,7 +54,7 @@
 /*@}*/
 
 
-/*
+/**
  * Instruction precision for GL_NV_fragment_program
  */
 /*@{*/
 /*@}*/
 
 
+/**
+ * Saturation modes when storing values.
+ */
+/*@{*/
+#define SATURATE_OFF            0
+#define SATURATE_ZERO_ONE       1
+#define SATURATE_PLUS_MINUS_ONE 2
+/*@}*/
+
+
+/**
+ * Per-component negation masks
+ */
+/*@{*/
+#define NEGATE_X    0x1
+#define NEGATE_Y    0x2
+#define NEGATE_Z    0x4
+#define NEGATE_W    0x8
+#define NEGATE_XYZW 0xf
+#define NEGATE_NONE 0x0
+/*@}*/
+
+
 /**
  * Program instruction opcodes, for both vertex and fragment programs.
  * \note changes to this opcode list must be reflected in t_vb_arbprogram.c
  */
                      /* ARB_vp   ARB_fp   NV_vp   NV_fp */
 enum prog_opcode {   /*---------------------------------*/
-   OPCODE_ABS,       /*            X       1.1          */
+   OPCODE_ABS,       /*   X        X       1.1          */
    OPCODE_ADD,       /*   X        X       X       X    */
+   OPCODE_ARA,       /*                    2            */
    OPCODE_ARL,       /*   X                X            */
+   OPCODE_ARL_NV,    /*                    2            */
+   OPCODE_ARR,       /*                    2            */
+   OPCODE_BRA,       /*                    2            */
+   OPCODE_CAL,       /*                    2       2    */
    OPCODE_CMP,       /*            X                    */
-   OPCODE_COS,       /*   X                2            */
+   OPCODE_COS,       /*            X       2       X    */
    OPCODE_DDX,       /*                            X    */
    OPCODE_DDY,       /*                            X    */
    OPCODE_DP3,       /*   X        X       X       X    */
    OPCODE_DP4,       /*   X        X       X       X    */
    OPCODE_DPH,       /*   X        X       1.1          */
-   OPCODE_DST,       /*   X        X       X            */
+   OPCODE_DST,       /*   X        X       X       X    */
    OPCODE_END,       /*   X        X       X       X    */
    OPCODE_EX2,       /*   X        X       2       X    */
    OPCODE_EXP,       /*   X                X            */
@@ -90,7 +118,7 @@ enum prog_opcode {   /*---------------------------------*/
    OPCODE_KIL_NV,    /*                            X    */
    OPCODE_LG2,       /*   X        X       2       X    */
    OPCODE_LIT,       /*   X        X       X       X    */
-   OPCODE_LOG,       /*   X                X       X    */
+   OPCODE_LOG,       /*   X                X            */
    OPCODE_LRP,       /*            X               X    */
    OPCODE_MAD,       /*   X        X       X       X    */
    OPCODE_MAX,       /*   X        X       X       X    */
@@ -102,9 +130,12 @@ enum prog_opcode {   /*---------------------------------*/
    OPCODE_PK4B,      /*                            X    */
    OPCODE_PK4UB,     /*                            X    */
    OPCODE_POW,       /*   X        X               X    */
+   OPCODE_POPA,      /*                    3            */
    OPCODE_PRINT,     /*                    X       X    */
+   OPCODE_PUSHA,     /*                    3            */
    OPCODE_RCC,       /*                    1.1          */
    OPCODE_RCP,       /*   X        X       X       X    */
+   OPCODE_RET,       /*                    2       2    */
    OPCODE_RFL,       /*            X               X    */
    OPCODE_RSQ,       /*   X        X       X       X    */
    OPCODE_SCS,       /*            X                    */
@@ -116,48 +147,22 @@ enum prog_opcode {   /*---------------------------------*/
    OPCODE_SLE,       /*                    2       X    */
    OPCODE_SLT,       /*   X        X       X       X    */
    OPCODE_SNE,       /*                    2       X    */
-   OPCODE_STR,       /*            X       2       X    */
+   OPCODE_SSG,       /*                    2            */
+   OPCODE_STR,       /*                    2       X    */
    OPCODE_SUB,       /*   X        X       1.1     X    */
    OPCODE_SWZ,       /*   X        X                    */
-   OPCODE_TEX,       /*            X               X    */
-   OPCODE_TXB,       /*            X                    */
-   OPCODE_TXD,       /*            X               X    */
+   OPCODE_TEX,       /*            X       3       X    */
+   OPCODE_TXB,       /*            X       3            */
+   OPCODE_TXD,       /*                            X    */
+   OPCODE_TXL,       /*                    3       2    */
    OPCODE_TXP,       /*            X                    */
-   OPCODE_TXP_NV,    /*                            X    */
+   OPCODE_TXP_NV,    /*                    3       X    */
    OPCODE_UP2H,      /*                            X    */
    OPCODE_UP2US,     /*                            X    */
    OPCODE_UP4B,      /*                            X    */
    OPCODE_UP4UB,     /*                            X    */
    OPCODE_X2D,       /*                            X    */
    OPCODE_XPD,       /*   X        X                    */
-#if 0
-   OPCODE_ARA,         /* NV_vertex_program2 */
-   OPCODE_ARL_NV,              /* NV_vertex_program2 */
-   OPCODE_ARR,         /* NV_vertex_program2 */
-
-   OPCODE_SEQ,         /* NV_vertex_program2 */
-   OPCODE_SFL,         /* NV_vertex_program2 */
-   OPCODE_SGT,         /* NV_vertex_program2 */
-   OPCODE_SLE,         /* NV_vertex_program2 */
-   OPCODE_SNE,         /* NV_vertex_program2 */
-   OPCODE_STR,         /* NV_vertex_program2 */
-
-   OPCODE_SSG,         /* NV_vertex_program2 */
-   OPCODE_COS,         /* NV_vertex_program2 */
-   OPCODE_SIN,         /* NV_vertex_program2 */
-
-   OPCODE_BRA,         /* NV_vertex_program2 */
-   OPCODE_CAL,         /* NV_vertex_program2 */
-   OPCODE_RET,         /* NV_vertex_program2 */
-
-   OPCODE_PUSHA,               /* NV_vertex_program3 */
-   OPCODE_POPA,                /* NV_vertex_program3 */
-
-   OPCODE_TEX,         /* NV_vertex_program3 */
-   OPCODE_TXB,         /* NV_vertex_program3 */
-   OPCODE_TXL,         /* NV_vertex_program3 */
-   OPCODE_TXP,         /* NV_vertex_program3 */
-#endif
    MAX_OPCODE
 };
 
@@ -181,7 +186,8 @@ struct prog_src_register
     */
    /*@{*/
    /**
-    * Per-component negation for the SWZ instruction.
+    * Per-component negation for the SWZ instruction.  For non-SWZ
+    * instructions the only possible values are NEGATE_XYZW and NEGATE_NONE.
     *
     * \since
     * ARB_vertex_program, ARB_fragment_program
@@ -198,8 +204,7 @@ struct prog_src_register
    GLuint Abs:1;
 
    /**
-    * Take the component-wise negation.  The negation occurs \b after the
-    * (optional) absolute value operation.
+    * Post-absolute value negation (all components).
     */
    GLuint NegateAbs:1;
    /*@}*/
@@ -285,8 +290,8 @@ struct prog_instruction
     * condition code register that is to be updated.
     *
     * In GL_NV_fragment_program or GL_NV_vertex_program2 mode, only condition
-    * code register 0 is available.  In GL_NV_vertex_program3 mode, condition code registers
-    * 0 and 1 are available.
+    * code register 0 is available.  In GL_NV_vertex_program3 mode, condition
+    * code registers 0 and 1 are available.
     *
     * \since
     * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2,
@@ -298,11 +303,12 @@ struct prog_instruction
     * Saturate each value of the vectored result to the range [0,1] or the
     * range [-1,1].  \c SSAT mode (i.e., saturation to the range [-1,1]) is
     * only available in NV_fragment_program2 mode.
+    * Value is one of the SATURATE_* tokens.
     *
     * \since
     * NV_fragment_program, NV_fragment_program_option, NV_vertex_program3.
     */
-   GLuint Saturate:2;
+   GLuint SaturateMode:2;
    
    /**
     * Per-instruction selectable precision.
@@ -329,8 +335,7 @@ struct prog_instruction
    GLuint TexSrcUnit:5;
    
    /**
-    * Source texture target (e.g., GL_TEXTURE_1D, GL_TEXTURE_2D,
-    * GL_TEXTURE_3D, GL_TEXTURE_CUBE, GL_TEXTURE_RECTANGLE_ARB).
+    * Source texture target, one of TEXTURE_{1D,2D,3D,CUBE,RECT}_INDEX.
     */
    GLuint TexSrcTarget:3;
    /*@}*/