From cd3643698eafa0869a8317b002e5b066de0172e7 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 23 Jan 2008 12:48:41 -0700 Subject: gallium: overhaul usage of vertex_info in draw module. Remove all dependencies on vertex_info, except for draw_vbuf. Drawing stages now strictly operate on post-transformed vertices and don't know anything about hw vertices. Use vertex program output info for two-side/flat/etc stages. Temporarily disable vbuf module in softpipe driver. --- src/mesa/pipe/draw/draw_clip.c | 4 +- src/mesa/pipe/draw/draw_context.c | 6 --- src/mesa/pipe/draw/draw_context.h | 1 - src/mesa/pipe/draw/draw_flatshade.c | 73 +++++++++++++++++---------- src/mesa/pipe/draw/draw_private.h | 14 ++--- src/mesa/pipe/draw/draw_stipple.c | 30 +++-------- src/mesa/pipe/draw/draw_twoside.c | 35 +++++++++++-- src/mesa/pipe/draw/draw_vertex.c | 70 ------------------------- src/mesa/pipe/draw/draw_vertex.h | 14 +---- src/mesa/pipe/draw/draw_vertex_cache.c | 1 - src/mesa/pipe/draw/draw_vertex_fetch.c | 1 - src/mesa/pipe/draw/draw_vertex_shader.c | 5 +- src/mesa/pipe/draw/draw_vertex_shader_llvm.c | 5 +- src/mesa/pipe/i915simple/i915_state_derived.c | 6 +-- src/mesa/pipe/softpipe/sp_context.c | 2 +- src/mesa/pipe/softpipe/sp_context.h | 2 + src/mesa/pipe/softpipe/sp_prim_setup.c | 2 +- src/mesa/pipe/softpipe/sp_prim_vbuf.c | 5 +- src/mesa/pipe/softpipe/sp_state_derived.c | 7 ++- 19 files changed, 113 insertions(+), 170 deletions(-) (limited to 'src/mesa/pipe') diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/mesa/pipe/draw/draw_clip.c index c50376f11fe..e0eb656364d 100644 --- a/src/mesa/pipe/draw/draw_clip.c +++ b/src/mesa/pipe/draw/draw_clip.c @@ -93,7 +93,7 @@ static void interp( const struct clipper *clip, const struct vertex_header *out, const struct vertex_header *in ) { - const unsigned nr_attrs = clip->stage.draw->vertex_info.num_attribs; + const unsigned nr_attrs = clip->stage.draw->num_vs_outputs; unsigned j; /* Vertex header. @@ -349,7 +349,7 @@ do_clip_line( struct draw_stage *stage, static void clip_begin( struct draw_stage *stage ) { /* should always have position, at least */ - assert(stage->draw->vertex_info.num_attribs >= 1); + assert(stage->draw->num_vs_outputs > 0); stage->next->begin( stage->next ); } diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c index 5b9ea556300..ff23288fa87 100644 --- a/src/mesa/pipe/draw/draw_context.c +++ b/src/mesa/pipe/draw/draw_context.c @@ -77,11 +77,6 @@ struct draw_context *draw_create( void ) draw->vcache.vertex[i] = (struct vertex_header *)(tmp + i * MAX_VERTEX_SIZE); } - draw->attrib_front0 = 0; - draw->attrib_back0 = 0; - draw->attrib_front1 = 0; - draw->attrib_back1 = 0; - draw->convert_wide_points = TRUE; draw->convert_wide_lines = TRUE; @@ -242,7 +237,6 @@ draw_convert_wide_lines(struct draw_context *draw, boolean enable) } - /** * Allocate space for temporary post-transform vertices, such as for clipping. */ diff --git a/src/mesa/pipe/draw/draw_context.h b/src/mesa/pipe/draw/draw_context.h index cfde26ceb7b..ddeb184497a 100644 --- a/src/mesa/pipe/draw/draw_context.h +++ b/src/mesa/pipe/draw/draw_context.h @@ -122,7 +122,6 @@ void draw_set_mapped_constant_buffer(struct draw_context *draw, const void *buffer); - /*********************************************************************** * draw_prim.c */ diff --git a/src/mesa/pipe/draw/draw_flatshade.c b/src/mesa/pipe/draw/draw_flatshade.c index d7551e79481..46b0f7970fd 100644 --- a/src/mesa/pipe/draw/draw_flatshade.c +++ b/src/mesa/pipe/draw/draw_flatshade.c @@ -29,42 +29,59 @@ */ #include "pipe/p_util.h" +#include "pipe/p_shader_tokens.h" #include "draw_private.h" -static void flatshade_begin( struct draw_stage *stage ) +/** subclass of draw_stage */ +struct flat_stage { - stage->next->begin( stage->next ); -} + struct draw_stage stage; + + uint num_color_attribs; + uint color_attribs[4]; /* front/back primary/secondary colors */ +}; +static INLINE struct flat_stage * +flat_stage(struct draw_stage *stage) +{ + return (struct flat_stage *) stage; +} + -static INLINE void copy_attr( unsigned attr, - struct vertex_header *dst, - const struct vertex_header *src ) +static void flatshade_begin( struct draw_stage *stage ) { - if (attr) { - memcpy( dst->data[attr], - src->data[attr], - sizeof(src->data[0]) ); + struct flat_stage *flat = flat_stage(stage); + const struct pipe_shader_state *vs = stage->draw->vertex_shader->state; + uint i; + + /* Find which vertex shader outputs are colors, make a list */ + flat->num_color_attribs = 0; + for (i = 0; i < vs->num_outputs; i++) { + if (vs->output_semantic_name[i] == TGSI_SEMANTIC_COLOR || + vs->output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) { + flat->color_attribs[flat->num_color_attribs++] = i; + } } + + stage->next->begin( stage->next ); } +/** Copy all the color attributes from 'src' vertex to 'dst' vertex */ static INLINE void copy_colors( struct draw_stage *stage, struct vertex_header *dst, const struct vertex_header *src ) { - const uint num_attribs = stage->draw->vertex_info.num_attribs; - const enum interp_mode *interp = stage->draw->vertex_info.interp_mode; + const struct flat_stage *flat = flat_stage(stage); uint i; /* Look for constant/flat attribs and duplicate from src to dst vertex */ /* skip attrib[0] which is vert pos */ - for (i = 1; i < num_attribs; i++) { - if (interp[i] == INTERP_CONSTANT) { - copy_attr( i, dst, src ); - } + for (i = 0; i < flat->num_color_attribs; i++) { + const uint attr = flat->color_attribs[i]; + memcpy(dst->data[attr], src->data[attr], sizeof(src->data[0])); } } @@ -139,21 +156,21 @@ static void flatshade_destroy( struct draw_stage *stage ) */ struct draw_stage *draw_flatshade_stage( struct draw_context *draw ) { - struct draw_stage *flatshade = CALLOC_STRUCT(draw_stage); + struct flat_stage *flatshade = CALLOC_STRUCT(flat_stage); - draw_alloc_tmps( flatshade, 2 ); + draw_alloc_tmps( &flatshade->stage, 2 ); - flatshade->draw = draw; - flatshade->next = NULL; - flatshade->begin = flatshade_begin; - flatshade->point = flatshade_point; - flatshade->line = flatshade_line; - flatshade->tri = flatshade_tri; - flatshade->end = flatshade_end; - flatshade->reset_stipple_counter = flatshade_reset_stipple_counter; - flatshade->destroy = flatshade_destroy; + flatshade->stage.draw = draw; + flatshade->stage.next = NULL; + flatshade->stage.begin = flatshade_begin; + flatshade->stage.point = flatshade_point; + flatshade->stage.line = flatshade_line; + flatshade->stage.tri = flatshade_tri; + flatshade->stage.end = flatshade_end; + flatshade->stage.reset_stipple_counter = flatshade_reset_stipple_counter; + flatshade->stage.destroy = flatshade_destroy; - return flatshade; + return &flatshade->stage; } diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h index a264fabfb48..685ec4a6443 100644 --- a/src/mesa/pipe/draw/draw_private.h +++ b/src/mesa/pipe/draw/draw_private.h @@ -44,8 +44,6 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" -#include "draw_vertex.h" - #include "x86/rtasm/x86sse.h" #include "pipe/tgsi/exec/tgsi_exec.h" @@ -170,6 +168,8 @@ struct draw_context struct pipe_vertex_element vertex_element[PIPE_ATTRIB_MAX]; const struct draw_vertex_shader *vertex_shader; + uint num_vs_outputs; /**< convenience, from vertex_shader */ + /* user-space vertex data, buffers */ struct { /** vertex element/index buffer (ex: glDrawElements) */ @@ -189,12 +189,6 @@ struct draw_context float plane[12][4]; unsigned nr_planes; - /** Describes the layout of post-transformation vertices */ - struct vertex_info vertex_info; - /** Two-sided attributes: */ - uint attrib_front0, attrib_back0; - uint attrib_front1, attrib_back1; - boolean convert_wide_points; /**< convert wide points to tris? */ boolean convert_wide_lines; /**< convert side lines to tris? */ @@ -309,7 +303,9 @@ dup_vert( struct draw_stage *stage, unsigned idx ) { struct vertex_header *tmp = stage->tmp[idx]; - memcpy(tmp, vert, stage->draw->vertex_info.size * sizeof(float) ); + const uint vsize = sizeof(struct vertex_header) + + stage->draw->num_vs_outputs * 4 * sizeof(float); + memcpy(tmp, vert, vsize); tmp->vertex_id = UNDEFINED_VERTEX_ID; return tmp; } diff --git a/src/mesa/pipe/draw/draw_stipple.c b/src/mesa/pipe/draw/draw_stipple.c index 3e0d5689e18..2a47eb7be23 100644 --- a/src/mesa/pipe/draw/draw_stipple.c +++ b/src/mesa/pipe/draw/draw_stipple.c @@ -61,6 +61,7 @@ stipple_stage(struct draw_stage *stage) /** * Compute interpolated vertex attributes for 'dst' at position 't' * between 'v0' and 'v1'. + * XXX using linear interpolation for all attribs at this time. */ static void screen_interp( struct draw_context *draw, @@ -70,28 +71,13 @@ screen_interp( struct draw_context *draw, const struct vertex_header *v1 ) { uint attr; - for (attr = 0; attr < draw->vertex_info.num_attribs; attr++) { - switch (draw->vertex_info.interp_mode[attr]) { - case INTERP_NONE: - case INTERP_CONSTANT: - COPY_4FV(dst->data[attr], v0->data[attr]); - break; - case INTERP_PERSPECTIVE: - /* Fall-through */ - /* XXX special-case perspective? */ - case INTERP_LINEAR: - { - const float *val0 = v0->data[attr]; - const float *val1 = v1->data[attr]; - float *newv = dst->data[attr]; - uint i; - for (i = 0; i < 4; i++) { - newv[i] = val0[i] + t * (val1[i] - val0[i]); - } - } - break; - default: - abort(); + for (attr = 0; attr < draw->num_vs_outputs; attr++) { + const float *val0 = v0->data[attr]; + const float *val1 = v1->data[attr]; + float *newv = dst->data[attr]; + uint i; + for (i = 0; i < 4; i++) { + newv[i] = val0[i] + t * (val1[i] - val0[i]); } } } diff --git a/src/mesa/pipe/draw/draw_twoside.c b/src/mesa/pipe/draw/draw_twoside.c index c7e268f11ed..da8e7bd90df 100644 --- a/src/mesa/pipe/draw/draw_twoside.c +++ b/src/mesa/pipe/draw/draw_twoside.c @@ -30,12 +30,15 @@ #include "pipe/p_util.h" #include "pipe/p_defines.h" +#include "pipe/p_shader_tokens.h" #include "draw_private.h" struct twoside_stage { struct draw_stage stage; float sign; /**< +1 or -1 */ + uint attrib_front0, attrib_back0; + uint attrib_front1, attrib_back1; }; @@ -48,6 +51,29 @@ static INLINE struct twoside_stage *twoside_stage( struct draw_stage *stage ) static void twoside_begin( struct draw_stage *stage ) { struct twoside_stage *twoside = twoside_stage(stage); + const struct pipe_shader_state *vs = stage->draw->vertex_shader->state; + uint i; + + twoside->attrib_front0 = 0; + twoside->attrib_front1 = 0; + twoside->attrib_back0 = 0; + twoside->attrib_back1 = 0; + + /* Find which vertex shader outputs are front/back colors */ + for (i = 0; i < vs->num_outputs; i++) { + if (vs->output_semantic_name[i] == TGSI_SEMANTIC_COLOR) { + if (vs->output_semantic_index[i] == 0) + twoside->attrib_front0 = i; + else + twoside->attrib_front1 = i; + } + if (vs->output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) { + if (vs->output_semantic_index[i] == 0) + twoside->attrib_back0 = i; + else + twoside->attrib_back1 = i; + } + } /* * We'll multiply the primitive's determinant by this sign to determine @@ -76,13 +102,12 @@ static struct vertex_header *copy_bfc( struct twoside_stage *twoside, unsigned idx ) { struct vertex_header *tmp = dup_vert( &twoside->stage, v, idx ); - const struct draw_context *draw = twoside->stage.draw; - if (draw->attrib_front0 && draw->attrib_back0) { - copy_attrib(draw->attrib_front0, draw->attrib_back0, tmp); + if (twoside->attrib_front0 && twoside->attrib_back0) { + copy_attrib(twoside->attrib_front0, twoside->attrib_back0, tmp); } - if (draw->attrib_front1 && draw->attrib_back1) { - copy_attrib(draw->attrib_front1, draw->attrib_back1, tmp); + if (twoside->attrib_front1 && twoside->attrib_back1) { + copy_attrib(twoside->attrib_front1, twoside->attrib_back1, tmp); } return tmp; diff --git a/src/mesa/pipe/draw/draw_vertex.c b/src/mesa/pipe/draw/draw_vertex.c index 6191fcedbf9..1ab004be101 100644 --- a/src/mesa/pipe/draw/draw_vertex.c +++ b/src/mesa/pipe/draw/draw_vertex.c @@ -38,17 +38,6 @@ #include "pipe/draw/draw_vertex.h" -static INLINE void -emit_vertex_attr(struct vertex_info *vinfo, - enum attrib_format format, enum interp_mode interp) -{ - const uint n = vinfo->num_attribs; - vinfo->interp_mode[n] = interp; - vinfo->format[n] = format; - vinfo->num_attribs++; -} - - /** * Compute the size of a vertex, in dwords/floats, to update the * vinfo->size field. @@ -86,62 +75,3 @@ draw_compute_vertex_size(struct vertex_info *vinfo) assert(vinfo->size * 4 <= MAX_VERTEX_SIZE); } - - -/** - * Tell the drawing module about the contents of post-transformation vertices. - * Note that the vertex attribute format info isn't used by 'draw'; all - * attributes are handled as float[4]. But when the driver emits vertices - * it'll use that info. - * We _do_ care about the number of attributes and their interpolation modes. - */ -void -draw_set_vertex_info( struct draw_context *draw, - const struct vertex_info *info) -{ - assert(info->interp_mode[0] == INTERP_LINEAR); /* should be vert pos */ - assert(info->num_attribs <= PIPE_MAX_SHADER_OUTPUTS); - - memcpy(&draw->vertex_info, info, sizeof(*info)); - - /* Need to know vertex size (in words) for vertex copying elsewhere. - * Four words per attribute, plus vertex header (uint) and clip - * position (float[4]). - */ - draw->vertex_info.size = draw->vertex_info.num_attribs * 4 + 5; -} - - -/** - * This function is used to tell the draw module about attributes - * (like colors) that need to be selected based on front/back face - * orientation. - * - * The logic is: - * if (polygon is back-facing) { - * vertex->attrib[front0] = vertex->attrib[back0]; - * vertex->attrib[front1] = vertex->attrib[back1]; - * } - * - * \param front0 first attrib to replace if the polygon is back-facing - * \param back0 first attrib to copy if the polygon is back-facing - * \param front1 second attrib to replace if the polygon is back-facing - * \param back1 second attrib to copy if the polygon is back-facing - * - * Pass -1 to disable two-sided attributes. - */ -void -draw_set_twoside_attributes(struct draw_context *draw, - uint front0, uint back0, - uint front1, uint back1) -{ - /* XXX we could alternately pass an array of front/back attribs if there's - * ever need for more than two. One could imagine a shader extension - * that allows arbitrary attributes to be selected based on polygon - * orientation... - */ - draw->attrib_front0 = front0; - draw->attrib_back0 = back0; - draw->attrib_front1 = front1; - draw->attrib_back1 = back1; -} diff --git a/src/mesa/pipe/draw/draw_vertex.h b/src/mesa/pipe/draw/draw_vertex.h index e4f85bc49f8..28abd8ab910 100644 --- a/src/mesa/pipe/draw/draw_vertex.h +++ b/src/mesa/pipe/draw/draw_vertex.h @@ -34,9 +34,6 @@ #define DRAW_VERTEX_H -struct draw_context; - - /** * Vertex attribute format */ @@ -63,7 +60,7 @@ enum interp_mode { /** - * Information about post-transformed vertex layout. + * Information about hardware/rasterization vertex layout. */ struct vertex_info { @@ -71,7 +68,7 @@ struct vertex_info uint hwfmt[4]; /**< hardware format info for this format */ enum interp_mode interp_mode[PIPE_MAX_SHADER_OUTPUTS]; enum attrib_format format[PIPE_MAX_SHADER_OUTPUTS]; /**< FORMAT_x */ - uint src_index[PIPE_MAX_SHADER_OUTPUTS]; + uint src_index[PIPE_MAX_SHADER_OUTPUTS]; /**< map to post-xform attribs */ uint size; /**< total vertex size in dwords */ }; @@ -98,13 +95,6 @@ draw_emit_vertex_attr(struct vertex_info *vinfo, } -extern void draw_set_vertex_info( struct draw_context *draw, - const struct vertex_info *info); - -extern void draw_set_twoside_attributes(struct draw_context *draw, - uint front0, uint back0, - uint front1, uint back1); - extern void draw_compute_vertex_size(struct vertex_info *vinfo); diff --git a/src/mesa/pipe/draw/draw_vertex_cache.c b/src/mesa/pipe/draw/draw_vertex_cache.c index 29993f14d2f..97a40b876ea 100644 --- a/src/mesa/pipe/draw/draw_vertex_cache.c +++ b/src/mesa/pipe/draw/draw_vertex_cache.c @@ -33,7 +33,6 @@ #include "pipe/p_util.h" #include "draw_private.h" #include "draw_context.h" -#include "draw_vertex.h" void draw_vertex_cache_invalidate( struct draw_context *draw ) diff --git a/src/mesa/pipe/draw/draw_vertex_fetch.c b/src/mesa/pipe/draw/draw_vertex_fetch.c index 3ca17f8829c..4d64d3d4f28 100644 --- a/src/mesa/pipe/draw/draw_vertex_fetch.c +++ b/src/mesa/pipe/draw/draw_vertex_fetch.c @@ -34,7 +34,6 @@ #include "pipe/p_shader_tokens.h" #include "draw_private.h" #include "draw_context.h" -#include "draw_vertex.h" #define DRAW_DBG 0 diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c index c2e038453ec..5ca659dbf59 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader.c +++ b/src/mesa/pipe/draw/draw_vertex_shader.c @@ -38,7 +38,6 @@ #endif #include "draw_private.h" #include "draw_context.h" -#include "draw_vertex.h" #include "x86/rtasm/x86sse.h" #include "pipe/llvm/gallivm.h" @@ -176,7 +175,7 @@ run_vertex_program(struct draw_context *draw, /* Remaining attributes are packed into sequential post-transform * vertex attrib slots. */ - for (slot = 1; slot < draw->vertex_info.num_attribs; slot++) { + for (slot = 1; slot < draw->num_vs_outputs; slot++) { vOut[j]->data[slot][0] = machine->Outputs[slot].xyzw[0].f[j]; vOut[j]->data[slot][1] = machine->Outputs[slot].xyzw[1].f[j]; vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j]; @@ -275,6 +274,8 @@ draw_bind_vertex_shader(struct draw_context *draw, draw_flush(draw); draw->vertex_shader = dvs; + draw->num_vs_outputs = dvs->state->num_outputs; + /* specify the fragment program to interpret/execute */ tgsi_exec_machine_init(&draw->machine, draw->vertex_shader->state->tokens, diff --git a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c index acd61163faa..08be1b83f86 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c +++ b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c @@ -33,7 +33,6 @@ #include "pipe/p_util.h" #include "draw_private.h" #include "draw_context.h" -#include "draw_vertex.h" #ifdef MESA_LLVM @@ -132,7 +131,7 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw) gallivm_prog_exec(prog, inputs, outputs, consts, draw->vs.queue_nr, draw->vertex_shader->state->num_inputs, - draw->vertex_info.num_attribs - 2); + draw->vertex_shader->state->num_outputs); /* store machine results */ @@ -173,7 +172,7 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw) /* Remaining attributes are packed into sequential post-transform * vertex attrib slots. */ - for (slot = 1; slot < draw->vertex_info.num_attribs; slot++) { + for (slot = 1; slot < draw->vs_num_outputs; slot++) { vOut->data[slot][0] = dests[slot][0]; vOut->data[slot][1] = dests[slot][1]; vOut->data[slot][2] = dests[slot][2]; diff --git a/src/mesa/pipe/i915simple/i915_state_derived.c b/src/mesa/pipe/i915simple/i915_state_derived.c index 466c704d87b..1f17de9cef0 100644 --- a/src/mesa/pipe/i915simple/i915_state_derived.c +++ b/src/mesa/pipe/i915simple/i915_state_derived.c @@ -133,10 +133,10 @@ static void calculate_vertex_layout( struct i915_context *i915 ) /* If the attributes have changed, tell the draw module about the new * vertex layout. We'll also update the hardware vertex format info. */ - draw_set_vertex_info( i915->draw, &vinfo); + /*draw_set_vertex_info( i915->draw, &vinfo);*/ - draw_set_twoside_attributes(i915->draw, - front0, back0, front1, back1); + /*draw_set_twoside_attributes(i915->draw, + front0, back0, front1, back1);*/ /* Need to set this flag so that the LIS2/4 registers get set. * It also means the i915_update_immediate() function must be called diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 68c18e2d05b..6dccedbdcb4 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -328,7 +328,7 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys, assert(softpipe->draw); softpipe->setup = sp_draw_render_stage(softpipe); - if (GETENV( "SP_VBUF" ) != NULL) { + if (0 && GETENV( "SP_VBUF" ) != NULL) { softpipe->vbuf = sp_draw_vbuf_stage(softpipe->draw, &softpipe->pipe, sp_vbuf_render); diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index 3537f86a61e..4ce04100759 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -40,6 +40,7 @@ struct softpipe_winsys; +struct softpipe_vbuf_render; struct draw_context; struct draw_stage; struct softpipe_tile_cache; @@ -125,6 +126,7 @@ struct softpipe_context { struct draw_context *draw; struct draw_stage *setup; struct draw_stage *vbuf; + struct softpipe_vbuf_render *vbuf_render; uint current_cbuf; /**< current color buffer being written to */ diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c index cdc385e4dbe..533a2fbd4d1 100644 --- a/src/mesa/pipe/softpipe/sp_prim_setup.c +++ b/src/mesa/pipe/softpipe/sp_prim_setup.c @@ -1278,7 +1278,7 @@ void sp_vbuf_render( struct pipe_context *pipe, struct softpipe_context *softpipe = softpipe_context( pipe ); struct setup_stage *setup = setup_stage( softpipe->setup ); struct prim_header prim; - unsigned vertex_size = setup->stage.draw->vertex_info.size * sizeof(float); + unsigned vertex_size = softpipe->vertex_info.size * sizeof(float); unsigned i, j; prim.det = 0; diff --git a/src/mesa/pipe/softpipe/sp_prim_vbuf.c b/src/mesa/pipe/softpipe/sp_prim_vbuf.c index 055cb19f9a5..1d58e375a99 100644 --- a/src/mesa/pipe/softpipe/sp_prim_vbuf.c +++ b/src/mesa/pipe/softpipe/sp_prim_vbuf.c @@ -263,8 +263,11 @@ static void vbuf_flush_elements( struct draw_stage *stage ) static void vbuf_begin( struct draw_stage *stage ) { struct vbuf_stage *vbuf = vbuf_stage(stage); + struct softpipe_context *softpipe = softpipe_context(vbuf->pipe); - vbuf->vertex_size = vbuf->draw_context->vertex_info.size * sizeof(float); + //vbuf->vertex_size = vbuf->draw_context->vertex_info.size * sizeof(float); + + vbuf->vertex_size = softpipe->vertex_info.size * sizeof(float); } diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c index 0f1410e5ded..64e86a0d86d 100644 --- a/src/mesa/pipe/softpipe/sp_state_derived.c +++ b/src/mesa/pipe/softpipe/sp_state_derived.c @@ -122,6 +122,8 @@ 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 @@ -146,10 +148,11 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) if (1/*vinfo->attr_mask != softpipe->attr_mask*/) { /*softpipe->attr_mask = vinfo->attr_mask;*/ - draw_set_vertex_info( softpipe->draw, vinfo); + /*draw_set_vertex_info( softpipe->draw, vinfo);*/ - draw_set_twoside_attributes(softpipe->draw, + /*draw_set_twoside_attributes(softpipe->draw, front0, back0, front1, back1); + */ } } -- cgit v1.2.3