From: michal Date: Mon, 23 Jul 2007 16:26:25 +0000 (+0200) Subject: Execute fs tokens. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=98eaf5503d0d7c4f18fab6910a08aba7a3d08639;p=mesa.git Execute fs tokens. Fix align128 bug. --- diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c index 7b1c90cba66..536365f2193 100644 --- a/src/mesa/pipe/softpipe/sp_quad_fs.c +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -37,6 +37,7 @@ #include "sp_context.h" #include "sp_headers.h" #include "sp_quad.h" +#include "core/tgsi_core.h" struct exec_machine { const struct setup_coefficient *coef; /**< will point to quad->coef */ @@ -180,8 +181,47 @@ shade_quad( struct quad_stage *qs, struct quad_header *quad ) #endif } -#if 0 - softpipe->run_fs( tri->fp, quad, &tri->outputs ); +#if 1 + /*softpipe->run_fs( tri->fp, quad, &tri->outputs );*/ + + { + struct tgsi_exec_machine machine; + struct tgsi_exec_vector inputs[FRAG_ATTRIB_MAX + 1]; + struct tgsi_exec_vector outputs[FRAG_ATTRIB_MAX + 1]; + struct tgsi_exec_vector *ainputs; + struct tgsi_exec_vector *aoutputs; + GLuint i, total; + + ainputs = (struct tgsi_exec_vector *) tgsi_align_128bit( inputs ); + aoutputs = (struct tgsi_exec_vector *) tgsi_align_128bit( outputs ); + + for( i = total = 0; i < PIPE_ATTRIB_MAX; i++ ) { + GLuint attr; + + attr = softpipe->fp_attr_to_slot[i]; + if( attr ) { + assert( total < FRAG_ATTRIB_MAX ); + assert( attr < FRAG_ATTRIB_MAX ); + assert( sizeof( ainputs[0] ) == sizeof( exec.attr[0] ) ); + + memcpy( + &ainputs[total], + exec.attr[attr], + sizeof( ainputs[0] ) ); + total++; + } + } + + tgsi_exec_machine_init( + &machine, + softpipe->fs.tokens ); + + machine.Inputs = ainputs; + machine.Outputs = aoutputs; + + tgsi_exec_machine_run( + &machine ); + } #else { GLuint attr = softpipe->fp_attr_to_slot[FRAG_ATTRIB_COL0]; diff --git a/src/mesa/pipe/tgsi/core/tgsi_util.c b/src/mesa/pipe/tgsi/core/tgsi_util.c index 2331affdfdf..38d6d6e6bcd 100644 --- a/src/mesa/pipe/tgsi/core/tgsi_util.c +++ b/src/mesa/pipe/tgsi/core/tgsi_util.c @@ -1,15 +1,22 @@ #include "tgsi_platform.h" #include "tgsi_core.h" +union pointer_hack +{ + void *pointer; + unsigned long long uint64; +}; + void * tgsi_align_128bit( void *unaligned ) { - GLuint *ptr, addr; + union pointer_hack ph; - ptr = (GLuint *) unaligned; - addr = (*(GLuint *) &ptr + 15) & ~15; - return *(void **) &addr; + ph.uint64 = 0; + ph.pointer = unaligned; + ph.uint64 = (ph.uint64 + 15) & ~15; + return ph.pointer; } GLuint