Mesa (staging/22.0): Revert "lavapipe: use util_pack_color_union() for generating clear colors"
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Feb 23 21:26:10 UTC 2022
Module: Mesa
Branch: staging/22.0
Commit: 4768d7d1f1dbdd046d9c70e454694a23a572a121
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4768d7d1f1dbdd046d9c70e454694a23a572a121
Author: Dylan Baker <dylan.c.baker at intel.com>
Date: Wed Feb 23 13:26:01 2022 -0800
Revert "lavapipe: use util_pack_color_union() for generating clear colors"
This reverts commit 72bf9bfbcd2811066f01d137216a90f5e0e76a4a.
---
.pick_status.json | 2 +-
src/gallium/frontends/lavapipe/lvp_execute.c | 36 +++++++++++++++++++++++++---
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 464065ad802..c68e0386008 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4729,7 +4729,7 @@
"description": "lavapipe: use util_pack_color_union() for generating clear colors",
"nominated": true,
"nomination_type": 0,
- "resolution": 1,
+ "resolution": 0,
"main_sha": null,
"because_sha": null
},
diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c
index d47f3ad4ba4..496a2458a34 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -3041,13 +3041,43 @@ static void handle_copy_query_pool_results(struct vk_cmd_queue_entry *cmd,
}
}
+static void pack_clear_color(enum pipe_format pformat, VkClearColorValue *in_val, uint32_t col_val[4])
+{
+ const struct util_format_description *desc = util_format_description(pformat);
+ col_val[0] = col_val[1] = col_val[2] = col_val[3] = 0;
+ for (unsigned c = 0; c < 4; c++) {
+ if (desc->swizzle[c] >= 4)
+ continue;
+ const struct util_format_channel_description *channel = &desc->channel[desc->swizzle[c]];
+ if (channel->size == 32) {
+ col_val[c] = in_val->uint32[c];
+ continue;
+ }
+ if (channel->pure_integer) {
+ uint64_t v = in_val->uint32[c] & ((1u << channel->size) - 1);
+ switch (channel->size) {
+ case 2:
+ case 8:
+ case 10:
+ col_val[0] |= (v << channel->shift);
+ break;
+ case 16:
+ col_val[c / 2] |= (v << (16 * (c % 2)));
+ break;
+ }
+ } else {
+ util_pack_color(in_val->float32, pformat, (union util_color *)col_val);
+ break;
+ }
+ }
+}
+
static void handle_clear_color_image(struct vk_cmd_queue_entry *cmd,
struct rendering_state *state)
{
LVP_FROM_HANDLE(lvp_image, image, cmd->u.clear_color_image.image);
- union util_color uc;
- uint32_t *col_val = uc.ui;
- util_pack_color_union(image->bo->format, &uc, (void*)cmd->u.clear_color_image.color);
+ uint32_t col_val[4];
+ pack_clear_color(image->bo->format, cmd->u.clear_color_image.color, col_val);
for (unsigned i = 0; i < cmd->u.clear_color_image.range_count; i++) {
VkImageSubresourceRange *range = &cmd->u.clear_color_image.ranges[i];
struct pipe_box box;
More information about the mesa-commit
mailing list