gallium: Add blending to pipe blit
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 31 May 2014 21:13:24 +0000 (23:13 +0200)
committerAxel Davy <axel.davy@ens.fr>
Fri, 21 Aug 2015 20:21:45 +0000 (22:21 +0200)
This type of blending is used for gallium nine software cursor

Signed-off-by: David Heidelberg <david@ixit.cz>
src/gallium/include/pipe/p_state.h
src/gallium/state_trackers/nine/device9.c
src/gallium/state_trackers/nine/swapchain9.c
src/mesa/state_tracker/st_cb_blit.c

index 1e493f47ccf63c8eaa8e05585c4d53e480f03ac9..266ebbafe36b0d4cfd114af1b65681aee97aa0fd 100644 (file)
@@ -663,6 +663,7 @@ struct pipe_blit_info
 
    boolean render_condition_enable; /**< whether the blit should honor the
                                     current render condition */
+   boolean alpha_blend; /* dst.rgb = src.rgb * src.a + dst.rgb * (1 - src.a) */
 };
 
 
index 38af8e3bc5864eb0f705333eb7aae651709e666e..a1c05b48ff4ce3fd1cf1c69f7d9a5e57597a4a6d 100644 (file)
@@ -1460,6 +1460,7 @@ NineDevice9_StretchRect( struct NineDevice9 *This,
     blit.filter = Filter == D3DTEXF_LINEAR ?
        PIPE_TEX_FILTER_LINEAR : PIPE_TEX_FILTER_NEAREST;
     blit.scissor_enable = FALSE;
+    blit.alpha_blend = FALSE;
 
     /* If both of a src and dst dimension are negative, flip them. */
     if (blit.dst.box.width < 0 && blit.src.box.width < 0) {
index eb84d08eab076f899f82a788131f1c278eb2a336..b8ad403456cf18030d5380030ea11685bb6059c9 100644 (file)
@@ -588,6 +588,7 @@ handle_draw_cursor_and_hud( struct NineSwapChain9 *This, struct pipe_resource *r
             blit.src.box.width, blit.src.box.height,
             blit.dst.box.x, blit.dst.box.y);
 
+        blit.alpha_blend = TRUE;
         This->pipe->blit(This->pipe, &blit);
     }
 
@@ -705,6 +706,7 @@ present( struct NineSwapChain9 *This,
         blit.mask = PIPE_MASK_RGBA;
         blit.filter = PIPE_TEX_FILTER_NEAREST;
         blit.scissor_enable = FALSE;
+        blit.alpha_blend = FALSE;
 
         This->pipe->blit(This->pipe, &blit);
     }
index 139690615d664c9be36afe44c15cc82b77b80371..4fdef7fb5a6766e638c5e9a16d0a8f8514bb4cc8 100644 (file)
@@ -192,6 +192,7 @@ st_BlitFramebuffer(struct gl_context *ctx,
 
    blit.filter = pFilter;
    blit.render_condition_enable = TRUE;
+   blit.alpha_blend = FALSE;
 
    if (mask & GL_COLOR_BUFFER_BIT) {
       struct gl_renderbuffer_attachment *srcAtt =