summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/cell/spu/spu_tri.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-09-11 17:59:52 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-09-11 17:59:52 -0600
commitaa66f08a21b791f338b519f0c2162cd8f7b3aeb0 (patch)
tree1e8c8e2e01f98759b9ab073d340daca837b65932 /src/gallium/drivers/cell/spu/spu_tri.c
parentdbbbc333442c160b2801062e92c6c5931b64390a (diff)
cell: initial support for fragment shader code generation.
TGSI shaders are translated into SPE instructions which are then sent to the SPEs for execution. Only a few opcodes work, no swizzling yet, no support for constants/immediates, etc.
Diffstat (limited to 'src/gallium/drivers/cell/spu/spu_tri.c')
-rw-r--r--src/gallium/drivers/cell/spu/spu_tri.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/gallium/drivers/cell/spu/spu_tri.c b/src/gallium/drivers/cell/spu/spu_tri.c
index f02cdd1f76..8b93878192 100644
--- a/src/gallium/drivers/cell/spu/spu_tri.c
+++ b/src/gallium/drivers/cell/spu/spu_tri.c
@@ -314,7 +314,42 @@ emit_quad( int x, int y, mask_t mask )
}
else {
/* simple shading */
+#if 0
eval_coeff(1, (float) x, (float) y, colors);
+
+#else
+ /* XXX new fragment program code */
+
+ if (spu.fragment_program) {
+ vector float inputs[4*4], outputs[2*4];
+
+ /* setup inputs */
+ eval_coeff(1, (float) x, (float) y, inputs);
+
+ /* Execute the current fragment program */
+ spu.fragment_program(inputs, outputs, spu.constants);
+
+ /* Copy outputs */
+ colors[0] = outputs[0*4+0];
+ colors[1] = outputs[0*4+1];
+ colors[2] = outputs[0*4+2];
+ colors[3] = outputs[0*4+3];
+
+ if (0 && spu.init.id==0 && y == 48) {
+ printf("colors[0] = %f %f %f %f\n",
+ spu_extract(colors[0], 0),
+ spu_extract(colors[0], 1),
+ spu_extract(colors[0], 2),
+ spu_extract(colors[0], 3));
+ printf("colors[1] = %f %f %f %f\n",
+ spu_extract(colors[1], 0),
+ spu_extract(colors[1], 1),
+ spu_extract(colors[1], 2),
+ spu_extract(colors[1], 3));
+ }
+
+ }
+#endif
}