aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2011-09-16 09:39:34 +0100
committerDave Airlie <[email protected]>2011-09-18 15:12:47 +0100
commit6dd284f7c8fac22f64c13fdf9909094f5ec59086 (patch)
tree8fe6c89638f05d1638b3a5d0395e011d68eda336 /src/gallium/state_trackers
parent78026b8acef9d6eea4f37d9c5435447944d1befd (diff)
gallium: move clear paths from rgba to a pointer to a color union (v2)
This moves the gallium interface for clears from using a pointer to 4 floats to a pointer to a union of float/unsigned/int values. Notes: 1. the value is opaque. 2. only when the value is used should it be interpretered according to the surface format it is going to be used with. 3. float clears on integer buffers and vice-versa are undefined. v2: fixed up vega and graw, dropped hunks that shouldn't have been in patch. Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp10
-rw-r--r--src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h7
-rw-r--r--src/gallium/state_trackers/vdpau/presentation.c16
-rw-r--r--src/gallium/state_trackers/vega/api_masks.c7
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c7
5 files changed, 37 insertions, 10 deletions
diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
index 2bf001261eb..e3329e4d5d3 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
@@ -1162,7 +1162,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
if(1)
{
unsigned blit_x, blit_y, blit_w, blit_h;
- float black[4] = {0, 0, 0, 0};
+ static const union pipe_color_union black;
if(!formats_compatible || src->width0 != dst_w || src->height0 != dst_h) {
struct pipe_surface templat;
@@ -1205,9 +1205,9 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
}
if(blit_x)
- pipe->clear_render_target(pipe, dst_surface, black, rect.left, rect.top, blit_x, dst_h);
+ pipe->clear_render_target(pipe, dst_surface, &black, rect.left, rect.top, blit_x, dst_h);
if(blit_y)
- pipe->clear_render_target(pipe, dst_surface, black, rect.left, rect.top, dst_w, blit_y);
+ pipe->clear_render_target(pipe, dst_surface, &black, rect.left, rect.top, dst_w, blit_y);
if(formats_compatible && blit_w == src->width0 && blit_h == src->height0)
{
@@ -1226,9 +1226,9 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
}
if(blit_w != dst_w)
- pipe->clear_render_target(pipe, dst_surface, black, rect.left + blit_x + blit_w, rect.top, dst_w - blit_x - blit_w, dst_h);
+ pipe->clear_render_target(pipe, dst_surface, &black, rect.left + blit_x + blit_w, rect.top, dst_w - blit_x - blit_w, dst_h);
if(blit_h != dst_h)
- pipe->clear_render_target(pipe, dst_surface, black, rect.left, rect.top + blit_y + blit_h, dst_w, dst_h - blit_y - blit_h);
+ pipe->clear_render_target(pipe, dst_surface, &black, rect.left, rect.top + blit_y + blit_h, dst_w, dst_h - blit_y - blit_h);
}
if(dst_surface)
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
index d43fdeab963..fcb82a19624 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
@@ -1594,7 +1594,12 @@ changed:
{
SYNCHRONIZED;
GalliumD3D11RenderTargetView* view = ((GalliumD3D11RenderTargetView*)render_target_view);
- pipe->clear_render_target(pipe, view->object, color, 0, 0, view->object->width, view->object->height);
+ union pipe_color_union cc;
+ cc.f[0] = color[0];
+ cc.f[1] = color[1];
+ cc.f[2] = color[2];
+ cc.f[3] = color[3];
+ pipe->clear_render_target(pipe, view->object, &cc, 0, 0, view->object->width, view->object->height);
}
virtual void STDMETHODCALLTYPE ClearDepthStencilView(
diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c
index b30b778aa19..888cf31d5af 100644
--- a/src/gallium/state_trackers/vdpau/presentation.c
+++ b/src/gallium/state_trackers/vdpau/presentation.c
@@ -119,6 +119,7 @@ vlVdpPresentationQueueSetBackgroundColor(VdpPresentationQueue presentation_queue
VdpColor *const background_color)
{
vlVdpPresentationQueue *pq;
+ union pipe_color_union color;
VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Setting background color\n");
@@ -129,7 +130,12 @@ vlVdpPresentationQueueSetBackgroundColor(VdpPresentationQueue presentation_queue
if (!pq)
return VDP_STATUS_INVALID_HANDLE;
- vl_compositor_set_clear_color(&pq->compositor, (float*)background_color);
+ color.f[0] = background_color->red;
+ color.f[1] = background_color->green;
+ color.f[2] = background_color->blue;
+ color.f[3] = background_color->alpha;
+
+ vl_compositor_set_clear_color(&pq->compositor, &color);
return VDP_STATUS_OK;
}
@@ -142,6 +148,7 @@ vlVdpPresentationQueueGetBackgroundColor(VdpPresentationQueue presentation_queue
VdpColor *const background_color)
{
vlVdpPresentationQueue *pq;
+ union pipe_color_union color;
VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Getting background color\n");
@@ -152,7 +159,12 @@ vlVdpPresentationQueueGetBackgroundColor(VdpPresentationQueue presentation_queue
if (!pq)
return VDP_STATUS_INVALID_HANDLE;
- vl_compositor_get_clear_color(&pq->compositor, (float*)background_color);
+ vl_compositor_get_clear_color(&pq->compositor, &color);
+
+ background_color->red = color.f[0];
+ background_color->green = color.f[1];
+ background_color->blue = color.f[2];
+ background_color->alpha = color.f[3];
return VDP_STATUS_OK;
}
diff --git a/src/gallium/state_trackers/vega/api_masks.c b/src/gallium/state_trackers/vega/api_masks.c
index cdbf0026e89..0ddcdfb75c1 100644
--- a/src/gallium/state_trackers/vega/api_masks.c
+++ b/src/gallium/state_trackers/vega/api_masks.c
@@ -92,8 +92,13 @@ void vegaClear(VGint x, VGint y,
/* check for a whole surface clear */
if (!ctx->state.vg.scissoring &&
(x == 0 && y == 0 && width == stfb->width && height == stfb->height)) {
+ union pipe_color_union clear_color;
+ clear_color.f[0] = ctx->state.vg.clear_color[0];
+ clear_color.f[1] = ctx->state.vg.clear_color[1];
+ clear_color.f[2] = ctx->state.vg.clear_color[2];
+ clear_color.f[3] = ctx->state.vg.clear_color[3];
ctx->pipe->clear(ctx->pipe, PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL,
- ctx->state.vg.clear_color, 1., 0);
+ &clear_color, 1., 0);
} else if (renderer_clear_begin(ctx->renderer)) {
/* XXX verify coord round-off */
renderer_clear(ctx->renderer, x, y, width, height, ctx->state.vg.clear_color);
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index b072f53aa91..db0167ba4c4 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -386,7 +386,12 @@ ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1)
if (x0 == 0 && y0 == 0 &&
x1 == pPixmap->drawable.width && y1 == pPixmap->drawable.height) {
- exa->pipe->clear(exa->pipe, PIPE_CLEAR_COLOR, exa->solid_color, 0.0, 0);
+ union pipe_color_union solid_color;
+ solid_color.f[0] = exa->solid_color[0];
+ solid_color.f[1] = exa->solid_color[1];
+ solid_color.f[2] = exa->solid_color[2];
+ solid_color.f[3] = exa->solid_color[3];
+ exa->pipe->clear(exa->pipe, PIPE_CLEAR_COLOR, &solid_color, 0.0, 0);
return;
}