svga: Reuse util_format_unpack_rgba().
authorEric Anholt <eric@anholt.net>
Wed, 1 Jul 2020 23:27:38 +0000 (16:27 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 7 Jul 2020 18:19:22 +0000 (18:19 +0000)
This assumes that pipe_color_union is a vec4, but that seems safe.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5728>

src/gallium/drivers/svga/svga_pipe_clear.c

index 490f91b5fc9ffa0909921263d6203a75ce70d993..0661d0a7899f6f9523fa8a4e9ca25edbf1940668 100644 (file)
@@ -352,18 +352,7 @@ svga_clear_texture(struct pipe_context *pipe,
          color.f[0] = color.f[1] = color.f[2] = color.f[3] = 0;
       }
       else {
-         if (util_format_is_pure_sint(surface->format)) {
-            /* signed integer */
-            desc->unpack_rgba_sint(color.i, 0, data, 0, 1, 1);
-         }
-         else if (util_format_is_pure_uint(surface->format)) {
-            /* unsigned integer */
-            desc->unpack_rgba_uint(color.ui, 0, data, 0, 1, 1);
-         }
-         else {
-            /* floating point */
-            desc->unpack_rgba_float(color.f, 0, data, 0, 1, 1);
-         }
+         util_format_unpack_rgba(surface->format, &color, data, 1);
       }
 
       /* Setup render target view */