summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_program.h
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2016-01-07 22:02:43 +0100
committerSamuel Pitoiset <[email protected]>2016-02-13 16:00:54 +0100
commit7c79c1e3e25857a45150f6a0bf2e813fed074a6c (patch)
tree289604d1ce646c5033c011ce79c37bcf4c970dd4 /src/mesa/state_tracker/st_program.h
parent08c46025c87654fbc885136a2c8cc4cce902dd37 (diff)
st/mesa: add compute shader states
Changes from v2: - use as much common code as possible (eg. st_basic_variant) Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_program.h')
-rw-r--r--src/mesa/state_tracker/st_program.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 74f3def6095..028fba99a74 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -231,6 +231,18 @@ struct st_tesseval_program
};
+/**
+ * Derived from Mesa gl_compute_program:
+ */
+struct st_compute_program
+{
+ struct gl_compute_program Base; /**< The Mesa compute program */
+ struct pipe_compute_state tgsi;
+ struct glsl_to_tgsi_visitor* glsl_to_tgsi;
+
+ struct st_basic_variant *variants;
+};
+
static inline struct st_fragment_program *
st_fragment_program( struct gl_fragment_program *fp )
@@ -263,6 +275,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,
@@ -313,6 +331,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.
*/
@@ -351,6 +379,11 @@ st_get_fp_variant(struct st_context *st,
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_basic_variant *
st_get_basic_variant(struct st_context *st,
unsigned pipe_shader,
struct pipe_shader_state *tgsi,
@@ -365,6 +398,10 @@ st_release_fp_variants( struct st_context *st,
struct st_fragment_program *stfp );
extern void
+st_release_cp_variants(struct st_context *st,
+ struct st_compute_program *stcp);
+
+extern void
st_release_basic_variants(struct st_context *st, GLenum target,
struct st_basic_variant **variants,
struct pipe_shader_state *tgsi);
@@ -392,6 +429,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);