Browse Source

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).
tags/mesa_7_3_rc2
Brian Paul 16 years ago
parent
commit
de35989cde
2 changed files with 6 additions and 52 deletions
  1. 6
    0
      src/mesa/drivers/dri/i965/brw_program.c
  2. 0
    52
      src/mesa/drivers/dri/i965/brw_wm_fp.c

+ 6
- 0
src/mesa/drivers/dri/i965/brw_program.c View File

@@ -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++;

+ 0
- 52
src/mesa/drivers/dri/i965/brw_wm_fp.c View File

@@ -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<<FRAG_ATTRIB_FOGC)))
emit_interp(c, FRAG_ATTRIB_FOGC);

fog_blend( c, src_swizzle1(fogc, GET_SWZ(fogc.Swizzle,X)));
}

static void emit_fog( struct brw_wm_compile *c )
{
if (!c->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:

Loading…
Cancel
Save