svga: fix draw elements with 8-bits indices
authorCharmaine Lee <charmainel@vmware.com>
Thu, 20 Aug 2020 22:45:47 +0000 (15:45 -0700)
committerMarge Bot <eric+marge@anholt.net>
Fri, 21 Aug 2020 18:14:06 +0000 (18:14 +0000)
With commit 2122b902b80, u_index_translator can return U_TRANSLATE_MEMCPY
for 8-bits indices, and in this case we need to call the translation function
instead of a simple passthrough to the device.

Fixes piglit spec@nv_primitive_restart tests.

Fixes: 2122b902b8 "gallium/indices: don't expand prim-type for 8-bit indices"
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6414>

src/gallium/drivers/svga/svga_draw_elements.c

index b17fe44f747d6dc1f08b4d467a9643cabd592d2a..dd977b1bc2da69eaeea0e0382194d504392ccb03 100644 (file)
@@ -254,7 +254,7 @@ svga_hwtnl_draw_range_elements(struct svga_hwtnl *hwtnl,
                                     &gen_prim, &gen_size, &gen_nr, &gen_func);
    }
 
-   if (gen_type == U_TRANSLATE_MEMCPY) {
+   if ((gen_type == U_TRANSLATE_MEMCPY) && (info->index_size == gen_size)) {
       /* No need for translation, just pass through to hardware:
        */
       unsigned start_offset = info->start * info->index_size;