mesa: Move src/mesa/glapi/dispatch.h to mesa.
[mesa.git] / src / mesa / shader / program_parser.h
index b4c24ec92cc4d5e59a1fa0cab6cb369af6ececd6..730466c30f5c142c4080d397e29e27674d9c00bf 100644 (file)
@@ -35,10 +35,11 @@ enum asm_type {
    at_attrib,
    at_param,
    at_temp,
-   at_output,
+   at_output
 };
 
 struct asm_symbol {
+   struct asm_symbol *next;    /**< List linkage for freeing. */
    const char *name;
    enum asm_type type;
    unsigned attrib_binding;
@@ -55,6 +56,12 @@ struct asm_symbol {
     */
    unsigned param_binding_begin;
 
+   /**
+    * Constants put into the parameter list may be swizzled.  This
+    * field contain's the symbol's swizzle. (SWIZZLE_X/Y/Z/W)
+    */
+   unsigned param_binding_swizzle;
+
    /* This is how many entries in the the program_parameter_list we take up
     * with our state tokens or constants. Note that this is _not_ the same as
     * the number of param registers we eventually use.
@@ -134,6 +141,14 @@ struct asm_parser_state {
 
    struct _mesa_symbol_table *st;
 
+   /**
+    * Linked list of symbols
+    *
+    * This list is \b only used when cleaning up compiler state and freeing
+    * memory.
+    */
+   struct asm_symbol *sym;
+
    /**
     * State for the lexer.
     */
@@ -191,6 +206,11 @@ struct asm_parser_state {
       unsigned PrecisionHint:2;
       unsigned DrawBuffers:1;
       unsigned Shadow:1;
+      unsigned TexRect:1;
+      unsigned TexArray:1;
+      unsigned NV_fragment:1;
+      unsigned OriginUpperLeft:1;
+      unsigned PixelCenterInteger:1;
    } option;
 
    struct {
@@ -252,4 +272,31 @@ extern int _mesa_ARBvp_parse_option(struct asm_parser_state *state,
 extern int _mesa_ARBfp_parse_option(struct asm_parser_state *state,
     const char *option);
 
+/**
+ * Parses and processes instruction suffixes
+ *
+ * Instruction suffixes, such as \c _SAT, are processed.  The relevant bits
+ * are set in \c inst.  If suffixes are encountered that are either not known
+ * or not supported by the modes and options set in \c state, zero will be
+ * returned.
+ *
+ * \return
+ * Non-zero on success, zero on failure.
+ */
+extern int _mesa_parse_instruction_suffix(const struct asm_parser_state *state,
+    const char *suffix, struct prog_instruction *inst);
+
+/**
+ * Parses a condition code name
+ *
+ * The condition code names (e.g., \c LT, \c GT, \c NE) were added to assembly
+ * shaders with the \c GL_NV_fragment_program_option extension.  This function
+ * converts a string representation into one of the \c COND_ macros.
+ *
+ * \return
+ * One of the \c COND_ macros defined in prog_instruction.h on success or zero
+ * on failure.
+ */
+extern int _mesa_parse_cc(const char *s);
+
 /*@}*/