aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/softpipe/sp_state_derived.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-09-21 12:06:08 -0600
committerBrian <[email protected]>2007-09-21 12:06:08 -0600
commitda45890818ab5ae94592208e3581b5c2febaa6b4 (patch)
tree4f6d9fa272e0b93213073f24913bc86899c8599f /src/mesa/pipe/softpipe/sp_state_derived.c
parent46f606e9715145218331a04f0d1f66fb9f8531d6 (diff)
Fix up some point size breakage. Start on fogcoord too.
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_state_derived.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_state_derived.c62
1 files changed, 43 insertions, 19 deletions
diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c
index 0e78209e305..35ba32cd81c 100644
--- a/src/mesa/pipe/softpipe/sp_state_derived.c
+++ b/src/mesa/pipe/softpipe/sp_state_derived.c
@@ -43,6 +43,7 @@
*/
static void calculate_vertex_layout( struct softpipe_context *softpipe )
{
+ const struct pipe_shader_state *vs = softpipe->vs;
const struct pipe_shader_state *fs = softpipe->fs;
const interp_mode colorInterp
= softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
@@ -58,47 +59,68 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe )
softpipe->need_z = FALSE;
softpipe->need_w = FALSE;
+ if (fs->input_semantic_name[0] == TGSI_SEMANTIC_POSITION) {
+ /* Need Z if depth test is enabled or the fragment program uses the
+ * fragment position (XYZW).
+ */
+ softpipe->need_z = TRUE;
+ softpipe->need_w = TRUE;
+ }
+
softpipe->psize_slot = -1;
/* always emit vertex pos */
- /* TODO - Figure out if we need to do perspective divide, etc. */
draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_LINEAR);
- for (i = 0; i < fs->num_inputs; i++) {
- switch (fs->input_semantic_name[i]) {
+ /*
+ * XXX I think we need to reconcile the vertex shader outputs with
+ * the fragment shader inputs here to make sure the slots line up.
+ * Might just be getting lucky so far.
+ * Or maybe do that in the state tracker?
+ */
+
+ for (i = 0; i < vs->num_outputs; i++) {
+ switch (vs->output_semantic_name[i]) {
+
case TGSI_SEMANTIC_POSITION:
- /* Need Z if depth test is enabled or the fragment program uses the
- * fragment position (XYZW).
+ /* vertex programs always emit position, but might not be
+ * needed for fragment progs.
*/
- softpipe->need_z = TRUE;
- softpipe->need_w = TRUE;
+ /* no-op */
break;
+
case TGSI_SEMANTIC_COLOR:
if (fs->input_semantic_index[i] == 0) {
- front0 = draw_emit_vertex_attr(vinfo,
- FORMAT_4F, colorInterp);
+ front0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp);
+ }
+ else {
+ assert(fs->input_semantic_index[i] == 1);
+ front1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp);
+ }
+ break;
+
+ case TGSI_SEMANTIC_BCOLOR:
+ if (fs->input_semantic_index[i] == 0) {
+ back0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp);
}
else {
assert(fs->input_semantic_index[i] == 1);
- front1 = draw_emit_vertex_attr(vinfo,
- FORMAT_4F, colorInterp);
+ back1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp);
}
break;
+
case TGSI_SEMANTIC_FOG:
- draw_emit_vertex_attr(vinfo,
- FORMAT_1F, INTERP_PERSPECTIVE);
+ draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_PERSPECTIVE);
break;
-#if 0
+
case TGSI_SEMANTIC_PSIZE:
/* XXX only emit if drawing points or front/back polygon mode
* is point mode
*/
- draw_emit_vertex_attr(vinfo,
- FORMAT_4F, INTERP_CONSTANT);
- break;
-#endif
+ draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_CONSTANT);
softpipe->psize_slot = i;
- /*case TGSI_SEMANTIC_TEXCOORD:*/
+ break;
+
case TGSI_SEMANTIC_GENERIC:
/* this includes texcoords and varying vars */
draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_PERSPECTIVE);
@@ -112,6 +134,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe )
softpipe->nr_frag_attrs = vinfo->num_attribs;
+#if 0
/* Additional attributes required for setup: Just twosided
* lighting. Edgeflag is dealt with specially by setting bits in
* the vertex header.
@@ -124,6 +147,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe )
back1 = draw_emit_vertex_attr(vinfo, FORMAT_OMIT, colorInterp);
}
}
+#endif
/* If the attributes have changed, tell the draw module about
* the new vertex layout.