i965: Remove linear_color for GL_PERSPECTIVE_CORRECTION_HINT.
authorEric Anholt <eric@anholt.net>
Thu, 19 May 2011 15:48:42 +0000 (08:48 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 26 May 2011 17:07:38 +0000 (10:07 -0700)
From the GL 2.1 spec:

   "Required perspective-correct interpolation for all fragment
    attributes except depth in sections 3.4.1 and 3.5.1, effectively
    making GL PERSPECTIVE CORRECT HINT a no-op."

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_sf.c
src/mesa/drivers/dri/i965/brw_sf.h
src/mesa/drivers/dri/i965/brw_sf_emit.c
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/brw_wm.h
src/mesa/drivers/dri/i965/brw_wm_fp.c

index a4adb17954396982dc9f8bc8f3ddda092ae855b5..c02237850e2c80353a1b53d796073304b5c1810f 100644 (file)
@@ -584,7 +584,7 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
               attr.reg_offset++;
            }
 
-           if (intel->gen < 6 && !(is_gl_Color && c->key.linear_color)) {
+           if (intel->gen < 6) {
               attr.reg_offset -= type->vector_elements;
               for (unsigned int k = 0; k < type->vector_elements; k++) {
                  emit(BRW_OPCODE_MUL, attr, attr, this->pixel_w);
index 9b82fe159f92bce1609415b45947f25bc8fda117..c2227777cfb645b4517ac07e8fb06d4d00fea0cd 100644 (file)
@@ -181,9 +181,6 @@ static void upload_sf_prog(struct brw_context *brw)
    key.do_flat_shading = (ctx->Light.ShadeModel == GL_FLAT);
    key.do_twoside_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide);
 
-   /* _NEW_HINT */
-   key.linear_color = (ctx->Hint.PerspectiveCorrection == GL_FASTEST);
-
    /* _NEW_POLYGON */
    if (key.do_twoside_color) {
       /* If we're rendering to a FBO, we have to invert the polygon
index e525c730d3f4310fa57e243d1a8f961f5b91b433..be32085c69769b9b4e4f7b88aaeac79f152aa9c8 100644 (file)
@@ -52,7 +52,6 @@ struct brw_sf_prog_key {
    GLuint do_flat_shading:1;
    GLuint frontface_ccw:1;
    GLuint do_point_sprite:1;
-   GLuint linear_color:1;  /**< linear interp vs. perspective interp */
    GLuint sprite_origin_lower_left:1;
    GLuint pad:24;
 };
index 4b2e26cbed7e57c603b98e217db2ceaa7e1b9ac7..52a3fb3893d14416d228de432f277ab16839f6f0 100644 (file)
@@ -316,7 +316,7 @@ static GLboolean calculate_masks( struct brw_sf_compile *c,
    GLbitfield64 persp_mask;
    GLbitfield64 linear_mask;
 
-   if (c->key.do_flat_shading || c->key.linear_color)
+   if (c->key.do_flat_shading)
       persp_mask = c->key.attrs & ~(FRAG_BIT_WPOS |
                                     FRAG_BIT_COL0 |
                                     FRAG_BIT_COL1);
index 907976295ab9cd0354465b68820d9d4272d03f91..61b2262cfa62d5e193052abfd14a82ec93ce39c6 100644 (file)
@@ -355,9 +355,6 @@ static void brw_wm_populate_key( struct brw_context *brw,
    /* _NEW_LIGHT */
    key->flat_shade = (ctx->Light.ShadeModel == GL_FLAT);
 
-   /* _NEW_HINT */
-   key->linear_color = (ctx->Hint.PerspectiveCorrection == GL_FASTEST);
-
    /* _NEW_FRAG_CLAMP | _NEW_BUFFERS */
    key->clamp_fragment_color = ctx->Color._ClampFragmentColor;
 
@@ -489,7 +486,6 @@ const struct brw_tracked_state brw_wm_prog = {
    .dirty = {
       .mesa  = (_NEW_COLOR |
                _NEW_DEPTH |
-                _NEW_HINT |
                _NEW_STENCIL |
                _NEW_POLYGON |
                _NEW_LINE |
index 8ab531bdf873f551e2032a407e8ad0ca1a1ecf27..e5f7a79a19701c05f924a944a2f69f919c3eefe5 100644 (file)
@@ -61,7 +61,6 @@
 struct brw_wm_prog_key {
    GLuint stats_wm:1;
    GLuint flat_shade:1;
-   GLuint linear_color:1;  /**< linear interpolation vs perspective interp */
    GLuint nr_color_regions:5;
    GLuint render_to_fbo:1;
    GLuint alpha_test:1;
index 9ddbee2edf41669c0978e4055fa723c28cf91c23..59dcda7b414b71d21fbab6652dde90f5e68b0860 100644 (file)
@@ -417,25 +417,14 @@ static void emit_interp( struct brw_wm_compile *c,
                 src_undef());
       }
       else {
-         if (c->key.linear_color) {
-            emit_op(c,
-                    WM_LINTERP,
-                    dst,
-                    0,
-                    interp,
-                    deltas,
-                    src_undef());
-         }
-         else {
-            /* perspective-corrected color interpolation */
-            emit_op(c,
-                    WM_PINTERP,
-                    dst,
-                    0,
-                    interp,
-                    deltas,
-                    get_pixel_w(c));
-         }
+        /* perspective-corrected color interpolation */
+        emit_op(c,
+                WM_PINTERP,
+                dst,
+                0,
+                interp,
+                deltas,
+                get_pixel_w(c));
       }
       break;
    case FRAG_ATTRIB_FOGC: