gallium: change set_constant_buffer to be UBO-friendly
[mesa.git] / src / gallium / state_trackers / xa / xa_renderer.c
index ef762f0ab49c00b2f13393f3400047b6dd9c5ddd..8ba6e1ead691e01ba07c3b5a8f4895520fffb6f6 100644 (file)
@@ -130,6 +130,7 @@ renderer_init_state(struct xa_context *r)
     /* XXX: move to renderer_init_state? */
     memset(&raster, 0, sizeof(struct pipe_rasterizer_state));
     raster.gl_rasterization_rules = 1;
+    raster.depth_clip = 1;
     cso_set_rasterizer(r->cso, &raster);
 
     /* vertex elements state */
@@ -407,13 +408,15 @@ renderer_set_constants(struct xa_context *r,
     if (*cbuf) {
        pipe_buffer_write(r->pipe, *cbuf, 0, param_bytes, params);
     }
-    r->pipe->set_constant_buffer(r->pipe, shader_type, 0, *cbuf);
+    pipe_set_constant_buffer(r->pipe, shader_type, 0, *cbuf);
 }
 
 void
 renderer_copy_prepare(struct xa_context *r,
                      struct pipe_surface *dst_surface,
-                     struct pipe_resource *src_texture)
+                     struct pipe_resource *src_texture,
+                     const enum xa_formats src_xa_format,
+                     const enum xa_formats dst_xa_format)
 {
     struct pipe_context *pipe = r->pipe;
     struct pipe_screen *screen = pipe->screen;
@@ -474,6 +477,9 @@ renderer_copy_prepare(struct xa_context *r,
        fs_traits |= FS_SRC_LUMINANCE;
     if (dst_surface->format == PIPE_FORMAT_L8_UNORM)
        fs_traits |= FS_DST_LUMINANCE;
+    if (xa_format_a(dst_xa_format) != 0 &&
+       xa_format_a(src_xa_format) == 0)
+       fs_traits |= FS_SRC_SET_ALPHA;
 
     shader = xa_shaders_get(r->shaders, VS_COMPOSITE, fs_traits);
     cso_set_vertex_shader_handle(r->cso, shader.vs);