st/mesa: fix fallout from xfb changes.
[mesa.git] / src / mesa / state_tracker / st_program.h
index a8571f0c441ad810dbf7e16e6751616357416cb3..7c90fd74e1466dc950d87d228e595b01974846a1 100644 (file)
@@ -35,6 +35,7 @@
 #define ST_PROGRAM_H
 
 #include "main/mtypes.h"
+#include "main/atifragshader.h"
 #include "program/program.h"
 #include "pipe/p_state.h"
 #include "st_context.h"
@@ -65,6 +66,12 @@ struct st_fp_variant_key
 
    /** for ARB_sample_shading */
    GLuint persample_shading:1;
+
+   /** needed for ATI_fragment_shader */
+   GLuint fog:2;
+
+   /** needed for ATI_fragment_shader */
+   char texture_targets[MAX_NUM_FRAGMENT_REGISTERS_ATI];
 };
 
 
@@ -99,6 +106,7 @@ struct st_fragment_program
    struct gl_fragment_program Base;
    struct pipe_shader_state tgsi;
    struct glsl_to_tgsi_visitor* glsl_to_tgsi;
+   struct ati_fragment_shader *ati_fs;
 
    struct st_fp_variant *variants;
 };
@@ -171,25 +179,24 @@ struct st_vertex_program
 
 
 
-/** Geometry program variant key */
-struct st_gp_variant_key
+/** Key shared by all shaders except VP, FP */
+struct st_basic_variant_key
 {
    struct st_context *st;          /**< variants are per-context */
-   /* no other fields yet */
 };
 
 
 /**
  * Geometry program variant.
  */
-struct st_gp_variant
+struct st_basic_variant
 {
    /* Parameters which generated this variant. */
-   struct st_gp_variant_key key;
+   struct st_basic_variant_key key;
 
    void *driver_shader;
 
-   struct st_gp_variant *next;
+   struct st_basic_variant *next;
 };
 
 
@@ -202,30 +209,7 @@ struct st_geometry_program
    struct pipe_shader_state tgsi;
    struct glsl_to_tgsi_visitor* glsl_to_tgsi;
 
-   struct st_gp_variant *variants;
-};
-
-
-
-/** Tessellation control program variant key */
-struct st_tcp_variant_key
-{
-   struct st_context *st;          /**< variants are per-context */
-   /* no other fields yet */
-};
-
-
-/**
- * Tessellation control program variant.
- */
-struct st_tcp_variant
-{
-   /* Parameters which generated this variant. */
-   struct st_tcp_variant_key key;
-
-   void *driver_shader;
-
-   struct st_tcp_variant *next;
+   struct st_basic_variant *variants;
 };
 
 
@@ -238,47 +222,36 @@ struct st_tessctrl_program
    struct pipe_shader_state tgsi;
    struct glsl_to_tgsi_visitor* glsl_to_tgsi;
 
-   struct st_tcp_variant *variants;
-};
-
-
-
-/** Tessellation evaluation program variant key */
-struct st_tep_variant_key
-{
-   struct st_context *st;          /**< variants are per-context */
-   /* no other fields yet */
+   struct st_basic_variant *variants;
 };
 
 
 /**
- * Tessellation evaluation program variant.
+ * Derived from Mesa gl_tess_eval_program:
  */
-struct st_tep_variant
+struct st_tesseval_program
 {
-   /* Parameters which generated this variant. */
-   struct st_tep_variant_key key;
-
-   void *driver_shader;
+   struct gl_tess_eval_program Base;  /**< The Mesa tess eval program */
+   struct pipe_shader_state tgsi;
+   struct glsl_to_tgsi_visitor* glsl_to_tgsi;
 
-   struct st_tep_variant *next;
+   struct st_basic_variant *variants;
 };
 
 
 /**
- * Derived from Mesa gl_tess_eval_program:
+ * Derived from Mesa gl_compute_program:
  */
