summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost/pan_mfbd.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-07-18 11:09:19 -0700
committerAlyssa Rosenzweig <[email protected]>2019-07-18 15:25:40 -0700
commitf475b7998030529c8151343fca1a7a05c178e386 (patch)
tree510b4351cac0d52571a170692bc2b5e2ab374b34 /src/gallium/drivers/panfrost/pan_mfbd.c
parent629c7366a793393828384f5c1e74d3c45bac4d04 (diff)
panfrost/mfbd: Unify depth-only with masked FBO path
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_mfbd.c')
-rw-r--r--src/gallium/drivers/panfrost/pan_mfbd.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c
index c9f3dc315a0..bbaa9f29414 100644
--- a/src/gallium/drivers/panfrost/pan_mfbd.c
+++ b/src/gallium/drivers/panfrost/pan_mfbd.c
@@ -401,39 +401,41 @@ panfrost_mfbd_fragment(struct panfrost_context *ctx, bool has_draws)
/* TODO: MRT clear */
panfrost_mfbd_clear(job, &fb, &fbx, rts, fb.rt_count_2);
- for (int cb = 0; cb < ctx->pipe_framebuffer.nr_cbufs; ++cb) {
+ /* We always upload at least one dummy GL_NONE render target */
+
+ unsigned rt_descriptors =
+ MAX2(ctx->pipe_framebuffer.nr_cbufs, 1);
+
+ /* Upload either the render target or a dummy GL_NONE target */
+
+ for (int cb = 0; cb < rt_descriptors; ++cb) {
struct pipe_surface *surf = ctx->pipe_framebuffer.cbufs[cb];
- if (!surf)
- continue;
+ if (surf) {
+ panfrost_mfbd_set_cbuf(&rts[cb], surf);
- unsigned bpp = util_format_get_blocksize(surf->format);
+ /* What is this? Looks like some extension of the bpp
+ * field. Maybe it establishes how much internal
+ * tilebuffer space is reserved? */
- panfrost_mfbd_set_cbuf(&rts[cb], surf);
+ unsigned bpp = util_format_get_blocksize(surf->format);
+ fb.rt_count_2 = MAX2(fb.rt_count_2, ALIGN_POT(bpp, 4) / 4);
+ } else {
+ struct mali_rt_format null_rt = {
+ .unk1 = 0x4000000,
+ .unk4 = 0x8
+ };
- /* What is this? Looks like some extension of the bpp field.
- * Maybe it establishes how much internal tilebuffer space is
- * reserved? */
- fb.rt_count_2 = MAX2(fb.rt_count_2, ALIGN_POT(bpp, 4) / 4);
+ rts[cb].format = null_rt;
+ rts[cb].framebuffer = 0;
+ rts[cb].framebuffer_stride = 0;
+ }
}
if (ctx->pipe_framebuffer.zsbuf) {
panfrost_mfbd_set_zsbuf(&fb, &fbx, ctx->pipe_framebuffer.zsbuf);
}
- /* For the special case of a depth-only FBO, we need to attach a dummy render target */
-
- if (ctx->pipe_framebuffer.nr_cbufs == 0) {
- struct mali_rt_format null_rt = {
- .unk1 = 0x4000000,
- .unk4 = 0x8
- };
-
- rts[0].format = null_rt;
- rts[0].framebuffer = 0;
- rts[0].framebuffer_stride = 0;
- }
-
/* When scanning out, the depth buffer is immediately invalidated, so
* we don't need to waste bandwidth writing it out. This can improve
* performance substantially (Z32_UNORM 1080p @ 60fps is 475 MB/s of