summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_atom_shader.c
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2010-06-28 17:31:21 -0400
committerZack Rusin <zackr@vmware.com>2010-06-28 22:53:21 -0400
commitda7bd6a90e1fee5c16327338fd251c0f6be34e36 (patch)
tree5f7e3d8f6d30799033afd78beec3e643ef4c7d6c /src/mesa/state_tracker/st_atom_shader.c
parent0b50fcbd556ead8d35c2b543f13de433996a5822 (diff)
mesa: initial support for ARB_geometry_shader4
laying down the foundation for everything and implementing most of the stuff. linking, gl_VerticesIn and multidimensional inputs are left.
Diffstat (limited to 'src/mesa/state_tracker/st_atom_shader.c')
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index dcaad83a3c..cebaad5f00 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -66,7 +66,19 @@ translate_fp(struct st_context *st,
}
}
+/*
+ * Translate geometry program if needed.
+ */
+static void
+translate_gp(struct st_context *st,
+ struct st_geometry_program *stgp)
+{
+ if (!stgp->tgsi.tokens) {
+ assert(stgp->Base.Base.NumInstructions > 1);
+ st_translate_geometry_program(st, stgp);
+ }
+}
/**
* Find a translated vertex program that corresponds to stvp and
@@ -222,3 +234,33 @@ const struct st_tracked_state st_update_vp = {
},
update_vp /* update */
};
+
+static void
+update_gp( struct st_context *st )
+{
+
+ struct st_geometry_program *stgp;
+
+ if (!st->ctx->GeometryProgram._Current) {
+ cso_set_geometry_shader_handle(st->cso_context, NULL);
+ return;
+ }
+
+ stgp = st_geometry_program(st->ctx->GeometryProgram._Current);
+ assert(stgp->Base.Base.Target == MESA_GEOMETRY_PROGRAM);
+
+ translate_gp(st, stgp);
+
+ st_reference_geomprog(st, &st->gp, stgp);
+
+ cso_set_geometry_shader_handle(st->cso_context, stgp->driver_shader);
+}
+
+const struct st_tracked_state st_update_gp = {
+ "st_update_gp", /* name */
+ { /* dirty */
+ 0, /* mesa */
+ ST_NEW_GEOMETRY_PROGRAM /* st */
+ },
+ update_gp /* update */
+};