Export _mesa_print_alu_instruction() to allow drivers to roll their
[mesa.git] / src / mesa / shader / program.h
index a1ee3349dce343666f83fa91ef4fbf56a62c428b..5b73965dcafe5c1ea215b974fd466502b7af39d6 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5
+ * Version:  6.5.1
  *
- * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -74,7 +74,7 @@
 #define WRITEMASK_XYZW  0xf
 
 
-extern struct program _mesa_DummyProgram;
+extern struct gl_program _mesa_DummyProgram;
 
 
 /*
@@ -95,22 +95,31 @@ _mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
                        GLint *line, GLint *col);
 
 
-extern struct program * 
+extern struct gl_program * 
 _mesa_init_vertex_program(GLcontext *ctx, 
-                          struct vertex_program *prog, 
+                          struct gl_vertex_program *prog, 
                           GLenum target, GLuint id);
 
-extern struct program * 
+extern struct gl_program * 
 _mesa_init_fragment_program(GLcontext *ctx, 
-                            struct fragment_program *prog,
+                            struct gl_fragment_program *prog,
                             GLenum target, GLuint id);
 
-extern struct program *
+extern struct gl_program *
 _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id);
 
 extern void
-_mesa_delete_program(GLcontext *ctx, struct program *prog);
+_mesa_delete_program(GLcontext *ctx, struct gl_program *prog);
 
+extern struct gl_program *
+_mesa_lookup_program(GLcontext *ctx, GLuint id);
+
+extern struct prog_instruction *
+_mesa_alloc_instructions(GLuint numInst);
+
+extern struct prog_instruction *
+_mesa_realloc_instructions(struct prog_instruction *oldInst,
+                           GLuint numOldInst, GLuint numNewInst);
 
 
 /**
@@ -190,20 +199,25 @@ enum state_index {
  * and ARB_fragment_program global state references.  For the later, Name
  * might be "state.light[0].diffuse", for example.
  */
-struct program_parameter
+struct gl_program_parameter
 {
-   const char *Name;                   /* Null-terminated */
-   enum register_file Type; /** PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */
-   enum state_index StateIndexes[6];   /* Global state reference */
+   const char *Name;          /**< Null-terminated string */
+   enum register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */
+   enum state_index StateIndexes[6];   /**< Global state reference */
 };
 
 
-struct program_parameter_list
+/**
+ * A list of the above program_parameter instances.
+ */
+struct gl_program_parameter_list
 {
-   GLuint Size;           /** allocated size of Parameters, ParameterValues */
-   GLuint NumParameters;  /** number of parameters in arrays */
-   struct program_parameter *Parameters; /** Array [Size] */
-   GLfloat (*ParameterValues)[4];        /** Array [Size] */
+   GLuint Size;           /**< allocated size of Parameters, ParameterValues */
+   GLuint NumParameters;  /**< number of parameters in arrays */
+   struct gl_program_parameter *Parameters; /**< Array [Size] */
+   GLfloat (*ParameterValues)[4];        /**< Array [Size] of GLfloat[4] */
+   GLbitfield StateFlags; /**< _NEW_* flags indicating which state changes
+                               might invalidate ParameterValues[] */
 };
 
 
@@ -211,53 +225,55 @@ struct program_parameter_list
  * Program parameter functions
  */
 
-extern struct program_parameter_list *
+extern struct gl_program_parameter_list *
 _mesa_new_parameter_list(void);
 
 extern void
-_mesa_free_parameter_list(struct program_parameter_list *paramList);
-
-extern void
-_mesa_free_parameters(struct program_parameter_list *paramList);
+_mesa_free_parameter_list(struct gl_program_parameter_list *paramList);
 
 extern GLint
-_mesa_add_named_parameter(struct program_parameter_list *paramList,
+_mesa_add_named_parameter(struct gl_program_parameter_list *paramList,
                           const char *name, const GLfloat values[4]);
 
 extern GLint
-_mesa_add_named_constant(struct program_parameter_list *paramList,
+_mesa_add_named_constant(struct gl_program_parameter_list *paramList,
                          const char *name, const GLfloat values[4]);
 
 extern GLint
-_mesa_add_unnamed_constant(struct program_parameter_list *paramList,
+_mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList,
                            const GLfloat values[4]);
 
 extern GLint
-_mesa_add_state_reference(struct program_parameter_list *paramList,
+_mesa_add_state_reference(struct gl_program_parameter_list *paramList,
                           const GLint *stateTokens);
 
 extern GLfloat *
-_mesa_lookup_parameter_value(struct program_parameter_list *paramList,
+_mesa_lookup_parameter_value(struct gl_program_parameter_list *paramList,
                              GLsizei nameLen, const char *name);
 
 extern GLint
-_mesa_lookup_parameter_index(struct program_parameter_list *paramList,
+_mesa_lookup_parameter_index(struct gl_program_parameter_list *paramList,
                              GLsizei nameLen, const char *name);
 
 extern void
 _mesa_load_state_parameters(GLcontext *ctx,
-                            struct program_parameter_list *paramList);
+                            struct gl_program_parameter_list *paramList);
 
 
 
 extern void
 _mesa_print_instruction(const struct prog_instruction *inst);
 
+void
+_mesa_print_alu_instruction(const struct prog_instruction *inst,
+                           const char *opcode_string, 
+                           GLuint numRegs);
+
 extern void
-_mesa_print_program(const struct program *prog);
+_mesa_print_program(const struct gl_program *prog);
 
 extern void
-_mesa_print_program_parameters(GLcontext *ctx, const struct program *prog);
+_mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog);
 
 
 /*