From 43d7c1fe9d2544b851afa2f1c1e245a63860e670 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 24 Jul 2007 12:27:38 -0600 Subject: Basic fragment programs run now. Handling of constants might change. For now, the st_fragment_program struct contains a pipe_constant_buffer (not a pointer). --- src/mesa/pipe/softpipe/sp_quad_fs.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src/mesa/pipe/softpipe') 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 { -- cgit v1.2.3