summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/vdpau/device.c
diff options
context:
space:
mode:
authorChristian König <[email protected]>2012-02-27 16:50:01 +0100
committerChristian König <[email protected]>2012-03-02 13:14:22 +0100
commit379f46c8ac50b9b76455b1e62d6d541182339e96 (patch)
treeff94c6b4e4818f0e5cda5c7bc6099f7ba0fc8dbb /src/gallium/state_trackers/vdpau/device.c
parent503cfbc7ba536710439e92cc961c2b75d9bb8ff2 (diff)
st/vdpau: fix default swizzle for Output/Bitmap samplers
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/vdpau/device.c')
-rw-r--r--src/gallium/state_trackers/vdpau/device.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c
index 482b71e9a0d..98106a1c702 100644
--- a/src/gallium/state_trackers/vdpau/device.c
+++ b/src/gallium/state_trackers/vdpau/device.c
@@ -240,6 +240,25 @@ vlVdpGetErrorString (VdpStatus status)
}
void
+vlVdpDefaultSamplerViewTemplate(struct pipe_sampler_view *templ, struct pipe_resource *res)
+{
+ const struct util_format_description *desc;
+
+ memset(templ, 0, sizeof(*templ));
+ u_sampler_view_default_template(templ, res, res->format);
+
+ desc = util_format_description(res->format);
+ if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_0)
+ templ->swizzle_r = PIPE_SWIZZLE_ONE;
+ if (desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0)
+ templ->swizzle_g = PIPE_SWIZZLE_ONE;
+ if (desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0)
+ templ->swizzle_b = PIPE_SWIZZLE_ONE;
+ if (desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_0)
+ templ->swizzle_a = PIPE_SWIZZLE_ONE;
+}
+
+void
vlVdpResolveDelayedRendering(vlVdpDevice *dev, struct pipe_surface *surface, struct u_rect *dirty_area)
{
struct vl_compositor_state *cstate;
@@ -270,8 +289,7 @@ vlVdpResolveDelayedRendering(vlVdpDevice *dev, struct pipe_surface *surface, str
struct pipe_resource *res = surface->texture;
struct pipe_sampler_view sv_templ;
- memset(&sv_templ, 0, sizeof(sv_templ));
- u_sampler_view_default_template(&sv_templ, res, res->format);
+ vlVdpDefaultSamplerViewTemplate(&sv_templ, res);
pipe_sampler_view_reference(&vlsurface->sampler_view,
dev->context->create_sampler_view(dev->context, res, &sv_templ));
}