diff options
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r-- | src/mesa/pipe/p_state.h | 12 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_quad_fs.c | 30 |
2 files changed, 32 insertions, 10 deletions
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h index e3f62a80ad..c3704177b3 100644 --- a/src/mesa/pipe/p_state.h +++ b/src/mesa/pipe/p_state.h @@ -122,18 +122,18 @@ struct pipe_clip_state { }; -struct pipe_fs_state { - GLuint inputs_read; /* FRAG_ATTRIB_* */ - const struct tgsi_token *tokens; - -}; - struct pipe_constant_buffer { GLfloat constant[PIPE_MAX_CONSTANT][4]; GLuint nr_constants; }; +struct pipe_fs_state { + GLuint inputs_read; /* FRAG_ATTRIB_* */ + const struct tgsi_token *tokens; + struct pipe_constant_buffer *constants; /* XXX temporary? */ +}; + struct pipe_depth_state { GLuint enabled:1; /**< depth test enabled? */ diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c index 536365f219..846c330056 100644 --- a/src/mesa/pipe/softpipe/sp_quad_fs.c +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -190,16 +190,21 @@ shade_quad( struct quad_stage *qs, struct quad_header *quad ) struct tgsi_exec_vector outputs[FRAG_ATTRIB_MAX + 1]; struct tgsi_exec_vector *ainputs; struct tgsi_exec_vector *aoutputs; - GLuint i, total; + GLuint i /*, total*/; + +#ifdef DEBUG + memset(&machine, 0, sizeof(machine)); +#endif ainputs = (struct tgsi_exec_vector *) tgsi_align_128bit( inputs ); aoutputs = (struct tgsi_exec_vector *) tgsi_align_128bit( outputs ); +#if 0 for( i = total = 0; i < PIPE_ATTRIB_MAX; i++ ) { GLuint attr; attr = softpipe->fp_attr_to_slot[i]; - if( attr ) { + if( attr || total == 0) { assert( total < FRAG_ATTRIB_MAX ); assert( attr < FRAG_ATTRIB_MAX ); assert( sizeof( ainputs[0] ) == sizeof( exec.attr[0] ) ); @@ -211,16 +216,33 @@ shade_quad( struct quad_stage *qs, struct quad_header *quad ) total++; } } +#else + /* load input registers */ + /* XXX simpler than above, but might not be right... */ + for (i = 0; i < softpipe->nr_attrs; i++) { + memcpy( + &ainputs[i], + exec.attr[i], + sizeof( ainputs[0] ) ); + } +#endif + /* init machine state */ tgsi_exec_machine_init( &machine, softpipe->fs.tokens ); machine.Inputs = ainputs; machine.Outputs = aoutputs; + machine.Consts = softpipe->fs.constants->constant; /* XXX alignment? */ + + /* run shader */ + tgsi_exec_machine_run( &machine ); - tgsi_exec_machine_run( - &machine ); + /* store result color */ + memcpy(quad->outputs.color, + &aoutputs[FRAG_ATTRIB_COL0].xyzw[0].f[0], + sizeof(quad->outputs.color)); } #else { |