llvmpipe: build 64-bit coverage mask in rasterizer
authorDave Airlie <airlied@redhat.com>
Fri, 20 Mar 2020 21:09:15 +0000 (07:09 +1000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 6 May 2020 06:20:38 +0000 (06:20 +0000)
This adds the logic to build the per-sample masks at the lowest
level of the rasterizer block hierarchy

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h

index 05d2242786feb799d2a9ea690d8a8883d6e91da5..a905c1a14aa4075965bdff4c26c8c0e386b37c6f 100644 (file)
@@ -46,10 +46,15 @@ TAG(do_block_4)(struct lp_rasterizer_task *task,
                 int x, int y,
                 const int64_t *c)
 {
-   unsigned mask = 0xffff;
    int j;
+#ifndef MULTISAMPLE
+   unsigned mask = 0xffff;
+#else
+   uint64_t mask = UINT64_MAX;
+#endif
 
    for (j = 0; j < NR_PLANES; j++) {
+#ifndef MULTISAMPLE
 #ifdef RASTER_64
       mask &= ~BUILD_MASK_LINEAR(((c[j] - 1) >> (int64_t)FIXED_ORDER),
                                  -plane[j].dcdx >> FIXED_ORDER,
@@ -58,13 +63,29 @@ TAG(do_block_4)(struct lp_rasterizer_task *task,
       mask &= ~BUILD_MASK_LINEAR((c[j] - 1),
                                  -plane[j].dcdx,
                                  plane[j].dcdy);
+#endif
+#else
+      for (unsigned s = 0; s < 4; s++) {
+         int64_t new_c = (c[j]) + ((IMUL64(task->scene->fixed_sample_pos[s][1], plane[j].dcdy) + IMUL64(task->scene->fixed_sample_pos[s][0], -plane[j].dcdx)) >> FIXED_ORDER);
+         uint32_t build_mask;
+#ifdef RASTER_64
+         build_mask = BUILD_MASK_LINEAR((new_c - 1) >> (int64_t)FIXED_ORDER,
+                                        -plane[j].dcdx >> FIXED_ORDER,
+                                        plane[j].dcdy >> FIXED_ORDER);
+#else
+         build_mask = BUILD_MASK_LINEAR((new_c - 1),
+                                        -plane[j].dcdx,
+                                        plane[j].dcdy);
+#endif
+         mask &= ~((uint64_t)build_mask << (s * 16));
+      }
 #endif
    }
 
    /* Now pass to the shader:
     */
    if (mask)
-      lp_rast_shade_quads_mask(task, &tri->inputs, x, y, mask);
+      lp_rast_shade_quads_mask_sample(task, &tri->inputs, x, y, mask);
 }
 
 /**