Merge branch 'master' into pipe-format-simplify
[mesa.git] / src / gallium / state_trackers / xorg / xorg_composite.c
index 99e357328d18c413295f5ce3fb1c570a6bbef27d..1c248a629e681e24625a98125bb6d0323492d761 100644 (file)
@@ -423,23 +423,6 @@ bind_samplers(struct exa_context *exa, int op,
 
 
 
-static void
-setup_fs_constant_buffer(struct exa_context *exa)
-{
-   const int param_bytes = 4 * sizeof(float);
-   const float fs_consts[8] = {
-      0, 0, 0, 1,
-   };
-   renderer_set_constants(exa->renderer, PIPE_SHADER_FRAGMENT,
-                          fs_consts, param_bytes);
-}
-
-static void
-setup_constant_buffers(struct exa_context *exa, struct exa_pixmap_priv *pDst)
-{
-   setup_fs_constant_buffer(exa);
-}
-
 static INLINE boolean matrix_from_pict_transform(PictTransform *trans, float *matrix)
 {
    if (!trans)
@@ -489,14 +472,14 @@ boolean xorg_composite_bind_state(struct exa_context *exa,
 {
    struct pipe_surface *dst_surf = xorg_gpu_surface(exa->scrn, pDst);
 
-   renderer_bind_destination(exa->renderer, dst_surf);
+   renderer_bind_destination(exa->renderer, dst_surf,
+                             pDst->width,
+                             pDst->height);
 
    bind_blend_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture);
-   renderer_bind_rasterizer(exa->renderer);
    bind_shaders(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc, pMask);
    bind_samplers(exa, op, pSrcPicture, pMaskPicture,
                  pDstPicture, pSrc, pMask, pDst);
-   setup_constant_buffers(exa, pDst);
 
    setup_transforms(exa, pSrcPicture, pMaskPicture);
 
@@ -508,6 +491,8 @@ boolean xorg_composite_bind_state(struct exa_context *exa,
                               exa->num_bound_samplers);
    }
 
+
+   pipe_surface_reference(&dst_surf, NULL);
    return TRUE;
 }
 
@@ -560,12 +545,11 @@ boolean xorg_solid_bind_state(struct exa_context *exa,
    vs_traits = VS_SOLID_FILL;
    fs_traits = FS_SOLID_FILL;
 
-   renderer_bind_destination(exa->renderer, dst_surf);
-   renderer_bind_rasterizer(exa->renderer);
+   renderer_bind_destination(exa->renderer, dst_surf
+                             pixmap->width, pixmap->height);
    bind_blend_state(exa, PictOpSrc, NULL, NULL, NULL);
    cso_set_samplers(exa->renderer->cso, 0, NULL);
    cso_set_sampler_textures(exa->renderer->cso, 0, NULL);
-   setup_constant_buffers(exa, pixmap);
 
    shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits);
    cso_set_vertex_shader_handle(exa->renderer->cso, shader.vs);
@@ -573,6 +557,7 @@ boolean xorg_solid_bind_state(struct exa_context *exa,
 
    renderer_begin_solid(exa->renderer);
 
+   pipe_surface_reference(&dst_surf, NULL);
    return TRUE;
 }
 
@@ -584,3 +569,13 @@ void xorg_solid(struct exa_context *exa,
                   x0, y0, x1, y1, exa->solid_color);
 }
 
+void
+xorg_composite_done(struct exa_context *exa)
+{
+   renderer_draw_flush(exa->renderer);
+
+   exa->transform.has_src = FALSE;
+   exa->transform.has_mask = FALSE;
+   exa->has_solid_color = FALSE;
+   exa->num_bound_samplers = 0;
+}