ac/surface: handle error when choosing preferred swizzle mode
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 20 Sep 2017 14:45:48 +0000 (16:45 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 21 Sep 2017 09:00:00 +0000 (11:00 +0200)
CID: 1418140
Fixes: c4ac522511d2 ("ac/surface: handle S8 on gfx9")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_surface.c

index 850d70715e5b8ac8ef38fce87055680b506d860c..22c653f0c4f475aff736afefbe3f54002e95ca2e 100644 (file)
@@ -1141,10 +1141,12 @@ static int gfx9_compute_surface(ADDR_HANDLE addrlib,
                AddrSurfInfoIn.flags.stencil = 1;
                AddrSurfInfoIn.bpp = 8;
 
-               if (!AddrSurfInfoIn.flags.depth)
+               if (!AddrSurfInfoIn.flags.depth) {
                        r = gfx9_get_preferred_swizzle_mode(addrlib, &AddrSurfInfoIn, false,
                                                            &AddrSurfInfoIn.swizzleMode);
-               else
+                       if (r)
+                               return r;
+               } else
                        AddrSurfInfoIn.flags.depth = 0;
 
                r = gfx9_compute_miptree(addrlib, surf, compressed, &AddrSurfInfoIn);