summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe/sp_quad_fs.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-07-24 12:27:38 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-07-24 12:27:38 -0600
commit43d7c1fe9d2544b851afa2f1c1e245a63860e670 (patch)
treef5580653e90f21ec86f721e4a1753e19d675adbb /src/mesa/pipe/softpipe/sp_quad_fs.c
parentef3849ffa0af7f2aad8a69a7d04a4dd780fa247b (diff)
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).
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_quad_fs.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_fs.c30
1 files changed, 26 insertions, 4 deletions
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
{