From 090ebc7638e64592716ac4ecd4c29609b2f35421 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Thu, 19 Feb 2015 17:44:43 +0100 Subject: [PATCH] st/nine: Bound the dirty regions to resource size Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/cubetexture9.c | 4 ++++ src/gallium/state_trackers/nine/texture9.c | 3 +++ src/gallium/state_trackers/nine/volumetexture9.c | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/src/gallium/state_trackers/nine/cubetexture9.c b/src/gallium/state_trackers/nine/cubetexture9.c index 98fe887072c..edea1f28a8d 100644 --- a/src/gallium/state_trackers/nine/cubetexture9.c +++ b/src/gallium/state_trackers/nine/cubetexture9.c @@ -276,6 +276,10 @@ NineCubeTexture9_AddDirtyRect( struct NineCubeTexture9 *This, rect_to_pipe_box_clamp(&box, pDirtyRect); u_box_union_2d(&This->dirty_rect[FaceType], &This->dirty_rect[FaceType], &box); + (void) u_box_clip_2d(&This->dirty_rect[FaceType], + &This->dirty_rect[FaceType], + This->base.base.info.width0, + This->base.base.info.height0); } return D3D_OK; } diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c index 5b5fd551a80..c1d1343b273 100644 --- a/src/gallium/state_trackers/nine/texture9.c +++ b/src/gallium/state_trackers/nine/texture9.c @@ -310,6 +310,9 @@ NineTexture9_AddDirtyRect( struct NineTexture9 *This, struct pipe_box box; rect_to_pipe_box_clamp(&box, pDirtyRect); u_box_union_2d(&This->dirty_rect, &This->dirty_rect, &box); + (void) u_box_clip_2d(&This->dirty_rect, &This->dirty_rect, + This->base.base.info.width0, + This->base.base.info.height0); } return D3D_OK; } diff --git a/src/gallium/state_trackers/nine/volumetexture9.c b/src/gallium/state_trackers/nine/volumetexture9.c index b5661731764..8f1de13ce5f 100644 --- a/src/gallium/state_trackers/nine/volumetexture9.c +++ b/src/gallium/state_trackers/nine/volumetexture9.c @@ -223,6 +223,15 @@ NineVolumeTexture9_AddDirtyBox( struct NineVolumeTexture9 *This, struct pipe_box box; d3dbox_to_pipe_box(&box, pDirtyBox); u_box_union_3d(&This->dirty_box, &This->dirty_box, &box); + This->dirty_box.x = MAX2(This->dirty_box.x, 0); + This->dirty_box.y = MAX2(This->dirty_box.y, 0); + This->dirty_box.z = MAX2(This->dirty_box.z, 0); + This->dirty_box.width = MIN2(This->dirty_box.width, + This->base.base.info.width0 - This->dirty_box.x); + This->dirty_box.height = MIN2(This->dirty_box.height, + This->base.base.info.height0 - This->dirty_box.y); + This->dirty_box.depth = MIN2(This->dirty_box.depth, + This->base.base.info.depth0 - This->dirty_box.z); } return D3D_OK; } -- 2.30.2