swr: use util_copy_framebuffer_state helper
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 20 Nov 2016 19:04:51 +0000 (14:04 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Wed, 30 Nov 2016 01:54:50 +0000 (20:54 -0500)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
src/gallium/drivers/swr/swr_state.cpp

index a67cb6050d967f00f5200d8cf9469cd0c742d9b2..f1cf4ae2e52a456e339da6ba472fd96102cc2737 100644 (file)
@@ -617,18 +617,7 @@ swr_set_framebuffer_state(struct pipe_context *pipe,
    assert(fb->height <= KNOB_GUARDBAND_HEIGHT);
 
    if (changed) {
-      unsigned i;
-      for (i = 0; i < fb->nr_cbufs; ++i)
-         pipe_surface_reference(&ctx->framebuffer.cbufs[i], fb->cbufs[i]);
-      for (; i < ctx->framebuffer.nr_cbufs; ++i)
-         pipe_surface_reference(&ctx->framebuffer.cbufs[i], NULL);
-
-      ctx->framebuffer.nr_cbufs = fb->nr_cbufs;
-
-      ctx->framebuffer.width = fb->width;
-      ctx->framebuffer.height = fb->height;
-
-      pipe_surface_reference(&ctx->framebuffer.zsbuf, fb->zsbuf);
+      util_copy_framebuffer_state(&ctx->framebuffer, fb);
 
       ctx->dirty |= SWR_NEW_FRAMEBUFFER;
    }