util_format_write_4f(format, rgba, 0, uc, 0, 0, 0, 1, 1);
}
}
-
+
+static inline void
+util_pack_color_union(enum pipe_format format,
+ union util_color *dst,
+ const union pipe_color_union *src)
+{
+ util_format_pack_rgba(format, dst, &src->ui, 1);
+}
+
/* Integer versions of util_pack_z and util_pack_z_stencil - useful for
* constructing clear masks.
*/
assert(dst_trans->stride > 0);
- if (util_format_is_pure_integer(format)) {
- /*
- * We expect int/uint clear values here, though some APIs
- * might disagree (but in any case util_pack_color()
- * couldn't handle it)...
- */
- if (util_format_is_pure_sint(format)) {
- util_format_write_4i(format, color->i, 0, &uc, 0, 0, 0, 1, 1);
- } else {
- assert(util_format_is_pure_uint(format));
- util_format_write_4ui(format, color->ui, 0, &uc, 0, 0, 0, 1, 1);
- }
- } else {
- util_pack_color(color->f, format, &uc);
- }
+ util_pack_color_union(format, &uc, color);
util_fill_box(dst_map, format,
dst_trans->stride, dst_trans->layer_stride,
break;
}
- if (util_format_is_pure_uint(pfmt)) {
- util_format_write_4ui(pfmt, swapped.ui, 0, &uc, 0, 0, 0, 1, 1);
- } else if (util_format_is_pure_sint(pfmt)) {
- util_format_write_4i(pfmt, swapped.i, 0, &uc, 0, 0, 0, 1, 1);
- } else {
- util_pack_color(swapped.f, pfmt, &uc);
- }
+ util_pack_color_union(pfmt, &uc, &swapped);
OUT_PKT4(ring, REG_A5XX_RB_BLIT_CNTL, 1);
OUT_RING(ring, A5XX_RB_BLIT_CNTL_BUF(BLIT_MRT0 + i));
break;
}
- if (util_format_is_pure_uint(pfmt)) {
- util_format_write_4ui(pfmt, swapped.ui, 0, &uc, 0, 0, 0, 1, 1);
- } else if (util_format_is_pure_sint(pfmt)) {
- util_format_write_4i(pfmt, swapped.i, 0, &uc, 0, 0, 0, 1, 1);
- } else {
- util_pack_color(swapped.f, pfmt, &uc);
- }
+ util_pack_color_union(pfmt, &uc, &swapped);
OUT_PKT4(ring, REG_A6XX_RB_BLIT_DST_INFO, 1);
OUT_RING(ring, A6XX_RB_BLIT_DST_INFO_TILE_MODE(TILE6_LINEAR) |
LP_DBG(DEBUG_SETUP, "%s state %d\n", __FUNCTION__, setup->state);
- if (util_format_is_pure_integer(format)) {
- /*
- * We expect int/uint clear values here, though some APIs
- * might disagree (but in any case util_pack_color()
- * couldn't handle it)...
- */
- if (util_format_is_pure_sint(format)) {
- util_format_write_4i(format, color->i, 0, &uc, 0, 0, 0, 1, 1);
- }
- else {
- assert(util_format_is_pure_uint(format));
- util_format_write_4ui(format, color->ui, 0, &uc, 0, 0, 0, 1, 1);
- }
- }
- else {
- util_pack_color(color->f, format, &uc);
- }
+ util_pack_color_union(format, &uc, color);
if (setup->state == SETUP_ACTIVE) {
struct lp_scene *scene = setup->scene;
color->ui[0] == color->ui[2]);
uc.ui[0] = color->ui[0];
uc.ui[1] = color->ui[3];
- } else if (util_format_is_pure_uint(surface_format)) {
- util_format_write_4ui(surface_format, color->ui, 0, &uc, 0, 0, 0, 1, 1);
- } else if (util_format_is_pure_sint(surface_format)) {
- util_format_write_4i(surface_format, color->i, 0, &uc, 0, 0, 0, 1, 1);
} else {
- util_pack_color(color->f, surface_format, &uc);
+ util_pack_color_union(surface_format, &uc, color);
}
memcpy(rtex->color_clear_value, &uc, 2 * sizeof(uint32_t));
color->ui[0] == color->ui[2]);
uc.ui[0] = color->ui[0];
uc.ui[1] = color->ui[3];
- } else if (util_format_is_pure_uint(surface_format)) {
- util_format_write_4ui(surface_format, color->ui, 0, &uc, 0, 0, 0, 1, 1);
- } else if (util_format_is_pure_sint(surface_format)) {
- util_format_write_4i(surface_format, color->i, 0, &uc, 0, 0, 0, 1, 1);
} else {
- util_pack_color(color->f, surface_format, &uc);
+ util_pack_color_union(surface_format, &uc, color);
}
if (memcmp(tex->color_clear_value, &uc, 2 * sizeof(uint32_t)) == 0)
struct si_texture *stex = (struct si_texture*)tex;
struct pipe_surface tmpl = {{0}};
struct pipe_surface *sf;
- const struct util_format_description *desc =
- util_format_description(tex->format);
tmpl.format = tex->format;
tmpl.u.tex.first_layer = box->z;