From 2549d79ae5342a2b97c06e3b0db9da6eb7821d2e Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 23 Jan 2008 23:27:31 -0700 Subject: gallium: rename FORMAT_x to EMIT_x and use EMIT_ALL to emit whole vertex as-is in vbuf code --- src/mesa/pipe/softpipe/sp_state_derived.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/mesa/pipe/softpipe') diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c index 4be3641d67..39c3e1afe1 100644 --- a/src/mesa/pipe/softpipe/sp_state_derived.c +++ b/src/mesa/pipe/softpipe/sp_state_derived.c @@ -29,6 +29,7 @@ #include "pipe/p_shader_tokens.h" #include "pipe/draw/draw_context.h" #include "pipe/draw/draw_vertex.h" +#include "pipe/draw/draw_private.h" #include "sp_context.h" #include "sp_state.h" @@ -61,20 +62,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; - struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf; uint i; - int src; if (softpipe->vbuf) { /* if using the post-transform vertex buffer, tell draw_vbuf to * simply emit the whole post-xform vertex as-is: */ + struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf; vinfo_vbuf->num_attribs = 0; - draw_emit_vertex_attr(vinfo_vbuf, FORMAT_HEADER, INTERP_NONE, 0); - for (i = 0; i < vs->num_outputs; i++) { - draw_emit_vertex_attr(vinfo_vbuf, FORMAT_4F, INTERP_NONE, i); - } - draw_compute_vertex_size(vinfo_vbuf); + draw_emit_vertex_attr(vinfo_vbuf, EMIT_ALL, INTERP_NONE, 0); + vinfo_vbuf->size = 4 * vs->num_outputs + sizeof(struct vertex_header)/4; } /* @@ -83,18 +80,19 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) */ vinfo->num_attribs = 0; for (i = 0; i < fs->num_inputs; i++) { + int src; switch (fs->input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: src = find_vs_output(vs, TGSI_SEMANTIC_POSITION, 0); assert(src >= 0); - draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_POS, src); + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_POS, src); break; case TGSI_SEMANTIC_COLOR: src = find_vs_output(vs, TGSI_SEMANTIC_COLOR, fs->input_semantic_index[i]); assert(src >= 0); - draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src); + draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src); break; case TGSI_SEMANTIC_FOG: @@ -104,7 +102,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) src = 0; #endif assert(src >= 0); - draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_PERSPECTIVE, src); + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); break; case TGSI_SEMANTIC_GENERIC: @@ -112,7 +110,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) src = find_vs_output(vs, TGSI_SEMANTIC_GENERIC, fs->input_semantic_index[i]); assert(src >= 0); - draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_PERSPECTIVE, src); + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); break; default: @@ -122,7 +120,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) softpipe->psize_slot = find_vs_output(vs, TGSI_SEMANTIC_PSIZE, 0); if (softpipe->psize_slot >= 0) { - draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_CONSTANT, + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, softpipe->psize_slot); } -- cgit v1.2.3