mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
pan/crc: Optimize clear color hashing
Take advantage of XOR associativity to break the loop-carried dependency chain and help compiler auto-vectorization. Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit is contained in:
parent
915085886c
commit
74c26ebaa4
1 changed files with 4 additions and 1 deletions
|
|
@ -1103,6 +1103,7 @@ pan_crc_maybe_enable_flushed(struct pan_crc *crc, struct pan_crc_state *state,
|
|||
static uint64_t
|
||||
pan_crc_clear_color(const struct pan_fb_info *fb)
|
||||
{
|
||||
uint64_t base[4] = { 0, }; /* Compiler auto-vectorization hint */
|
||||
uint64_t crc_clear_flag = 1;
|
||||
uint64_t crc_clear_base = 0;
|
||||
uint64_t crc_init = 0;
|
||||
|
|
@ -1139,7 +1140,9 @@ pan_crc_clear_color(const struct pan_fb_info *fb)
|
|||
for (unsigned i = 0; i < fb->rt_count; ++i)
|
||||
if (fb->rts[i].clear)
|
||||
for (unsigned j = 0; j < 4; ++j)
|
||||
crc_clear_base ^= 32749 * fb->rts[i].clear_value[j];
|
||||
base[i] ^= 32749 * fb->rts[i].clear_value[j];
|
||||
|
||||
crc_clear_base = (base[0] ^ base[1]) ^ (base[2] ^ base[3]);
|
||||
|
||||
return (crc_clear_flag << 63) | (crc_clear_base << 16) | crc_init;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue