From 95fa98d61a857448e690a0671b2e1e1d2873f0ec Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Jan 2009 15:06:06 -0700 Subject: i965: init dst reg RelAddr field to zero --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mesa/drivers/dri/i965/brw_wm_fp.c') diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 7f7b957cbe..cb1e40097b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -122,10 +122,11 @@ static struct prog_dst_register dst_reg(GLuint file, GLuint idx) reg.File = file; reg.Index = idx; reg.WriteMask = WRITEMASK_XYZW; + reg.RelAddr = 0; reg.CondMask = 0; reg.CondSwizzle = 0; - reg.pad = 0; reg.CondSrc = 0; + reg.pad = 0; return reg; } -- cgit v1.2.3 From f68f94c2bc950405d4c91a1e5582a35ff4b15bdf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Jan 2009 18:45:49 -0700 Subject: 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. --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/i965/brw_wm_fp.c') diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index cb1e40097b..f4583877aa 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); -- cgit v1.2.3 From de35989cdec9807c60b2b4389e5988037ce23d95 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 9 Jan 2009 15:52:04 -0700 Subject: i965: fix broken ARB fp fog options Just call _mesa_append_fog_code() if the fragment program's FogOption is not GL_NONE. This allows us to remove some unnecessary i965 fog code. Note, the arbfplight.c demo can be used to test this (see DO_FRAGMENT_FOG). --- src/mesa/drivers/dri/i965/brw_program.c | 6 ++++ src/mesa/drivers/dri/i965/brw_wm_fp.c | 52 --------------------------------- 2 files changed, 6 insertions(+), 52 deletions(-) (limited to 'src/mesa/drivers/dri/i965/brw_wm_fp.c') diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index a18dee85e8..0c86911044 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -111,9 +111,15 @@ static void brwProgramStringNotify( GLcontext *ctx, struct gl_program *prog ) { if (target == GL_FRAGMENT_PROGRAM_ARB) { + struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog; struct brw_context *brw = brw_context(ctx); struct brw_fragment_program *p = (struct brw_fragment_program *)prog; struct brw_fragment_program *fp = (struct brw_fragment_program *)brw->fragment_program; + if (fprog->FogOption) { + _mesa_append_fog_code(ctx, fprog); + fprog->FogOption = GL_NONE; + } + if (p == fp) brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM; p->id = brw->program_id++; diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index f4583877aa..1a00b69825 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -811,57 +811,6 @@ static void precalc_txp( struct brw_wm_compile *c, - - -/*********************************************************************** - * Add instructions to perform fog blending - */ - -static void fog_blend( struct brw_wm_compile *c, - struct prog_src_register fog_factor ) -{ - struct prog_dst_register outcolor = dst_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); - struct prog_src_register fogcolor = search_or_add_param5( c, STATE_FOG_COLOR, 0,0,0,0 ); - - /* color.xyz = LRP fog_factor.xxxx, output_color, fog_color */ - - emit_op(c, - OPCODE_LRP, - dst_mask(outcolor, WRITEMASK_XYZ), - 0, 0, 0, - fog_factor, - src_reg_from_dst(outcolor), - fogcolor); -} - - - -/* This one is simple - just take the interpolated fog coordinate and - * use it as the fog blend factor. - */ -static void fog_interpolated( struct brw_wm_compile *c ) -{ - struct prog_src_register fogc = src_reg(PROGRAM_INPUT, FRAG_ATTRIB_FOGC); - - if (!(c->fp_interp_emitted & (1<fp->program.FogOption) - return; - - if (1) - fog_interpolated( c ); - else { - /* TODO: per-pixel fog */ - assert(0); - } -} - static void emit_fb_write( struct brw_wm_compile *c ) { struct prog_src_register payload_r0_depth = src_reg(PROGRAM_PAYLOAD, PAYLOAD_DEPTH); @@ -1059,7 +1008,6 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) emit_ddy(c, inst); break; case OPCODE_END: - emit_fog(c); emit_fb_write(c); break; case OPCODE_PRINT: -- cgit v1.2.3