summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <[email protected]>2012-02-27 16:18:09 +0100
committerChristian König <[email protected]>2012-03-02 13:14:22 +0100
commit503cfbc7ba536710439e92cc961c2b75d9bb8ff2 (patch)
tree881085b26b2336b63bd9b3a7c10478f1e2231cd6
parentbf19596870a61c615f12e593f4812052ce9d9721 (diff)
st/vdpau: add support for per vertex colors
Signed-off-by: Christian König <[email protected]>
-rw-r--r--src/gallium/state_trackers/vdpau/output.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c
index 67c7a94c0d3..aa636bd6568 100644
--- a/src/gallium/state_trackers/vdpau/output.c
+++ b/src/gallium/state_trackers/vdpau/output.c
@@ -432,6 +432,28 @@ BlenderToPipe(struct pipe_context *context,
return context->create_blend_state(context, &blend);
}
+static struct vertex4f *
+ColorsToPipe(VdpColor const *colors, uint32_t flags, struct vertex4f result[4])
+{
+ unsigned i;
+ struct vertex4f *dst = result;
+
+ if (!colors)
+ return NULL;
+
+ for (i = 0; i < 4; ++i) {
+ dst->x = colors->red;
+ dst->y = colors->green;
+ dst->z = colors->blue;
+ dst->w = colors->alpha;
+
+ ++dst;
+ if (flags & VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX)
+ ++colors;
+ }
+ return result;
+}
+
/**
* Composite a sub-rectangle of a VdpOutputSurface into a sub-rectangle of
* another VdpOutputSurface; Output Surface object VdpOutputSurface.
@@ -454,6 +476,7 @@ vlVdpOutputSurfaceRenderOutputSurface(VdpOutputSurface destination_surface,
struct u_rect src_rect, dst_rect;
+ struct vertex4f vlcolors[4];
void *blend;
dst_vlsurface = vlGetDataHTAB(destination_surface);
@@ -478,7 +501,8 @@ vlVdpOutputSurfaceRenderOutputSurface(VdpOutputSurface destination_surface,
vl_compositor_clear_layers(cstate);
vl_compositor_set_layer_blend(cstate, 0, blend, false);
vl_compositor_set_rgba_layer(cstate, compositor, 0, src_vlsurface->sampler_view,
- RectToPipe(source_rect, &src_rect), NULL, NULL);
+ RectToPipe(source_rect, &src_rect), NULL,
+ ColorsToPipe(colors, flags, vlcolors));
vl_compositor_set_layer_dst_area(cstate, 0, RectToPipe(destination_rect, &dst_rect));
vl_compositor_render(cstate, compositor, dst_vlsurface->surface, NULL);
@@ -509,6 +533,7 @@ vlVdpOutputSurfaceRenderBitmapSurface(VdpOutputSurface destination_surface,
struct u_rect src_rect, dst_rect;
+ struct vertex4f vlcolors[4];
void *blend;
dst_vlsurface = vlGetDataHTAB(destination_surface);
@@ -533,7 +558,8 @@ vlVdpOutputSurfaceRenderBitmapSurface(VdpOutputSurface destination_surface,
vl_compositor_clear_layers(cstate);
vl_compositor_set_layer_blend(cstate, 0, blend, false);
vl_compositor_set_rgba_layer(cstate, compositor, 0, src_vlsurface->sampler_view,
- RectToPipe(source_rect, &src_rect), NULL, NULL);
+ RectToPipe(source_rect, &src_rect), NULL,
+ ColorsToPipe(colors, flags, vlcolors));
vl_compositor_set_layer_dst_area(cstate, 0, RectToPipe(destination_rect, &dst_rect));
vl_compositor_render(cstate, compositor, dst_vlsurface->surface, NULL);