freedreno: a2xx: fix mipmapping for NPOT textures
authorJonathan Marek <jonathan@marek.ca>
Tue, 26 Feb 2019 17:00:01 +0000 (12:00 -0500)
committerRob Clark <robdclark@gmail.com>
Wed, 27 Feb 2019 18:46:28 +0000 (18:46 +0000)
Fixes: 3a273a4a
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
src/gallium/drivers/freedreno/a2xx/fd2_resource.c

index 1bd1f103ccd6a6576e047434ddfc12a6b0806808..2c813804689b0535061605dd902e52af633c0b0a 100644 (file)
@@ -55,6 +55,12 @@ fd2_setup_slices(struct fd_resource *rsc)
                        break;
                }
 
+               /* mipmaps have power of two sizes in memory */
+               if (level) {
+                       width = util_next_power_of_two(width);
+                       height = util_next_power_of_two(height);
+               }
+
                slice->pitch = width;
                slice->offset = size;