r600: fix polygon offset
authorAlex Deucher <alexdeucher@gmail.com>
Sat, 19 Sep 2009 18:46:06 +0000 (14:46 -0400)
committerAlex Deucher <alexdeucher@gmail.com>
Thu, 24 Sep 2009 14:02:08 +0000 (10:02 -0400)
src/mesa/drivers/dri/r600/r700_state.c

index 2a0b41925621ea02e4d4108e06f1fe6ae79a4aac..d8190efe473af05d0ba4a2ea42d46161decbbb1c 100644 (file)
@@ -1122,20 +1122,25 @@ static void r700PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) //
        context_t *context = R700_CONTEXT(ctx);
        R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
        GLfloat constant = units;
+       GLchar depth = 0;
+
+       R600_STATECHANGE(context, poly);
 
        switch (ctx->Visual.depthBits) {
        case 16:
                constant *= 4.0;
+               depth = -16;
                break;
        case 24:
                constant *= 2.0;
+               depth = -24;
                break;
        }
 
        factor *= 12.0;
-
-       R600_STATECHANGE(context, poly);
-
+       SETfield(r700->PA_SU_POLY_OFFSET_DB_FMT_CNTL.u32All, depth,
+                POLY_OFFSET_NEG_NUM_DB_BITS_shift, POLY_OFFSET_NEG_NUM_DB_BITS_mask);
+       //r700->PA_SU_POLY_OFFSET_CLAMP.f32All = constant; //???
        r700->PA_SU_POLY_OFFSET_FRONT_SCALE.f32All = factor;
        r700->PA_SU_POLY_OFFSET_FRONT_OFFSET.f32All = constant;
        r700->PA_SU_POLY_OFFSET_BACK_SCALE.f32All = factor;