summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-01-07 18:45:49 -0700
committerAlan Hourihane <[email protected]>2009-01-09 11:16:38 +0000
commitac984c95ed28dfad8a09e168e9e4cb41cf31d039 (patch)
tree92c1a26247a0f11d5e4c87a7ce68f8cd5f2a9c75 /src/mesa
parentefd120842498a908bf722413ed603e368f2e18b3 (diff)
i965: allow gl_FragData[0] usage when there's only one color buffer
If gl_FragData[0] is written but not gl_FragCOlor, use the former.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_fp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c
index cb1e40097bd..f4583877aa5 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -864,9 +864,9 @@ static void emit_fog( struct brw_wm_compile *c )
static void emit_fb_write( struct brw_wm_compile *c )
{
- struct prog_src_register outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
struct prog_src_register payload_r0_depth = src_reg(PROGRAM_PAYLOAD, PAYLOAD_DEPTH);
struct prog_src_register outdepth = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DEPR);
+ struct prog_src_register outcolor;
GLuint i;
struct prog_instruction *inst, *last_inst;
@@ -890,7 +890,14 @@ static void emit_fb_write( struct brw_wm_compile *c )
}
}
last_inst->Sampler |= 1; //eot
- }else {
+ }
+ else {
+ /* if gl_FragData[0] is written, use it, else use gl_FragColor */
+ if (c->fp->program.Base.OutputsWritten & (1 << FRAG_RESULT_DATA0))
+ outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0);
+ else
+ outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
+
inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0),
0, 0, 0, outcolor, payload_r0_depth, outdepth);
inst->Sampler = 1|(0<<1);