st/nine: Don't call u_box_union_* when dirty region is empty
authorMasanori Kakura <kakurasan@gmail.com>
Wed, 28 Dec 2016 13:21:02 +0000 (22:21 +0900)
committerAxel Davy <axel.davy@ens.fr>
Thu, 12 Jan 2017 19:33:11 +0000 (20:33 +0100)
When dirty region is empty, u_box_union_* incorrectly expands
the new region.

This fixes broken font rendering issue in WOLF RPG Editor v2.10 games.

Signed-off-by: Masanori Kakura <kakurasan@gmail.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/cubetexture9.c
src/gallium/state_trackers/nine/texture9.c
src/gallium/state_trackers/nine/volumetexture9.c

index 977a345552b0604f0ce797fc9051597e24d3d39f..65251ad2b7e2d35c90bb314e0541c0c7bebff719 100644 (file)
@@ -285,10 +285,14 @@ NineCubeTexture9_AddDirtyRect( struct NineCubeTexture9 *This,
                         This->base.base.info.height0,
                         &This->dirty_rect[FaceType]);
     } else {
-        struct pipe_box box;
-        rect_to_pipe_box_clamp(&box, pDirtyRect);
-        u_box_union_2d(&This->dirty_rect[FaceType], &This->dirty_rect[FaceType],
-                       &box);
+        if (This->dirty_rect[FaceType].width == 0) {
+            rect_to_pipe_box_clamp(&This->dirty_rect[FaceType], pDirtyRect);
+        } else {
+            struct pipe_box box;
+            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,
index bf054cc3059a9784e5eb50aff314702b61678e13..78ca4add4aef88225edfef85068ff9a37339aa3c 100644 (file)
@@ -330,9 +330,13 @@ NineTexture9_AddDirtyRect( struct NineTexture9 *This,
         u_box_origin_2d(This->base.base.info.width0,
                         This->base.base.info.height0, &This->dirty_rect);
     } else {
-        struct pipe_box box;
-        rect_to_pipe_box_clamp(&box, pDirtyRect);
-        u_box_union_2d(&This->dirty_rect, &This->dirty_rect, &box);
+        if (This->dirty_rect.width == 0) {
+            rect_to_pipe_box_clamp(&This->dirty_rect, pDirtyRect);
+        } else {
+            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);
index 5c83fdb60ceeb462ebc765305cbcad6ed124b310..c836dd21023f0a1c12ca7555e1603f7987013139 100644 (file)
@@ -222,9 +222,13 @@ NineVolumeTexture9_AddDirtyBox( struct NineVolumeTexture9 *This,
         This->dirty_box.height = This->base.base.info.height0;
         This->dirty_box.depth = This->base.base.info.depth0;
     } else {
-        struct pipe_box box;
-        d3dbox_to_pipe_box(&box, pDirtyBox);
-        u_box_union_3d(&This->dirty_box, &This->dirty_box, &box);
+        if (This->dirty_box.width == 0) {
+            d3dbox_to_pipe_box(&This->dirty_box, pDirtyBox);
+        } else {
+            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);