svga: Use texture_copy_region instead of texture_copy_handle for multisampling
[mesa.git] / src / gallium / drivers / svga / svga_surface.c
index 9b9bc9ed6a33aa0ac808608291919f0cfbaf6848..73208cf58ac2c8bac71c2497007657c863b28418 100644 (file)
@@ -170,15 +170,24 @@ svga_texture_copy_handle_resource(struct svga_context *svga,
             unsigned depth = (zslice_pick < 0 ?
                               u_minify(src_tex->b.b.depth0, miplevel) : 1);
 
-            svga_texture_copy_handle(svga,
-                                     src_tex->handle,
-                                     0, 0, zoffset,
-                                     miplevel,
-                                     j + layeroffset,
-                                     dst, 0, 0, 0, i, j,
-                                     u_minify(src_tex->b.b.width0, miplevel),
-                                     u_minify(src_tex->b.b.height0, miplevel),
-                                     depth);
+            if (src_tex->b.b.nr_samples > 1) {
+               unsigned subResource = j * numMipLevels + i;
+               svga_texture_copy_region(svga, src_tex->handle,
+                                        subResource, 0, 0, zoffset,
+                                        dst, subResource, 0, 0, 0,
+                                        src_tex->b.b.width0, src_tex->b.b.height0, depth);
+            }
+            else {
+               svga_texture_copy_handle(svga,
+                                        src_tex->handle,
+                                        0, 0, zoffset,
+                                        miplevel,
+                                        j + layeroffset,
+                                        dst, 0, 0, 0, i, j,
+                                        u_minify(src_tex->b.b.width0, miplevel),
+                                        u_minify(src_tex->b.b.height0, miplevel),
+                                        depth);
+            }
          }
       }
    }
@@ -918,6 +927,10 @@ svga_get_sample_position(struct pipe_context *context,
    static const float pos1[1][2] = {
       { 0.5, 0.5 }
    };
+   static const float pos2[2][2] = {
+      { 0.75, 0.75 },
+      { 0.25, 0.25 }
+   };
    static const float pos4[4][2] = {
       { 0.375000, 0.125000 },
       { 0.875000, 0.375000 },
@@ -955,6 +968,9 @@ svga_get_sample_position(struct pipe_context *context,
    const float (*positions)[2];
 
    switch (sample_count) {
+   case 2:
+      positions = pos2;
+      break;
    case 4:
       positions = pos4;
       break;