+
+ if (!can_create_src_view) {
+ struct pipe_resource template;
+ unsigned src_face, src_z;
+
+ /**
+ * If the source blit format is not compatible with the source resource
+ * format, we will not be able to create a shader resource view.
+ * In order to avoid falling back to software blit, we'll create
+ * a new resource in the blit format, and use DXCopyResource to
+ * copy from the original format to the new format. The new
+ * resource will be used for the blit in util_blitter_blit().
+ */
+ template = *src;
+ template.format = blit.src.format;
+ newSrc = svga_texture_create(svga->pipe.screen, &template);
+ if (newSrc == NULL) {
+ debug_printf("svga_blit: fails to create temporary src\n");
+ return;
+ }
+
+ /* Copy from original resource to the temporary resource */
+ adjust_z_layer(blit.src.resource->target, blit.src.box.z,
+ &src_face, &src_z);
+
+ copy_region_vgpu10(svga,
+ blit.src.resource,
+ blit.src.box.x, blit.src.box.y, src_z,
+ blit.src.level, src_face,
+ newSrc,
+ blit.src.box.x, blit.src.box.y, src_z,
+ blit.src.level, src_face,
+ blit.src.box.width, blit.src.box.height,
+ blit.src.box.depth);
+
+ blit.src.resource = newSrc;
+ }
+
+ if (!can_create_dst_view) {
+ struct pipe_resource template;
+
+ /**
+ * If the destination blit format is not compatible with the destination
+ * resource format, we will not be able to create a render target view.
+ * In order to avoid falling back to software blit, we'll create
+ * a new resource in the blit format, and use DXPredCopyRegion
+ * after the blit to copy from the blit format back to the resource
+ * format.
+ */
+ template = *dst;
+ template.format = blit.dst.format;
+ newDst = svga_texture_create(svga->pipe.screen, &template);
+ if (newDst == NULL) {
+ debug_printf("svga_blit: fails to create temporary dst\n");
+ return;
+ }
+
+ blit.dst.resource = newDst;
+ }
+