[Mesa-dev] [PATCH 04/11] st/nine: Bound the dirty regions to resource size

Axel Davy axel.davy at ens.fr
Fri Apr 24 13:11:19 PDT 2015


Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 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 d501d29..9c99b7c 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -272,6 +272,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 bee8095..e0aec3c 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -301,6 +301,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 b566173..8f1de13 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.1.0



More information about the mesa-dev mailing list