summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_context.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2015-06-22 13:12:27 -0700
committerEric Anholt <eric@anholt.net>2015-12-08 09:49:53 -0800
commitedfd4d853a0d26bc0cde811de7b20116db7e66fc (patch)
treee154c0ed3b29e39e2cedf1545fdedb7624d27caf /src/gallium/drivers/vc4/vc4_context.c
parente7c8ad0a6c8ba263f29b7c3c5120bc6beabeba7b (diff)
downloadexternal_mesa3d-edfd4d853a0d26bc0cde811de7b20116db7e66fc.zip
external_mesa3d-edfd4d853a0d26bc0cde811de7b20116db7e66fc.tar.gz
external_mesa3d-edfd4d853a0d26bc0cde811de7b20116db7e66fc.tar.bz2
vc4: Add support for drawing in MSAA.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_context.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_context.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c
index c783e7b..1cd1676 100644
--- a/src/gallium/drivers/vc4/vc4_context.c
+++ b/src/gallium/drivers/vc4/vc4_context.c
@@ -67,8 +67,16 @@ vc4_flush(struct pipe_context *pctx)
cl_u8(&bcl, VC4_PACKET_FLUSH);
cl_end(&vc4->bcl, bcl);
+ vc4->msaa = false;
if (cbuf && (vc4->resolve & PIPE_CLEAR_COLOR0)) {
- pipe_surface_reference(&vc4->color_write, cbuf);
+ pipe_surface_reference(&vc4->color_write,
+ cbuf->texture->nr_samples ? NULL : cbuf);
+ pipe_surface_reference(&vc4->msaa_color_write,
+ cbuf->texture->nr_samples ? cbuf : NULL);
+
+ if (cbuf->texture->nr_samples)
+ vc4->msaa = true;
+
if (!(vc4->cleared & PIPE_CLEAR_COLOR0)) {
pipe_surface_reference(&vc4->color_read, cbuf);
} else {
@@ -78,11 +86,21 @@ vc4_flush(struct pipe_context *pctx)
} else {
pipe_surface_reference(&vc4->color_write, NULL);
pipe_surface_reference(&vc4->color_read, NULL);
+ pipe_surface_reference(&vc4->msaa_color_write, NULL);
}
if (vc4->framebuffer.zsbuf &&
(vc4->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))) {
- pipe_surface_reference(&vc4->zs_write, zsbuf);
+ pipe_surface_reference(&vc4->zs_write,
+ zsbuf->texture->nr_samples ?
+ NULL : zsbuf);
+ pipe_surface_reference(&vc4->msaa_zs_write,
+ zsbuf->texture->nr_samples ?
+ zsbuf : NULL);
+
+ if (zsbuf->texture->nr_samples)
+ vc4->msaa = true;
+
if (!(vc4->cleared & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))) {
pipe_surface_reference(&vc4->zs_read, zsbuf);
} else {
@@ -91,6 +109,7 @@ vc4_flush(struct pipe_context *pctx)
} else {
pipe_surface_reference(&vc4->zs_write, NULL);
pipe_surface_reference(&vc4->zs_read, NULL);
+ pipe_surface_reference(&vc4->msaa_zs_write, NULL);
}
vc4_job_submit(vc4);