diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-01-23 13:17:50 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-01-23 13:17:50 -0700 |
commit | 2d37e78e636e5e1e7d5d00230e50a00f7a71e868 (patch) | |
tree | 8fae0ed858c04330908996bc2289e50b8467718f /src/mesa/pipe/softpipe/sp_state_derived.c | |
parent | cd3643698eafa0869a8317b002e5b066de0172e7 (diff) |
gallium: restore/rewrite vbuf code for softpipe
Now based on the draw_vbuf code, instead being a custom one-off.
Disabled by default, enable with SP_VBUF env var.
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_state_derived.c')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state_derived.c | 69 |
1 files changed, 12 insertions, 57 deletions
diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c index 64e86a0d86..74d34c50a8 100644 --- a/src/mesa/pipe/softpipe/sp_state_derived.c +++ b/src/mesa/pipe/softpipe/sp_state_derived.c @@ -45,24 +45,16 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) const enum interp_mode colorInterp = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; struct vertex_info *vinfo = &softpipe->vertex_info; - boolean emitBack0 = FALSE, emitBack1 = FALSE, emitPsize = FALSE; - uint front0 = 0, back0 = 0, front1 = 0, back1 = 0; uint i; - int src = 0; memset(vinfo, 0, sizeof(*vinfo)); - - 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->psize_slot = -1; - /* always emit vertex pos */ - draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_LINEAR, src++); + if (softpipe->vbuf) { + /* softpipe's setup/rasterizer stage expects vertex to have a header */ + draw_emit_vertex_attr(vinfo, FORMAT_HEADER, INTERP_LINEAR, 0); + } /* * XXX I think we need to reconcile the vertex shader outputs with @@ -75,46 +67,38 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) switch (vs->output_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: - /* vertex programs always emit position, but might not be - * needed for fragment progs. - */ - /* no-op */ + draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_LINEAR, i); break; case TGSI_SEMANTIC_COLOR: if (vs->output_semantic_index[i] == 0) { - front0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src++); + draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, i); } else { assert(vs->output_semantic_index[i] == 1); - front1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src++); + draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, i); } break; case TGSI_SEMANTIC_BCOLOR: - if (vs->output_semantic_index[i] == 0) { - emitBack0 = TRUE; - } - else { - assert(vs->output_semantic_index[i] == 1); - emitBack1 = TRUE; - } + /* no-op */ break; case TGSI_SEMANTIC_FOG: - draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_PERSPECTIVE, src++); + draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_PERSPECTIVE, i); break; case TGSI_SEMANTIC_PSIZE: /* XXX only emit if drawing points or front/back polygon mode * is point mode */ - emitPsize = TRUE; + softpipe->psize_slot + = draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_CONSTANT, i); break; case TGSI_SEMANTIC_GENERIC: /* this includes texcoords and varying vars */ - draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_PERSPECTIVE, src++); + draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_PERSPECTIVE, i); break; default: @@ -125,35 +109,6 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) draw_compute_vertex_size(vinfo); softpipe->nr_frag_attrs = fs->num_inputs; - - /* We want these after all other attribs since they won't get passed - * to the fragment shader. All prior vertex output attribs should match - * up 1:1 with the fragment shader inputs. - */ - if (emitBack0) { - back0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src++); - } - if (emitBack1) { - back1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src++); - } - if (emitPsize) { - softpipe->psize_slot - = draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_CONSTANT, src++); - } - - /* If the attributes have changed, tell the draw module about - * the new vertex layout. - */ - /* XXX we also need to do this when the shading mode (interp modes) change: */ - if (1/*vinfo->attr_mask != softpipe->attr_mask*/) { - /*softpipe->attr_mask = vinfo->attr_mask;*/ - - /*draw_set_vertex_info( softpipe->draw, vinfo);*/ - - /*draw_set_twoside_attributes(softpipe->draw, - front0, back0, front1, back1); - */ - } } |