Mesa (arb_geometry_shader4): gs: gets us a step closer to the correct linking semantics
Zack Rusin
zack at kemper.freedesktop.org
Sun Sep 6 21:55:05 UTC 2009
Module: Mesa
Branch: arb_geometry_shader4
Commit: 9aed9bf720359e1e0b86e03501ddb8705f8364a3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9aed9bf720359e1e0b86e03501ddb8705f8364a3
Author: Zack Rusin <zackr at vmware.com>
Date: Sun Sep 6 17:59:48 2009 -0400
gs: gets us a step closer to the correct linking semantics
---
src/mesa/state_tracker/st_atom_shader.c | 41 ++++++++++++++++++++++++++++++-
src/mesa/state_tracker/st_program.c | 8 ++++--
2 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index 71cc252..cad6e9f 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -204,6 +204,34 @@ vp_out_to_gp_in(GLuint vertResult)
}
}
+static INLINE int num_vertices_for_prim(int prim)
+{
+ switch(prim) {
+ case PIPE_PRIM_POINTS:
+ return 1;
+ case PIPE_PRIM_LINES:
+ return 2;
+ case PIPE_PRIM_LINE_LOOP:
+ return 2;
+ case PIPE_PRIM_LINE_STRIP:
+ return 2;
+ case PIPE_PRIM_TRIANGLES:
+ return 3;
+ case PIPE_PRIM_TRIANGLE_STRIP:
+ return 3;
+ case PIPE_PRIM_TRIANGLE_FAN:
+ return 3;
+ case PIPE_PRIM_LINES_ADJACENCY:
+ case PIPE_PRIM_LINE_STRIP_ADJACENCY:
+ return 4;
+ case PIPE_PRIM_TRIANGLES_ADJACENCY:
+ case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
+ return 6;
+ default:
+ assert(!"Bad geometry shader input");
+ return 0;
+ }
+}
/**
* Find a translated vertex program that corresponds to stvp and
@@ -275,7 +303,18 @@ find_translated_vp(struct st_context *st,
for (inAttr = 0; inAttr < GEOM_ATTRIB_MAX; inAttr++) {
if (geomInputsRead & (1 << inAttr)) {
stgp->input_to_slot[inAttr] = numIn;
- numIn++;
+ switch(inAttr) {
+ case GEOM_ATTRIB_VERTICES:
+ ++numIn;
+ break;
+ default:
+ numIn += num_vertices_for_prim(stgp->Base.InputType);
+ break;
+ }
+#if 0
+ debug_printf("%d attr = slot %d\n",
+ inAttr, stgp->input_to_slot[inAttr]);
+#endif
}
else {
stgp->input_to_slot[inAttr] = UNUSED;
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index f93a832..432e239 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -681,7 +681,7 @@ st_translate_geometry_program(struct st_context *st,
}
}
-#if 1
+#if 0
if (outputMapping && outputSemanticName) {
printf("GEOM_RESULT written out_slot semantic_name semantic_index\n");
for (attr = 0; attr < GEOM_RESULT_MAX; attr++) {
@@ -802,7 +802,7 @@ st_translate_geometry_program(struct st_context *st,
outputMapping = defaultOutputMapping;
}
-#if 1 /* debug */
+#if 0 /* debug */
{
GLuint i;
printf("outputMapping? %d\n", outputMapping ? 1 : 0);
@@ -832,6 +832,8 @@ st_translate_geometry_program(struct st_context *st,
stgp->driver_shader = NULL;
}
+ if (!inputMapping)
+ inputMapping = defaultInputMapping;
/* XXX: fix static allocation of tokens:
*/
num_tokens = st_translate_mesa_program(st->ctx,
@@ -839,7 +841,7 @@ st_translate_geometry_program(struct st_context *st,
&stgp->Base.Base,
/* inputs */
gs_num_inputs,
- stgp->input_to_index,
+ inputMapping,
stgp->input_semantic_name,
stgp->input_semantic_index,
NULL,
More information about the mesa-commit
mailing list