panfrost: Set depth and stencil for SFBD based on the format

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Tomeu Vizoso
2019-11-06 10:04:36 +01:00
committed by Tomeu Vizoso
parent b4d47e21d7
commit ee5321f239
4 changed files with 36 additions and 21 deletions
+13
View File
@@ -270,3 +270,16 @@ panfrost_invert_swizzle(const unsigned char *in, unsigned char *out)
out[idx] = PIPE_SWIZZLE_X + c;
}
}
/* Is a format encoded like Z24S8 and therefore compatible for render? */
bool
panfrost_is_z24s8_variant(enum pipe_format fmt)
{
switch (fmt) {
case PIPE_FORMAT_Z24_UNORM_S8_UINT:
case PIPE_FORMAT_Z24X8_UNORM:
return true;
default:
return false;
}
}
@@ -40,6 +40,9 @@ panfrost_find_format(const struct util_format_description *desc);
void
panfrost_invert_swizzle(const unsigned char *in, unsigned char *out);
bool
panfrost_is_z24s8_variant(enum pipe_format fmt);
#endif
-14
View File
@@ -226,20 +226,6 @@ panfrost_mfbd_set_cbuf(
}
}
/* Is a format encoded like Z24S8 and therefore compatible for render? */
static bool
panfrost_is_z24s8_variant(enum pipe_format fmt)
{
switch (fmt) {
case PIPE_FORMAT_Z24_UNORM_S8_UINT:
case PIPE_FORMAT_Z24X8_UNORM:
return true;
default:
return false;
}
}
static void
panfrost_mfbd_set_zsbuf(
struct bifrost_framebuffer *fb,
+20 -7
View File
@@ -163,20 +163,33 @@ panfrost_sfbd_set_zsbuf(
assert(surf->u.tex.first_layer == 0);
if (rsrc->layout == PAN_LINEAR) {
/* TODO: What about format selection? */
if (panfrost_is_z24s8_variant(surf->format)) {
fb->depth_buffer = rsrc->bo->gpu + rsrc->slices[level].offset;
fb->depth_stride = rsrc->slices[level].stride;
fb->depth_buffer = rsrc->bo->gpu + rsrc->slices[level].offset;
fb->depth_stride = rsrc->slices[level].stride;
fb->stencil_buffer = rsrc->bo->gpu + rsrc->slices[level].offset;
fb->stencil_stride = rsrc->slices[level].stride;
fb->stencil_buffer = rsrc->bo->gpu + rsrc->slices[level].offset;
fb->stencil_stride = rsrc->slices[level].stride;
struct panfrost_resource *stencil = rsrc->separate_stencil;
if (stencil) {
} else if (surf->format == PIPE_FORMAT_Z32_UNORM ||
surf->format == PIPE_FORMAT_Z32_FLOAT) {
fb->depth_buffer = rsrc->bo->gpu + rsrc->slices[level].offset;
fb->depth_stride = rsrc->slices[level].stride;
} else if (surf->format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT) {
fb->depth_buffer = rsrc->bo->gpu + rsrc->slices[level].offset;
fb->depth_stride = rsrc->slices[level].stride;
struct panfrost_resource *stencil = rsrc->separate_stencil;
struct panfrost_slice stencil_slice = stencil->slices[level];
fb->stencil_buffer = stencil->bo->gpu + stencil_slice.offset;
fb->stencil_stride = stencil_slice.stride;
} else {
fprintf(stderr, "Unsupported depth/stencil format\n");
assert(0);
}
} else {
fprintf(stderr, "Invalid render layout\n");