mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 02:20:11 +01:00
tu: Rewrite cache UUID based on radv
Switch to using sha1 so that we can add as many other flags as we need to easily. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16147>
This commit is contained in:
parent
410d59943d
commit
d023ae4686
1 changed files with 10 additions and 7 deletions
|
|
@ -60,16 +60,19 @@
|
||||||
static int
|
static int
|
||||||
tu_device_get_cache_uuid(uint16_t family, void *uuid)
|
tu_device_get_cache_uuid(uint16_t family, void *uuid)
|
||||||
{
|
{
|
||||||
uint32_t mesa_timestamp;
|
struct mesa_sha1 ctx;
|
||||||
uint16_t f = family;
|
unsigned char sha1[20];
|
||||||
|
|
||||||
memset(uuid, 0, VK_UUID_SIZE);
|
memset(uuid, 0, VK_UUID_SIZE);
|
||||||
if (!disk_cache_get_function_timestamp(tu_device_get_cache_uuid,
|
_mesa_sha1_init(&ctx);
|
||||||
&mesa_timestamp))
|
|
||||||
|
if (!disk_cache_get_function_identifier(tu_device_get_cache_uuid, &ctx))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memcpy(uuid, &mesa_timestamp, 4);
|
_mesa_sha1_update(&ctx, &family, sizeof(family));
|
||||||
memcpy((char *) uuid + 4, &f, 2);
|
_mesa_sha1_final(&ctx, sha1);
|
||||||
snprintf((char *) uuid + 6, VK_UUID_SIZE - 10, "tu");
|
|
||||||
|
memcpy(uuid, sha1, VK_UUID_SIZE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue