- /* If the resource is multisampled, we need to resolve to single
- * sample. This seems like it should be handled at a higher layer.
- */
- if (prsc->nr_samples > 1) {
- trans->ss_resource = vc4_get_temp_resource(pctx, prsc, box);
- if (!trans->ss_resource)
- goto fail;
- assert(!trans->ss_resource->nr_samples);
-
- /* The ptrans->box gets modified for tile alignment, so save
- * the original box for unmap time.
- */
- trans->ss_box = *box;
-
- if (usage & PIPE_TRANSFER_READ) {
- struct pipe_blit_info blit;
- memset(&blit, 0, sizeof(blit));
-
- blit.src.resource = ptrans->resource;
- blit.src.format = ptrans->resource->format;
- blit.src.level = ptrans->level;
- blit.src.box = trans->ss_box;
-
- blit.dst.resource = trans->ss_resource;
- blit.dst.format = trans->ss_resource->format;
- blit.dst.box.width = trans->ss_box.width;
- blit.dst.box.height = trans->ss_box.height;
- blit.dst.box.depth = 1;
-
- blit.mask = util_format_get_mask(prsc->format);
- blit.filter = PIPE_TEX_FILTER_NEAREST;
-
- pctx->blit(pctx, &blit);
- vc4_flush_jobs_writing_resource(vc4, blit.dst.resource);
- }
-
- /* The rest of the mapping process should use our temporary. */
- prsc = trans->ss_resource;
- rsc = vc4_resource(prsc);
- ptrans->box.x = 0;
- ptrans->box.y = 0;
- ptrans->box.z = 0;
- }
-