summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-10-12 09:42:06 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-10-12 09:42:06 -0600
commite552b9bd099b9fce1cd58ce7922a0c9f74cad034 (patch)
treedfc4a90c891ed4104396c5bf5f9c58de21086baf /src/mesa/state_tracker
parent3fb88639af09af2f77203fd633c19ea736a7c0e5 (diff)
initial use of KIL for glBitmap rendering
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c51
1 files changed, 44 insertions, 7 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index f58b5d947d..f3d624f14b 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -66,8 +66,14 @@ make_fragment_shader(struct st_context *st, GLboolean bitmapMode)
if (!p)
return NULL;
+#define CULL 1 /* Use KIL to cull 0 bits/pixels in bitmap? */
+
if (bitmapMode)
+#if CULL
+ p->NumInstructions = 7;
+#else
p->NumInstructions = 3;
+#endif
else
p->NumInstructions = 2;
@@ -95,6 +101,36 @@ make_fragment_shader(struct st_context *st, GLboolean bitmapMode)
p->Instructions[ic].TexSrcUnit = 0;
p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX;
ic++;
+#if CULL
+ /* IF temp0 */
+ p->Instructions[ic].Opcode = OPCODE_IF;
+ p->Instructions[ic].SrcReg[0].File = PROGRAM_TEMPORARY;
+ p->Instructions[ic].SrcReg[0].Index = 0;
+ p->Instructions[ic].SrcReg[0].Swizzle = SWIZZLE_WWWW;
+ p->Instructions[ic].BranchTarget = ic + 2;
+ ic++;
+
+ /* MOV result.color, fragment.color */
+ p->Instructions[ic].Opcode = OPCODE_MOV;
+ p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
+ p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLR;
+ p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
+ p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0;
+ ic++;
+
+ /* ELSE */
+ p->Instructions[ic].Opcode = OPCODE_ELSE;
+ p->Instructions[ic].BranchTarget = ic + 2;
+ ic++;
+
+ /* KILL */
+ p->Instructions[ic].Opcode = OPCODE_KIL_NV;
+ ic++;
+
+ /* ENDIF */
+ p->Instructions[ic].Opcode = OPCODE_ENDIF;
+ ic++;
+#else
/* MUL result.color, temp0.xxxx, fragment.color */
p->Instructions[ic].Opcode = OPCODE_MUL;
p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
@@ -105,17 +141,18 @@ make_fragment_shader(struct st_context *st, GLboolean bitmapMode)
p->Instructions[ic].SrcReg[1].File = PROGRAM_INPUT;
p->Instructions[ic].SrcReg[1].Index = FRAG_ATTRIB_COL0;
ic++;
+#endif
}
else {
/* DrawPixels mode */
/* TEX result.color, fragment.texcoord[0], texture[0], 2D; */
- p->Instructions[0].Opcode = OPCODE_TEX;
- p->Instructions[0].DstReg.File = PROGRAM_OUTPUT;
- p->Instructions[0].DstReg.Index = FRAG_RESULT_COLR;
- p->Instructions[0].SrcReg[0].File = PROGRAM_INPUT;
- p->Instructions[0].SrcReg[0].Index = FRAG_ATTRIB_TEX0;
- p->Instructions[0].TexSrcUnit = 0;
- p->Instructions[0].TexSrcTarget = TEXTURE_2D_INDEX;
+ p->Instructions[ic].Opcode = OPCODE_TEX;
+ p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
+ p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLR;
+ p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
+ p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0;
+ p->Instructions[ic].TexSrcUnit = 0;
+ p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX;
ic++;
}
/* END; */