i965: Set the fast clear color value for texture surfaces
authorNeil Roberts <neil@linux.intel.com>
Mon, 9 Jun 2014 16:43:37 +0000 (17:43 +0100)
committerNeil Roberts <neil@linux.intel.com>
Thu, 12 Jun 2014 10:24:04 +0000 (11:24 +0100)
When a multisampled texture is used for sampling the fast clear color value
needs to be programmed into the surface state. This was being left as all
zeroes so if the surface was cleared to a value other than black then it
wouldn't work properly. This doesn't matter for single-sample textures because
in that case the MCS buffer is resolved before it is used as a texture source.

https://bugs.freedesktop.org/show_bug.cgi?id=79729

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
src/mesa/drivers/dri/i965/gen8_surface_state.c

index b31f491ae65069f9125f4ead518a2f53a7933bbf..12cdc2b4cc6bb618c0efa66f187c7db9bf43e42e 100644 (file)
@@ -337,6 +337,8 @@ gen7_update_texture_surface(struct gl_context *ctx,
               /* mip count */
               (intelObj->_MaxLevel - tObj->BaseLevel));
 
+   surf[7] = mt->fast_clear_color_value;
+
    if (brw->is_haswell) {
       /* Handling GL_ALPHA as a surface format override breaks 1.30+ style
        * texturing functions that return a float, as our code generation always
@@ -351,7 +353,7 @@ gen7_update_texture_surface(struct gl_context *ctx,
 
       const bool need_scs_green_to_blue = for_gather && tex_format == BRW_SURFACEFORMAT_R32G32_FLOAT_LD;
 
-      surf[7] =
+      surf[7] |=
          SET_FIELD(brw_swizzle_to_scs(GET_SWZ(swizzle, 0), need_scs_green_to_blue), GEN7_SURFACE_SCS_R) |
          SET_FIELD(brw_swizzle_to_scs(GET_SWZ(swizzle, 1), need_scs_green_to_blue), GEN7_SURFACE_SCS_G) |
          SET_FIELD(brw_swizzle_to_scs(GET_SWZ(swizzle, 2), need_scs_green_to_blue), GEN7_SURFACE_SCS_B) |
index 406f68e198764814af22d066b3fe349c45dc52fc..80ac4f3eda500dcc054edf9d390ee40369e4af92 100644 (file)
@@ -207,9 +207,11 @@ gen8_update_texture_surface(struct gl_context *ctx,
       (firstImage->_BaseFormat == GL_DEPTH_COMPONENT ||
        firstImage->_BaseFormat == GL_DEPTH_STENCIL);
 
+   surf[7] = mt->fast_clear_color_value;
+
    const int swizzle =
       unlikely(alpha_depth) ? SWIZZLE_XYZW : brw_get_texture_swizzle(ctx, tObj);
-   surf[7] =
+   surf[7] |=
       SET_FIELD(brw_swizzle_to_scs(GET_SWZ(swizzle, 0), false), GEN7_SURFACE_SCS_R) |
       SET_FIELD(brw_swizzle_to_scs(GET_SWZ(swizzle, 1), false), GEN7_SURFACE_SCS_G) |
       SET_FIELD(brw_swizzle_to_scs(GET_SWZ(swizzle, 2), false), GEN7_SURFACE_SCS_B) |