util: Make helper functions for pack/unpacking pixel rows.
[mesa.git] / src / gallium / drivers / radeonsi / si_clear.c
index 63f73e189e0245dbc9bf53e972785da49f463d75..b1858fb42fe0777943cbc82579e52fa435c74d59 100644 (file)
@@ -25,7 +25,7 @@
 #include "si_pipe.h"
 #include "sid.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_pack_color.h"
 #include "util/u_surface.h"
 
@@ -510,6 +510,7 @@ static void si_do_fast_color_clear(struct si_context *sctx,
                                continue;
 
                        tex->separate_dcc_dirty = true;
+                       tex->displayable_dcc_dirty = true;
 
                        /* DCC fast clear with MSAA should clear CMASK to 0xC. */
                        if (tex->buffer.b.b.nr_samples >= 2 && tex->cmask_buffer) {
@@ -751,11 +752,12 @@ static void si_clear_texture(struct pipe_context *pipe,
 
                /* Depth is always present. */
                clear = PIPE_CLEAR_DEPTH;
-               desc->unpack_z_float(&depth, 0, data, 0, 1, 1);
+               util_format_unpack_z_float(tex->format, &depth, data, 1);
 
                if (stex->surface.has_stencil) {
                        clear |= PIPE_CLEAR_STENCIL;
-                       desc->unpack_s_8uint(&stencil, 0, data, 0, 1, 1);
+                       util_format_unpack_s_8uint(tex->format,
+                                                  &stencil, data, 1);
                }
 
                si_clear_depth_stencil(pipe, sf, clear, depth, stencil,
@@ -764,13 +766,7 @@ static void si_clear_texture(struct pipe_context *pipe,
        } else {
                union pipe_color_union color;
 
-               /* pipe_color_union requires the full vec4 representation. */
-               if (util_format_is_pure_uint(tex->format))
-                       desc->unpack_rgba_uint(color.ui, 0, data, 0, 1, 1);
-               else if (util_format_is_pure_sint(tex->format))
-                       desc->unpack_rgba_sint(color.i, 0, data, 0, 1, 1);
-               else
-                       desc->unpack_rgba_float(color.f, 0, data, 0, 1, 1);
+               util_format_unpack_rgba(tex->format, color.ui, data, 1);
 
                if (screen->is_format_supported(screen, tex->format,
                                                tex->target, 0, 0,