mesa: lift memcpy_get_tex_image() code from intel driver into core Mesa
[mesa.git] / src / mesa / shader / program_parser.h
index fa47d84565a1ad815fd321ef9e08ec7e56ee89df..25b413918aae2ed1765cb21195635084d441bc09 100644 (file)
@@ -38,6 +38,13 @@ enum asm_type {
    at_output,
 };
 
+/**
+ * \note
+ * Objects of this type are allocated as the object plus the name of the
+ * symbol.  That is, malloc(sizeof(struct asm_symbol) + strlen(name) + 1).
+ * Alternately, asm_symbol::name could be moved to the bottom of the structure
+ * and declared as 'char name[0];'.
+ */
 struct asm_symbol {
    struct asm_symbol *next;    /**< List linkage for freeing. */
    const char *name;
@@ -157,6 +164,15 @@ struct asm_parser_state {
    /*@}*/
 
 
+   /**
+    * Buffer to hold strings transfered from the lexer to the parser
+    */
+   /*@{*/
+   char *string_dumpster;      /**< String data transfered. */
+   size_t dumpster_size;       /**< Total size, in bytes, of the buffer. */
+   /*@}*/
+
+
    /**
     * Selected limits copied from gl_constants
     *
@@ -202,6 +218,7 @@ struct asm_parser_state {
       unsigned Shadow:1;
       unsigned TexRect:1;
       unsigned TexArray:1;
+      unsigned NV_fragment:1;
    } option;
 
    struct {
@@ -263,4 +280,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);
+
 /*@}*/