Rename SHA1 words to BLAKE3

Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40383>
This commit is contained in:
Marek Olšák 2026-03-12 22:35:32 -04:00 committed by Marge Bot
parent 102d41799b
commit 353fe94c0e
11 changed files with 17 additions and 17 deletions

View file

@ -892,7 +892,7 @@ agx_get_device_uuid(const struct agx_device *dev, void *uuid)
/* The device UUID uniquely identifies the given device within the machine.
* Since we never have more than one device, this doesn't need to be a real
* UUID, so we use SHA1("agx" + gpu_generation + gpu_variant + gpu_revision).
* UUID, so we use BLAKE3("agx" + gpu_generation + gpu_variant + gpu_revision).
*/
static const char *device_name = "agx";
_mesa_blake3_update(&blake3_ctx, device_name, strlen(device_name));

View file

@ -875,7 +875,7 @@ typedef struct nir_shader_compiler_options {
* outputs to inputs.
*
* Drivers can set the maximum cost based on the types of consecutive
* shaders or shader SHA1s.
* shaders or shader BLAKE3s.
*
* Drivers should also set "varying_estimate_instr_cost".
*/

View file

@ -47,7 +47,7 @@ fd_get_device_uuid(void *uuid, const struct fd_dev_id *id)
/* The device UUID uniquely identifies the given device within the machine.
* Since we never have more than one device, this doesn't need to be a real
* UUID, so we use SHA1("freedreno" + gpu_id).
* UUID, so we use BLAKE3("freedreno" + gpu_id).
*
* @TODO: Using the GPU id could be too restrictive on the off-chance that
* someone would like to use this UUID to cache pre-tiled images or something

View file

@ -37,13 +37,13 @@
static uint32_t key_hash(const void *key)
{
/* Take the first dword of SHA1. */
/* Take the first dword of BLAKE3. */
return *(uint32_t*)key;
}
static bool key_equals(const void *a, const void *b)
{
/* Compare SHA1s. */
/* Compare BLAKE3s. */
return memcmp(a, b, 20) == 0;
}
@ -97,7 +97,7 @@ util_live_shader_cache_get(struct pipe_context *ctx,
return NULL;
}
/* Compute SHA1 of pipe_shader_state. */
/* Compute BLAKE3 of pipe_shader_state. */
blake3_hasher blake3_ctx;
unsigned char blake3[BLAKE3_KEY_LEN];
_mesa_blake3_init(&blake3_ctx);

View file

@ -308,7 +308,7 @@ struct crocus_uncompiled_shader {
struct pipe_stream_output_info stream_output;
/* A SHA1 of the serialized NIR for the disk cache. */
/* A BLAKE3 of the serialized NIR for the disk cache. */
unsigned char nir_sha1[BLAKE3_KEY_LEN];
unsigned program_id;

View file

@ -545,7 +545,7 @@ struct iris_uncompiled_shader {
struct pipe_stream_output_info stream_output;
/* A SHA1 of the serialized NIR for the disk cache. */
/* A BLAKE3 of the serialized NIR for the disk cache. */
unsigned char nir_sha1[BLAKE3_KEY_LEN];
/* Hash value based on shader source program */

View file

@ -396,7 +396,7 @@ struct panfrost_uncompiled_shader {
*/
const nir_shader *nir;
/* A SHA1 of the serialized NIR for the disk cache. */
/* A BLAKE3 of the serialized NIR for the disk cache. */
unsigned char nir_sha1[BLAKE3_KEY_LEN];
/* Stream output information */

View file

@ -460,13 +460,13 @@ bool si_shader_cache_load_shader(struct si_screen *sscreen, unsigned char ir_bla
static uint32_t si_shader_cache_key_hash(const void *key)
{
/* Take the first dword of SHA1. */
/* Take the first dword of BLAKE3. */
return *(uint32_t *)key;
}
static bool si_shader_cache_key_equals(const void *a, const void *b)
{
/* Compare SHA1s. */
/* Compare BLAKE3s. */
return memcmp(a, b, 20) == 0;
}

View file

@ -179,7 +179,7 @@ struct gl_shader
enum gl_compile_status CompileStatus;
/** SHA1 of the pre-processed source used by the disk cache. */
/** BLAKE3 of the pre-processed source used by the disk cache. */
uint8_t disk_cache_sha1[BLAKE3_KEY_LEN];
/** BLAKE3 of the original source before replacement, set by glShaderSource. */
blake3_hash source_blake3;
@ -323,7 +323,7 @@ struct gl_shader_program_data
{
GLint RefCount; /**< Reference count */
/** SHA1 hash of linked shader program */
/** BLAKE3 hash of linked shader program */
unsigned char blake3[BLAKE3_KEY_LEN];
unsigned NumUniformStorage;

View file

@ -83,7 +83,7 @@ PRAGMA_DIAGNOSTIC_POP
/** Hash VkPipelineShaderStageCreateInfo info
*
* Returns the hash of a VkPipelineShaderStageCreateInfo:
* SHA1(info->module->sha1,
* BLAKE3(info->module->sha1,
* info->pName,
* vk_stage_to_mesa_stage(info->stage),
* info->pSpecializationInfo)

View file

@ -357,7 +357,7 @@ vk_shader_serialize(struct vk_device *device,
blake3_hasher blake3_ctx;
_mesa_blake3_init(&blake3_ctx);
/* Hash the header with a zero SHA1 */
/* Hash the header with a zero BLAKE3 */
_mesa_blake3_update(&blake3_ctx, &header, sizeof(header));
/* Hash the serialized data */
@ -430,7 +430,7 @@ vk_shader_deserialize(struct vk_device *device,
blake3_hasher blake3_ctx;
_mesa_blake3_init(&blake3_ctx);
/* Hash the header with a zero SHA1 */
/* Hash the header with a zero BLAKE3 */
struct vk_shader_bin_header blake3_header = header;
memset(blake3_header.blake3, 0, sizeof(blake3_header.blake3));
_mesa_blake3_update(&blake3_ctx, &blake3_header, sizeof(blake3_header));
@ -444,7 +444,7 @@ vk_shader_deserialize(struct vk_device *device,
return vk_error(device, VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT);
/* We've now verified that the header matches and that the data has the
* right SHA1 hash so it's safe to call into the driver.
* right BLAKE3 hash so it's safe to call into the driver.
*/
return ops->deserialize(device, &blob, header.version,
pAllocator, shader_out);