ac/surface: set AddrSurfInfoIn.format = ADDR_FMT_8 for stencil, add assertions
authorMarek Olšák <marek.olsak@amd.com>
Mon, 26 Mar 2018 18:32:56 +0000 (14:32 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 28 Mar 2018 21:23:41 +0000 (17:23 -0400)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105738

Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_surface.c

index 12dfc0cb1f263eb9312060e43908b40c028bd817..81882576bafeb55c23c3081fd84a23f1489e74a4 100644 (file)
@@ -1157,18 +1157,25 @@ static int gfx9_compute_surface(ADDR_HANDLE addrlib,
        } else {
                switch (surf->bpe) {
                case 1:
+                       assert(!(surf->flags & RADEON_SURF_ZBUFFER));
                        AddrSurfInfoIn.format = ADDR_FMT_8;
                        break;
                case 2:
+                       assert(surf->flags & RADEON_SURF_ZBUFFER ||
+                              !(surf->flags & RADEON_SURF_SBUFFER));
                        AddrSurfInfoIn.format = ADDR_FMT_16;
                        break;
                case 4:
+                       assert(surf->flags & RADEON_SURF_ZBUFFER ||
+                              !(surf->flags & RADEON_SURF_SBUFFER));
                        AddrSurfInfoIn.format = ADDR_FMT_32;
                        break;
                case 8:
+                       assert(!(surf->flags & RADEON_SURF_Z_OR_SBUFFER));
                        AddrSurfInfoIn.format = ADDR_FMT_32_32;
                        break;
                case 16:
+                       assert(!(surf->flags & RADEON_SURF_Z_OR_SBUFFER));
                        AddrSurfInfoIn.format = ADDR_FMT_32_32_32_32;
                        break;
                default:
@@ -1258,6 +1265,7 @@ static int gfx9_compute_surface(ADDR_HANDLE addrlib,
        if (surf->flags & RADEON_SURF_SBUFFER) {
                AddrSurfInfoIn.flags.stencil = 1;
                AddrSurfInfoIn.bpp = 8;
+               AddrSurfInfoIn.format = ADDR_FMT_8;
 
                if (!AddrSurfInfoIn.flags.depth) {
                        r = gfx9_get_preferred_swizzle_mode(addrlib, &AddrSurfInfoIn, false,