-struct st_tesseval_program
+struct st_compute_program
 {
-   struct gl_tess_eval_program Base;  /**< The Mesa tess eval program */
-   struct pipe_shader_state tgsi;
+   struct gl_compute_program Base;  /**< The Mesa compute program */
+   struct pipe_compute_state tgsi;
    struct glsl_to_tgsi_visitor* glsl_to_tgsi;
 
-   struct st_tep_variant *variants;
+   struct st_basic_variant *variants;
 };
 
 
-
 static inline struct st_fragment_program *
 st_fragment_program( struct gl_fragment_program *fp )
 {
@@ -310,6 +283,12 @@ st_tesseval_program( struct gl_tess_eval_program *tep )
    return (struct st_tesseval_program *)tep;
 }
 
+static inline struct st_compute_program *
+st_compute_program( struct gl_compute_program *cp )
+{
+   return (struct st_compute_program *)cp;
+}
+
 static inline void
 st_reference_vertprog(struct st_context *st,
                       struct st_vertex_program **ptr,
@@ -360,6 +339,16 @@ st_reference_tesseprog(struct st_context *st,
                            (struct gl_program *) prog);
 }
 
+static inline void
+st_reference_compprog(struct st_context *st,
+                      struct st_compute_program **ptr,
+                      struct st_compute_program *prog)
+{
+   _mesa_reference_program(st->ctx,
+                           (struct gl_program **) ptr,
+                           (struct gl_program *) prog);
+}
+
 /**
  * This defines mapping from Mesa VARYING_SLOTs to TGSI GENERIC slots.
  */
@@ -397,21 +386,16 @@ st_get_fp_variant(struct st_context *st,
                   struct st_fragment_program *stfp,
                   const struct st_fp_variant_key *key);
 
+extern struct st_basic_variant *
+st_get_cp_variant(struct st_context *st,
+                  struct pipe_compute_state *tgsi,
+                  struct st_basic_variant **variants);
 
-extern struct st_gp_variant *
-st_get_gp_variant(struct st_context *st,
-                  struct st_geometry_program *stgp,
-                  const struct st_gp_variant_key *key);
-
-extern struct st_tcp_variant *
-st_get_tcp_variant(struct st_context *st,
-                   struct st_tessctrl_program *stgp,
-                   const struct st_tcp_variant_key *key);
-
-extern struct st_tep_variant *
-st_get_tep_variant(struct st_context *st,
-                   struct st_tesseval_program *stgp,
-                   const struct st_tep_variant_key *key);
+extern struct st_basic_variant *
+st_get_basic_variant(struct st_context *st,
+                     unsigned pipe_shader,
+                     struct pipe_shader_state *tgsi,
+                     struct st_basic_variant **variants);
 
 extern void
 st_release_vp_variants( struct st_context *st,
@@ -422,16 +406,13 @@ st_release_fp_variants( struct st_context *st,
                         struct st_fragment_program *stfp );
 
 extern void
-st_release_gp_variants(struct st_context *st,
-                       struct st_geometry_program *stgp);
-
-extern void
-st_release_tcp_variants(struct st_context *st,
-                        struct st_tessctrl_program *stgp);
+st_release_cp_variants(struct st_context *st,
+                        struct st_compute_program *stcp);
 
 extern void
-st_release_tep_variants(struct st_context *st,
-                        struct st_tesseval_program *stgp);
+st_release_basic_variants(struct st_context *st, GLenum target,
+                          struct st_basic_variant **variants,
+                          struct pipe_shader_state *tgsi);
 
 extern void
 st_destroy_program_variants(struct st_context *st);
@@ -456,6 +437,10 @@ extern bool
 st_translate_tesseval_program(struct st_context *st,
                               struct st_tesseval_program *sttep);
 
+extern bool
+st_translate_compute_program(struct st_context *st,
+                             struct st_compute_program *stcp);
+
 extern void
 st_print_current_vertex_program(void);