mesa: Prefix main includes with dir to avoid conflicts.
[mesa.git] / src / mesa / state_tracker / st_program.h
index 31558af6cedcd016013819f13c29af296d9b5ce3..086e9391aa956f8443aaf8264b384e53175f5c8b 100644 (file)
 #ifndef ST_PROGRAM_H
 #define ST_PROGRAM_H
 
-#include "mtypes.h"
+#include "main/mtypes.h"
+#include "shader/program.h"
 #include "pipe/p_shader_tokens.h"
 
 
-#define ST_MAX_SHADER_TOKENS 1024
-
-
 struct cso_fragment_shader;
 struct cso_vertex_shader;
 struct translated_vertex_program;
@@ -60,11 +58,8 @@ struct st_fragment_program
    /** map FP input back to VP output */
    GLuint input_map[PIPE_MAX_SHADER_INPUTS];
 
-   /** The program in TGSI format */
-   struct tgsi_token tokens[ST_MAX_SHADER_TOKENS];
-
-   /** Pointer to the corresponding cached shader */
-   const struct cso_fragment_shader *cso;
+   struct pipe_shader_state state;
+   void *driver_shader;
 
    GLuint param_state;
 
@@ -72,6 +67,10 @@ struct st_fragment_program
     * outputs match this fragment program's inputs.
     */
    struct translated_vertex_program *vertex_programs;
+
+   /** Program prefixed with glBitmap prologue */
+   struct st_fragment_program *bitmap_program;
+   uint bitmap_sampler;
 };
 
 
@@ -88,11 +87,10 @@ struct st_vertex_program
    /** maps a TGSI input index back to a Mesa VERT_ATTRIB_x */
    GLuint index_to_input[PIPE_MAX_SHADER_INPUTS];
 
-   /** The program in TGSI format */
-   struct tgsi_token tokens[ST_MAX_SHADER_TOKENS];
+   GLuint num_inputs;
 
-   /** Pointer to the corresponding cached shader */
-   const struct cso_vertex_shader *cso;
+   struct pipe_shader_state state;
+   void *driver_shader;
 
    /** For using our private draw module (glRasterPos) */
    struct draw_vertex_shader *draw_shader;
@@ -101,37 +99,50 @@ struct st_vertex_program
 };
 
 
-extern void
-st_init_program_functions(struct dd_function_table *functions);
-
-
-static inline struct st_fragment_program *
+static INLINE struct st_fragment_program *
 st_fragment_program( struct gl_fragment_program *fp )
 {
    return (struct st_fragment_program *)fp;
 }
 
 
-static inline struct st_vertex_program *
+static INLINE struct st_vertex_program *
 st_vertex_program( struct gl_vertex_program *vp )
 {
    return (struct st_vertex_program *)vp;
 }
 
 
-extern const struct cso_fragment_shader *
+static INLINE void
+st_reference_vertprog(struct st_context *st,
+                      struct st_vertex_program **ptr,
+                      struct st_vertex_program *prog)
+{
+   _mesa_reference_program(st->ctx,
+                           (struct gl_program **) ptr,
+                           (struct gl_program *) prog);
+}
+
+static INLINE void
+st_reference_fragprog(struct st_context *st,
+                      struct st_fragment_program **ptr,
+                      struct st_fragment_program *prog)
+{
+   _mesa_reference_program(st->ctx,
+                           (struct gl_program **) ptr,
+                           (struct gl_program *) prog);
+}
+
+
+extern void
 st_translate_fragment_program(struct st_context *st,
                               struct st_fragment_program *fp,
-                              const GLuint inputMapping[],
-                              struct tgsi_token *tokens,
-                              GLuint maxTokens);
+                              const GLuint inputMapping[]);
 
 
 extern void
 st_translate_vertex_program(struct st_context *st,
                             struct st_vertex_program *vp,
-                            const GLuint vert_output_to_slot[],
-                            struct tgsi_token *tokens,
-                            GLuint maxTokens);
+                            const GLuint vert_output_to_slot[]);
 
 #endif