panfrost: Implement Z32F(_S8) support
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 17 Jul 2019 22:49:42 +0000 (15:49 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 18 Jul 2019 17:42:43 +0000 (10:42 -0700)
Z32F uses a dediacted float path. Z32F_S8 uses separate stencil planes
in the hardware, lowered via u_transfer_helper.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_mfbd.c
src/gallium/drivers/panfrost/pan_screen.c

index a35acc311bcf23a3153a784d29472380c0bd6d6f..e3595af4cf1de1f0d4ba6a0e1be648279093d165 100644 (file)
@@ -313,6 +313,20 @@ panfrost_mfbd_set_zsbuf(
                         fbx->flags |= 0x1;
                 } else if (surf->format == PIPE_FORMAT_Z32_UNORM) {
                         /* default flags (0 in bottom place) */
+                } else if (surf->format == PIPE_FORMAT_Z32_FLOAT) {
+                        fbx->flags |= 0xA;
+                        fb->mfbd_flags ^= 0x100;
+                        fb->mfbd_flags |= 0x200;
+                } else if (surf->format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT) {
+                        fbx->flags |= 0x1000A;
+                        fb->mfbd_flags ^= 0x100;
+                        fb->mfbd_flags |= 0x201;
+
+                        struct panfrost_resource *stencil = rsrc->separate_stencil;
+                        struct panfrost_slice stencil_slice = stencil->slices[level];
+
+                        fbx->ds_linear.stencil = stencil->bo->gpu + stencil_slice.offset;
+                        fbx->ds_linear.stencil_stride = stencil_slice.stride;
                 }
 
         } else {
index 6fe9e60f69a17983860fd726efe368d84772587f..39d00009091e4c709198b392f5ac4db0f436c028 100644 (file)
@@ -428,6 +428,8 @@ panfrost_is_format_supported( struct pipe_screen *screen,
                         case PIPE_FORMAT_Z24_UNORM_S8_UINT:
                         case PIPE_FORMAT_Z24X8_UNORM:
                         case PIPE_FORMAT_Z32_UNORM:
+                        case PIPE_FORMAT_Z32_FLOAT:
+                        case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
                                 return true;
 
                         default: