st/mesa: set colormask to zero when blitting depth
authorMarek Olšák <maraeo@gmail.com>
Mon, 9 Jul 2012 00:23:22 +0000 (02:23 +0200)
committerMarek Olšák <maraeo@gmail.com>
Thu, 12 Jul 2012 00:08:30 +0000 (02:08 +0200)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
src/gallium/auxiliary/util/u_blit.c
src/mesa/state_tracker/st_cb_blit.c

index 6cdfbcaca3e87d638cd850b1af5f0019850bab01..30f4a93d2dc1785fb8700ca19b4402976c37668f 100644 (file)
@@ -56,7 +56,7 @@ struct blit_state
    struct pipe_context *pipe;
    struct cso_context *cso;
 
-   struct pipe_blend_state blend;
+   struct pipe_blend_state blend_write_color, blend_keep_color;
    struct pipe_depth_stencil_alpha_state depthstencil_keep;
    struct pipe_depth_stencil_alpha_state depthstencil_write;
    struct pipe_rasterizer_state rasterizer;
@@ -94,7 +94,7 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
    ctx->cso = cso;
 
    /* disabled blending/masking */
-   ctx->blend.rt[0].colormask = PIPE_MASK_RGBA;
+   ctx->blend_write_color.rt[0].colormask = PIPE_MASK_RGBA;
 
    /* no-op depth/stencil/alpha */
    ctx->depthstencil_write.depth.enabled = 1;
@@ -564,7 +564,11 @@ util_blit_pixels(struct blit_state *ctx,
    cso_save_vertex_buffers(ctx->cso);
 
    /* set misc state we care about */
-   cso_set_blend(ctx->cso, &ctx->blend);
+   if (writemask)
+      cso_set_blend(ctx->cso, &ctx->blend_write_color);
+   else
+      cso_set_blend(ctx->cso, &ctx->blend_keep_color);
+
    cso_set_depth_stencil_alpha(ctx->cso,
                                dst_is_depth ? &ctx->depthstencil_write :
                                               &ctx->depthstencil_keep);
@@ -721,7 +725,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
    cso_save_vertex_buffers(ctx->cso);
 
    /* set misc state we care about */
-   cso_set_blend(ctx->cso, &ctx->blend);
+   cso_set_blend(ctx->cso, &ctx->blend_write_color);
    cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil_keep);
    cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
    cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
index 4547ba7936fd43edb90cee2c334df03dbec89c0c..a50b79a1852c03842e01a248da56afbefa038d21 100644 (file)
@@ -294,7 +294,7 @@ st_BlitFramebuffer(struct gl_context *ctx,
                           srcX0, srcY0, srcX1, srcY1,
                           srcDepthRb->surface->u.tex.first_layer,
                           dstDepthSurf, dstX0, dstY0, dstX1, dstY1,
-                          0.0, pFilter, TGSI_WRITEMASK_XYZW);
+                          0.0, pFilter, 0);
       }
       else {
          /* blitting depth and stencil separately */
@@ -305,7 +305,7 @@ st_BlitFramebuffer(struct gl_context *ctx,
                              srcX0, srcY0, srcX1, srcY1,
                              srcDepthRb->surface->u.tex.first_layer,
                              dstDepthSurf, dstX0, dstY0, dstX1, dstY1,
-                             0.0, pFilter, TGSI_WRITEMASK_XYZW);
+                             0.0, pFilter, 0);
          }
 
          if (mask & GL_STENCIL_BUFFER_BIT) {