mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-22 06:20:22 +01:00
ALL: use SHA1_DIGEST_LENGTH etc. instead of hardcoding the numbers
only build_id is switched to use literal 20 instead of SHA1_DIGEST_LENGTH because we will increase SHA1_DIGEST_LENGTH to BLAKE3_KEY_LEN Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39110>
This commit is contained in:
parent
9f5dd888b6
commit
1912a00a91
90 changed files with 245 additions and 237 deletions
|
|
@ -38,7 +38,7 @@ struct test_entry {
|
|||
uint8_t se;
|
||||
|
||||
/* value to determine uniqueness */
|
||||
unsigned char hash[20];
|
||||
unsigned char hash[SHA1_DIGEST_LENGTH];
|
||||
|
||||
/* u_vector requires power of two sizing */
|
||||
char padding[sizeof(void*) == 8 ? 8 : 16];
|
||||
|
|
|
|||
|
|
@ -570,8 +570,8 @@ radv_dump_shader(struct radv_device *device, struct radv_pipeline *pipeline, str
|
|||
fprintf(f, "%s:\n\n", radv_get_shader_name(&shader->info, stage));
|
||||
|
||||
if (shader->spirv) {
|
||||
unsigned char sha1[21];
|
||||
char sha1buf[41];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH + 1];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
|
||||
_mesa_sha1_compute(shader->spirv, shader->spirv_size, sha1);
|
||||
_mesa_sha1_format(sha1buf, sha1);
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ static int
|
|||
radv_device_get_cache_uuid(struct radv_physical_device *pdev, void *uuid)
|
||||
{
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
memset(uuid, 0, VK_UUID_SIZE);
|
||||
_mesa_sha1_init(&ctx);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
struct rt_handle_hash_entry {
|
||||
uint32_t key;
|
||||
char hash[20];
|
||||
char hash[SHA1_DIGEST_LENGTH];
|
||||
};
|
||||
|
||||
static uint32_t
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#define RADV_SHADER_H
|
||||
|
||||
#include "util/mesa-blake3.h"
|
||||
#include "util/sha1/sha1.h"
|
||||
#include "util/shader_stats.h"
|
||||
#include "util/u_math.h"
|
||||
#include "vulkan/vulkan.h"
|
||||
|
|
@ -269,7 +270,7 @@ struct radv_shader_stage {
|
|||
const char *entrypoint;
|
||||
const VkSpecializationInfo *spec_info;
|
||||
|
||||
unsigned char shader_sha1[20];
|
||||
unsigned char shader_sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
nir_shader *nir;
|
||||
nir_shader *gs_copy_shader;
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ hk_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||
}
|
||||
|
||||
unsigned build_id_len = build_id_length(note);
|
||||
if (build_id_len < SHA1_DIGEST_LENGTH) {
|
||||
if (build_id_len < 20) {
|
||||
result = vk_errorf(NULL, VK_ERROR_INITIALIZATION_FAILED,
|
||||
"build-id too short. It needs to be a SHA");
|
||||
goto fail_init;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ struct hk_instance {
|
|||
struct driOptionCache dri_options;
|
||||
struct driOptionCache available_dri_options;
|
||||
|
||||
uint8_t driver_build_sha[20];
|
||||
uint8_t driver_build_sha[SHA1_DIGEST_LENGTH];
|
||||
uint32_t force_vk_vendor;
|
||||
|
||||
bool no_border;
|
||||
|
|
|
|||
|
|
@ -1067,7 +1067,7 @@ hk_get_device_properties(const struct agx_device *dev,
|
|||
|
||||
{
|
||||
struct mesa_sha1 sha1_ctx;
|
||||
uint8_t sha1[20];
|
||||
uint8_t sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
_mesa_sha1_init(&sha1_ctx);
|
||||
/* Make sure we don't match with other vendors */
|
||||
|
|
@ -1108,7 +1108,7 @@ hk_physical_device_init_pipeline_cache(struct hk_physical_device *pdev)
|
|||
|
||||
assert(len == sizeof(renderer) - 2);
|
||||
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, instance->driver_build_sha);
|
||||
|
||||
const uint64_t driver_flags = hk_physical_device_compiler_flags(pdev);
|
||||
|
|
|
|||
|
|
@ -779,7 +779,7 @@ init_uuids(struct v3dv_physical_device *device)
|
|||
uint32_t device_id = v3dv_physical_device_device_id(device);
|
||||
|
||||
struct mesa_sha1 sha1_ctx;
|
||||
uint8_t sha1[20];
|
||||
uint8_t sha1[SHA1_DIGEST_LENGTH];
|
||||
STATIC_ASSERT(VK_UUID_SIZE <= sizeof(sha1));
|
||||
|
||||
/* The pipeline cache UUID is used for determining when a pipeline cache is
|
||||
|
|
@ -815,7 +815,7 @@ static void
|
|||
v3dv_physical_device_init_disk_cache(struct v3dv_physical_device *device)
|
||||
{
|
||||
#ifdef ENABLE_SHADER_CACHE
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, device->driver_build_sha1);
|
||||
|
||||
assert(device->name);
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ shader_module_compile_to_nir(struct v3dv_device *device,
|
|||
assert(nir->info.stage == gl_stage);
|
||||
|
||||
if (V3D_DBG(SHADERDB) && (!stage->module || stage->module->nir == NULL)) {
|
||||
char sha1buf[41];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1buf, stage->pipeline->sha1);
|
||||
nir->info.name = ralloc_strdup(nir, sha1buf);
|
||||
}
|
||||
|
|
@ -1439,7 +1439,7 @@ pipeline_stage_create_binning(const struct v3dv_pipeline_stage *src,
|
|||
p_stage->spec_info = src->spec_info;
|
||||
p_stage->feedback = (VkPipelineCreationFeedback) { 0 };
|
||||
p_stage->robustness = src->robustness;
|
||||
memcpy(p_stage->shader_sha1, src->shader_sha1, 20);
|
||||
memcpy(p_stage->shader_sha1, src->shader_sha1, SHA1_DIGEST_LENGTH);
|
||||
|
||||
return p_stage;
|
||||
}
|
||||
|
|
@ -2118,7 +2118,7 @@ pipeline_populate_compute_key(struct v3dv_pipeline *pipeline,
|
|||
}
|
||||
|
||||
static struct v3dv_pipeline_shared_data *
|
||||
v3dv_pipeline_shared_data_new_empty(const unsigned char sha1_key[20],
|
||||
v3dv_pipeline_shared_data_new_empty(const unsigned char sha1_key[SHA1_DIGEST_LENGTH],
|
||||
struct v3dv_pipeline *pipeline,
|
||||
bool is_graphics_pipeline)
|
||||
{
|
||||
|
|
@ -2172,7 +2172,7 @@ v3dv_pipeline_shared_data_new_empty(const unsigned char sha1_key[20],
|
|||
new_entry->maps[BROADCOM_SHADER_GEOMETRY];
|
||||
|
||||
new_entry->ref_cnt = 1;
|
||||
memcpy(new_entry->sha1_key, sha1_key, 20);
|
||||
memcpy(new_entry->sha1_key, sha1_key, SHA1_DIGEST_LENGTH);
|
||||
|
||||
return new_entry;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ static const bool dump_stats_on_destroy = false;
|
|||
static uint32_t
|
||||
sha1_hash_func(const void *sha1)
|
||||
{
|
||||
return _mesa_hash_data(sha1, 20);
|
||||
return _mesa_hash_data(sha1, SHA1_DIGEST_LENGTH);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
@ -46,7 +46,7 @@ sha1_compare_func(const void *sha1_a, const void *sha1_b)
|
|||
}
|
||||
|
||||
struct serialized_nir {
|
||||
unsigned char sha1_key[20];
|
||||
unsigned char sha1_key[SHA1_DIGEST_LENGTH];
|
||||
size_t size;
|
||||
char data[0];
|
||||
};
|
||||
|
|
@ -83,7 +83,7 @@ void
|
|||
v3dv_pipeline_cache_upload_nir(struct v3dv_pipeline *pipeline,
|
||||
struct v3dv_pipeline_cache *cache,
|
||||
nir_shader *nir,
|
||||
unsigned char sha1_key[20])
|
||||
unsigned char sha1_key[SHA1_DIGEST_LENGTH])
|
||||
{
|
||||
if (!cache || !cache->nir_cache)
|
||||
return;
|
||||
|
|
@ -121,7 +121,7 @@ v3dv_pipeline_cache_upload_nir(struct v3dv_pipeline *pipeline,
|
|||
|
||||
struct serialized_nir *snir =
|
||||
ralloc_size(cache->nir_cache, sizeof(*snir) + blob.size);
|
||||
memcpy(snir->sha1_key, sha1_key, 20);
|
||||
memcpy(snir->sha1_key, sha1_key, SHA1_DIGEST_LENGTH);
|
||||
snir->size = blob.size;
|
||||
memcpy(snir->data, blob.data, blob.size);
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ v3dv_pipeline_cache_upload_nir(struct v3dv_pipeline *pipeline,
|
|||
|
||||
cache->nir_stats.count++;
|
||||
if (debug_cache) {
|
||||
char sha1buf[41];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1buf, snir->sha1_key);
|
||||
mesa_logi("pipeline cache %p, new nir entry %s\n", cache, sha1buf);
|
||||
if (dump_stats)
|
||||
|
|
@ -145,13 +145,13 @@ nir_shader*
|
|||
v3dv_pipeline_cache_search_for_nir(struct v3dv_pipeline *pipeline,
|
||||
struct v3dv_pipeline_cache *cache,
|
||||
const nir_shader_compiler_options *nir_options,
|
||||
unsigned char sha1_key[20])
|
||||
unsigned char sha1_key[SHA1_DIGEST_LENGTH])
|
||||
{
|
||||
if (!cache || !cache->nir_cache)
|
||||
return NULL;
|
||||
|
||||
if (debug_cache) {
|
||||
char sha1buf[41];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1buf, sha1_key);
|
||||
|
||||
mesa_logi("pipeline cache %p, search for nir %s\n", cache, sha1buf);
|
||||
|
|
@ -249,14 +249,14 @@ v3dv_pipeline_shared_data_write_to_blob(const struct v3dv_pipeline_shared_data *
|
|||
*/
|
||||
struct v3dv_pipeline_shared_data *
|
||||
v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
|
||||
unsigned char sha1_key[20],
|
||||
unsigned char sha1_key[SHA1_DIGEST_LENGTH],
|
||||
bool *cache_hit)
|
||||
{
|
||||
if (!cache || !cache->cache)
|
||||
return NULL;
|
||||
|
||||
if (debug_cache) {
|
||||
char sha1buf[41];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1buf, sha1_key);
|
||||
|
||||
mesa_logi("pipeline cache %p, search pipeline with key %s\n", cache, sha1buf);
|
||||
|
|
@ -312,7 +312,7 @@ v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
|
|||
size_t buffer_size;
|
||||
uint8_t *buffer = disk_cache_get(disk_cache, cache_key, &buffer_size);
|
||||
if (V3D_DBG(CACHE)) {
|
||||
char sha1buf[41];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1buf, cache_key);
|
||||
mesa_logi("[v3dv on-disk cache] %s %s\n",
|
||||
buffer ? "hit" : "miss", sha1buf);
|
||||
|
|
@ -370,7 +370,7 @@ v3dv_pipeline_shared_data_destroy(struct v3dv_device *device,
|
|||
|
||||
static struct v3dv_pipeline_shared_data *
|
||||
v3dv_pipeline_shared_data_new(struct v3dv_pipeline_cache *cache,
|
||||
const unsigned char sha1_key[20],
|
||||
const unsigned char sha1_key[SHA1_DIGEST_LENGTH],
|
||||
struct v3dv_descriptor_maps **maps,
|
||||
struct v3dv_shader_variant **variants,
|
||||
const uint64_t *total_assembly,
|
||||
|
|
@ -390,7 +390,7 @@ v3dv_pipeline_shared_data_new(struct v3dv_pipeline_cache *cache,
|
|||
return NULL;
|
||||
|
||||
new_entry->ref_cnt = 1;
|
||||
memcpy(new_entry->sha1_key, sha1_key, 20);
|
||||
memcpy(new_entry->sha1_key, sha1_key, SHA1_DIGEST_LENGTH);
|
||||
|
||||
for (uint8_t stage = 0; stage < BROADCOM_SHADER_STAGES; stage++) {
|
||||
new_entry->maps[stage] = maps[stage];
|
||||
|
|
@ -452,7 +452,7 @@ pipeline_cache_upload_shared_data(struct v3dv_pipeline_cache *cache,
|
|||
_mesa_hash_table_insert(cache->cache, shared_data->sha1_key, shared_data);
|
||||
cache->stats.count++;
|
||||
if (debug_cache) {
|
||||
char sha1buf[41];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1buf, shared_data->sha1_key);
|
||||
|
||||
mesa_logi("pipeline cache %p, new cache entry with sha1 key %s:%p\n\n",
|
||||
|
|
@ -480,7 +480,7 @@ pipeline_cache_upload_shared_data(struct v3dv_pipeline_cache *cache,
|
|||
disk_cache_compute_key(disk_cache, shared_data->sha1_key, 20, cache_key);
|
||||
|
||||
if (V3D_DBG(CACHE)) {
|
||||
char sha1buf[41];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1buf, shared_data->sha1_key);
|
||||
mesa_logi("[v3dv on-disk cache] storing %s\n", sha1buf);
|
||||
}
|
||||
|
|
@ -504,7 +504,7 @@ static struct serialized_nir*
|
|||
serialized_nir_create_from_blob(struct v3dv_pipeline_cache *cache,
|
||||
struct blob_reader *blob)
|
||||
{
|
||||
const unsigned char *sha1_key = blob_read_bytes(blob, 20);
|
||||
const unsigned char *sha1_key = blob_read_bytes(blob, SHA1_DIGEST_LENGTH);
|
||||
uint32_t snir_size = blob_read_uint32(blob);
|
||||
const char* snir_data = blob_read_bytes(blob, snir_size);
|
||||
if (blob->overrun)
|
||||
|
|
@ -512,7 +512,7 @@ serialized_nir_create_from_blob(struct v3dv_pipeline_cache *cache,
|
|||
|
||||
struct serialized_nir *snir =
|
||||
ralloc_size(cache->nir_cache, sizeof(*snir) + snir_size);
|
||||
memcpy(snir->sha1_key, sha1_key, 20);
|
||||
memcpy(snir->sha1_key, sha1_key, SHA1_DIGEST_LENGTH);
|
||||
snir->size = snir_size;
|
||||
memcpy(snir->data, snir_data, snir_size);
|
||||
|
||||
|
|
@ -574,7 +574,7 @@ static struct v3dv_pipeline_shared_data *
|
|||
v3dv_pipeline_shared_data_create_from_blob(struct v3dv_pipeline_cache *cache,
|
||||
struct blob_reader *blob)
|
||||
{
|
||||
const unsigned char *sha1_key = blob_read_bytes(blob, 20);
|
||||
const unsigned char *sha1_key = blob_read_bytes(blob, SHA1_DIGEST_LENGTH);
|
||||
|
||||
struct v3dv_descriptor_maps *maps[BROADCOM_SHADER_STAGES] = { 0 };
|
||||
struct v3dv_shader_variant *variants[BROADCOM_SHADER_STAGES] = { 0 };
|
||||
|
|
@ -811,14 +811,14 @@ v3dv_MergePipelineCaches(VkDevice device,
|
|||
*/
|
||||
struct serialized_nir *snir_dst =
|
||||
ralloc_size(dst->nir_cache, sizeof(*snir_dst) + src_snir->size);
|
||||
memcpy(snir_dst->sha1_key, src_snir->sha1_key, 20);
|
||||
memcpy(snir_dst->sha1_key, src_snir->sha1_key, SHA1_DIGEST_LENGTH);
|
||||
snir_dst->size = src_snir->size;
|
||||
memcpy(snir_dst->data, src_snir->data, src_snir->size);
|
||||
|
||||
_mesa_hash_table_insert(dst->nir_cache, snir_dst->sha1_key, snir_dst);
|
||||
dst->nir_stats.count++;
|
||||
if (debug_cache) {
|
||||
char sha1buf[41];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1buf, snir_dst->sha1_key);
|
||||
|
||||
mesa_logi("pipeline cache %p, added nir entry %s "
|
||||
|
|
@ -841,7 +841,7 @@ v3dv_MergePipelineCaches(VkDevice device,
|
|||
|
||||
dst->stats.count++;
|
||||
if (debug_cache) {
|
||||
char sha1buf[41];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1buf, cache_entry->sha1_key);
|
||||
|
||||
mesa_logi("pipeline cache %p, added entry %s "
|
||||
|
|
@ -880,7 +880,7 @@ static bool
|
|||
v3dv_pipeline_shared_data_write_to_blob(const struct v3dv_pipeline_shared_data *cache_entry,
|
||||
struct blob *blob)
|
||||
{
|
||||
blob_write_bytes(blob, cache_entry->sha1_key, 20);
|
||||
blob_write_bytes(blob, cache_entry->sha1_key, SHA1_DIGEST_LENGTH);
|
||||
|
||||
uint8_t descriptor_maps_count = 0;
|
||||
for (uint8_t stage = 0; stage < BROADCOM_SHADER_STAGES; stage++) {
|
||||
|
|
@ -988,7 +988,7 @@ v3dv_GetPipelineCacheData(VkDevice _device,
|
|||
|
||||
size_t save_size = blob.size;
|
||||
|
||||
blob_write_bytes(&blob, snir->sha1_key, 20);
|
||||
blob_write_bytes(&blob, snir->sha1_key, SHA1_DIGEST_LENGTH);
|
||||
blob_write_uint32(&blob, snir->size);
|
||||
blob_write_bytes(&blob, snir->data, snir->size);
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ struct v3dv_physical_device {
|
|||
dev_t primary_devid;
|
||||
dev_t render_devid;
|
||||
|
||||
uint8_t driver_build_sha1[20];
|
||||
uint8_t driver_build_sha1[SHA1_DIGEST_LENGTH];
|
||||
uint8_t pipeline_cache_uuid[VK_UUID_SIZE];
|
||||
uint8_t device_uuid[VK_UUID_SIZE];
|
||||
uint8_t driver_uuid[VK_UUID_SIZE];
|
||||
|
|
@ -1958,7 +1958,7 @@ struct v3dv_pipeline_stage {
|
|||
nir_shader *nir;
|
||||
|
||||
/* The following is the combined hash of module+entrypoint+spec_info+nir */
|
||||
unsigned char shader_sha1[20];
|
||||
unsigned char shader_sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
/** A name for this program, so you can track it in shader-db output. */
|
||||
uint32_t program_id;
|
||||
|
|
@ -2135,7 +2135,7 @@ struct v3dv_pipeline_layout {
|
|||
*/
|
||||
uint32_t ref_cnt;
|
||||
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
};
|
||||
|
||||
void
|
||||
|
|
@ -2231,7 +2231,7 @@ struct v3dv_descriptor_maps {
|
|||
struct v3dv_pipeline_shared_data {
|
||||
uint32_t ref_cnt;
|
||||
|
||||
unsigned char sha1_key[20];
|
||||
unsigned char sha1_key[SHA1_DIGEST_LENGTH];
|
||||
|
||||
struct v3dv_descriptor_maps *maps[BROADCOM_SHADER_STAGES];
|
||||
struct v3dv_shader_variant *variants[BROADCOM_SHADER_STAGES];
|
||||
|
|
@ -2317,7 +2317,7 @@ struct v3dv_pipeline {
|
|||
struct v3dv_pipeline_shared_data *shared_data;
|
||||
|
||||
/* It is the combined stages sha1, layout sha1, plus the pipeline key sha1. */
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
/* In general we can reuse v3dv_device->default_attribute_float, so note
|
||||
* that the following can be NULL. In 7.x this is not used, so it will be
|
||||
|
|
@ -2519,16 +2519,16 @@ void v3dv_pipeline_cache_finish(struct v3dv_pipeline_cache *cache);
|
|||
void v3dv_pipeline_cache_upload_nir(struct v3dv_pipeline *pipeline,
|
||||
struct v3dv_pipeline_cache *cache,
|
||||
nir_shader *nir,
|
||||
unsigned char sha1_key[20]);
|
||||
unsigned char sha1_key[SHA1_DIGEST_LENGTH]);
|
||||
|
||||
nir_shader* v3dv_pipeline_cache_search_for_nir(struct v3dv_pipeline *pipeline,
|
||||
struct v3dv_pipeline_cache *cache,
|
||||
const nir_shader_compiler_options *nir_options,
|
||||
unsigned char sha1_key[20]);
|
||||
unsigned char sha1_key[SHA1_DIGEST_LENGTH]);
|
||||
|
||||
struct v3dv_pipeline_shared_data *
|
||||
v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
|
||||
unsigned char sha1_key[20],
|
||||
unsigned char sha1_key[SHA1_DIGEST_LENGTH],
|
||||
bool *cache_hit);
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1376,7 +1376,7 @@ v3dv_EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(
|
|||
counter->scope = VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_KHR;
|
||||
counter->storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR;
|
||||
|
||||
unsigned char sha1_result[20];
|
||||
unsigned char sha1_result[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_compute(perfcntr_desc->name, strlen(perfcntr_desc->name), sha1_result);
|
||||
|
||||
memcpy(counter->uuid, sha1_result, sizeof(counter->uuid));
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ get_libclc_file(unsigned ptr_bit_size)
|
|||
struct clc_data {
|
||||
const struct clc_file *file;
|
||||
|
||||
unsigned char cache_key[20];
|
||||
unsigned char cache_key[SHA1_DIGEST_LENGTH];
|
||||
|
||||
int fd;
|
||||
const void *data;
|
||||
|
|
|
|||
|
|
@ -2330,7 +2330,7 @@ can_skip_compile(struct gl_context *ctx, struct gl_shader *shader,
|
|||
{
|
||||
if (!force_recompile) {
|
||||
if (ctx->Cache) {
|
||||
char buf[41];
|
||||
char buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
disk_cache_compute_key(ctx->Cache, source, strlen(source),
|
||||
shader->disk_cache_sha1);
|
||||
if (disk_cache_has_key(ctx->Cache, shader->disk_cache_sha1)) {
|
||||
|
|
@ -2542,7 +2542,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
|
|||
ralloc_free(state);
|
||||
|
||||
if (ctx->Cache && shader->CompileStatus == COMPILE_SUCCESS) {
|
||||
char sha1_buf[41];
|
||||
char sha1_buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
disk_cache_put_key(ctx->Cache, shader->disk_cache_sha1);
|
||||
if (ctx->_Shader->Flags & GLSL_CACHE_INFO) {
|
||||
_mesa_sha1_format(sha1_buf, shader->disk_cache_sha1);
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ shader_cache_write_program_metadata(struct gl_context *ctx,
|
|||
disk_cache_put(cache, prog->data->sha1, metadata.data, metadata.size,
|
||||
&cache_item_metadata);
|
||||
|
||||
char sha1_buf[41];
|
||||
char sha1_buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
if (ctx->_Shader->Flags & GLSL_CACHE_INFO) {
|
||||
_mesa_sha1_format(sha1_buf, prog->data->sha1);
|
||||
fprintf(stderr, "putting program metadata in cache: %s\n", sha1_buf);
|
||||
|
|
@ -195,7 +195,7 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
|
|||
/* DRI config options may also change the output from the compiler so
|
||||
* include them as an input to sha1 creation.
|
||||
*/
|
||||
char sha1buf[41];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1buf, ctx->Const.dri_config_options_sha1);
|
||||
ralloc_strcat(&buf, sha1buf);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ ir3_disk_cache_init(struct ir3_compiler *compiler)
|
|||
sizeof(compiler->options.uche_trap_base));
|
||||
_mesa_sha1_final(&ctx, sha1);
|
||||
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, sha1);
|
||||
|
||||
uint64_t driver_flags = ir3_shader_debug_hash_key();
|
||||
|
|
@ -225,7 +225,7 @@ ir3_disk_cache_retrieve(struct ir3_shader *shader,
|
|||
compute_variant_key(shader, v, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving variant %s: ", sha1);
|
||||
}
|
||||
|
|
@ -264,7 +264,7 @@ ir3_disk_cache_store(struct ir3_shader *shader,
|
|||
compute_variant_key(shader, v, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing variant %s\n", sha1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -395,7 +395,7 @@ assemble_variant(struct ir3_shader_variant *v, bool internal)
|
|||
{
|
||||
v->bin = ir3_shader_assemble(v);
|
||||
|
||||
unsigned char sha1[21];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH + 1];
|
||||
|
||||
struct mesa_sha1 ctx;
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ struct tu_pipeline_layout
|
|||
uint32_t num_sets;
|
||||
uint32_t push_constant_size;
|
||||
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
};
|
||||
VK_DEFINE_NONDISP_HANDLE_CASTS(tu_pipeline_layout, base, VkPipelineLayout,
|
||||
VK_OBJECT_TYPE_PIPELINE_LAYOUT)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ static int
|
|||
tu_device_get_cache_uuid(struct tu_physical_device *device, void *uuid)
|
||||
{
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
/* Note: IR3_SHADER_DEBUG also affects compilation, but it's not
|
||||
* initialized until after compiler creation so we have to add it to the
|
||||
* shader hash instead, since the compiler is only created with the logical
|
||||
|
|
@ -1451,7 +1451,7 @@ tu_get_properties(struct tu_physical_device *pdevice,
|
|||
|
||||
{
|
||||
struct mesa_sha1 sha1_ctx;
|
||||
uint8_t sha1[20];
|
||||
uint8_t sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
_mesa_sha1_init(&sha1_ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -1936,26 +1936,26 @@ tu_pipeline_builder_compile_shaders(struct tu_pipeline_builder *builder,
|
|||
!builder->rasterizer_discard && msaa_info && msaa_info->sampleShadingEnable;
|
||||
}
|
||||
|
||||
unsigned char pipeline_sha1[20];
|
||||
unsigned char pipeline_sha1[SHA1_DIGEST_LENGTH];
|
||||
tu_hash_shaders(pipeline_sha1, builder->create_flags, stage_infos, nir,
|
||||
&builder->layout, keys, builder->state);
|
||||
|
||||
unsigned char nir_sha1[21];
|
||||
unsigned char nir_sha1[SHA1_DIGEST_LENGTH + 1];
|
||||
memcpy(nir_sha1, pipeline_sha1, sizeof(pipeline_sha1));
|
||||
nir_sha1[20] = 'N';
|
||||
nir_sha1[SHA1_DIGEST_LENGTH] = 'N';
|
||||
|
||||
if (!executable_info) {
|
||||
cache_hit = true;
|
||||
bool application_cache_hit = false;
|
||||
|
||||
unsigned char shader_sha1[21];
|
||||
unsigned char shader_sha1[SHA1_DIGEST_LENGTH + 1];
|
||||
memcpy(shader_sha1, pipeline_sha1, sizeof(pipeline_sha1));
|
||||
|
||||
for (mesa_shader_stage stage = MESA_SHADER_VERTEX; stage < ARRAY_SIZE(nir);
|
||||
stage = (mesa_shader_stage) (stage + 1)) {
|
||||
if (stage_infos[stage] || nir[stage]) {
|
||||
bool shader_application_cache_hit;
|
||||
shader_sha1[20] = (unsigned char) stage;
|
||||
shader_sha1[SHA1_DIGEST_LENGTH] = (unsigned char) stage;
|
||||
shaders[stage] =
|
||||
tu_pipeline_cache_lookup(builder->cache, &shader_sha1,
|
||||
sizeof(shader_sha1),
|
||||
|
|
@ -4856,7 +4856,7 @@ tu_compute_pipeline_create(VkDevice device,
|
|||
|
||||
void *pipeline_mem_ctx = ralloc_context(NULL);
|
||||
|
||||
unsigned char pipeline_sha1[20];
|
||||
unsigned char pipeline_sha1[SHA1_DIGEST_LENGTH];
|
||||
tu_hash_compute(pipeline_sha1, flags, stage_info, layout, &key);
|
||||
|
||||
struct tu_shader *shader = NULL;
|
||||
|
|
|
|||
|
|
@ -2211,7 +2211,7 @@ tu_EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(
|
|||
counter->storage =
|
||||
fd_perfcntr_type_to_vk_storage[group[i].countables[j].query_type];
|
||||
|
||||
unsigned char sha1_result[20];
|
||||
unsigned char sha1_result[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_compute(group[i].countables[j].name,
|
||||
strlen(group[i].countables[j].name),
|
||||
sha1_result);
|
||||
|
|
@ -2243,7 +2243,7 @@ tu_EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(
|
|||
counter->unit = fd_perfcntr_type_to_vk_unit[derived_counter->type];
|
||||
counter->storage = fd_perfcntr_type_to_vk_storage[derived_counter->type];
|
||||
|
||||
unsigned char sha1_result[20];
|
||||
unsigned char sha1_result[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_compute(derived_counter->name, strlen(derived_counter->name),
|
||||
sha1_result);
|
||||
memcpy(counter->uuid, sha1_result, sizeof(counter->uuid));
|
||||
|
|
|
|||
|
|
@ -3319,9 +3319,9 @@ tu_compile_shaders(struct tu_device *device,
|
|||
|
||||
int64_t stage_start = os_time_get_nano();
|
||||
|
||||
unsigned char shader_sha1[21];
|
||||
memcpy(shader_sha1, pipeline_sha1, 20);
|
||||
shader_sha1[20] = (unsigned char) stage;
|
||||
unsigned char shader_sha1[SHA1_DIGEST_LENGTH + 1];
|
||||
memcpy(shader_sha1, pipeline_sha1, SHA1_DIGEST_LENGTH);
|
||||
shader_sha1[SHA1_DIGEST_LENGTH] = (unsigned char) stage;
|
||||
|
||||
result = tu_shader_create(device,
|
||||
&shaders[stage], nir[stage], &keys[stage],
|
||||
|
|
|
|||
|
|
@ -1276,10 +1276,10 @@ draw_set_disk_cache_callbacks(struct draw_context *draw,
|
|||
void *data_cookie,
|
||||
void (*find_shader)(void *cookie,
|
||||
struct lp_cached_code *cache,
|
||||
unsigned char ir_sha1_cache_key[20]),
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH]),
|
||||
void (*insert_shader)(void *cookie,
|
||||
struct lp_cached_code *cache,
|
||||
unsigned char ir_sha1_cache_key[20]))
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH]))
|
||||
{
|
||||
draw->disk_cache_find_shader = find_shader;
|
||||
draw->disk_cache_insert_shader = insert_shader;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "util/sha1/sha1.h"
|
||||
#include "nir.h"
|
||||
|
||||
struct pipe_context;
|
||||
|
|
@ -422,10 +423,10 @@ draw_set_disk_cache_callbacks(struct draw_context *draw,
|
|||
void *data_cookie,
|
||||
void (*find_shader)(void *cookie,
|
||||
struct lp_cached_code *cache,
|
||||
unsigned char ir_sha1_cache_key[20]),
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH]),
|
||||
void (*insert_shader)(void *cookie,
|
||||
struct lp_cached_code *cache,
|
||||
unsigned char ir_sha1_cache_key[20]));
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH]));
|
||||
|
||||
|
||||
#endif /* DRAW_CONTEXT_H */
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ static void
|
|||
draw_get_ir_cache_key(struct nir_shader *nir,
|
||||
const void *key, size_t key_size,
|
||||
uint32_t val_32bit,
|
||||
unsigned char ir_sha1_cache_key[20])
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH])
|
||||
{
|
||||
struct blob blob = { 0 };
|
||||
unsigned ir_size;
|
||||
|
|
@ -476,7 +476,7 @@ draw_llvm_create_variant(struct draw_llvm *llvm,
|
|||
struct llvm_vertex_shader *shader =
|
||||
llvm_vertex_shader(llvm->draw->vs.vertex_shader);
|
||||
char module_name[64];
|
||||
unsigned char ir_sha1_cache_key[20];
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH];
|
||||
struct lp_cached_code cached = { 0 };
|
||||
bool needs_caching = false;
|
||||
variant = MALLOC(sizeof *variant +
|
||||
|
|
@ -2505,7 +2505,7 @@ draw_gs_llvm_create_variant(struct draw_llvm *llvm,
|
|||
struct llvm_geometry_shader *shader =
|
||||
llvm_geometry_shader(llvm->draw->gs.geometry_shader);
|
||||
char module_name[64];
|
||||
unsigned char ir_sha1_cache_key[20];
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH];
|
||||
struct lp_cached_code cached = { 0 };
|
||||
bool needs_caching = false;
|
||||
|
||||
|
|
@ -3177,7 +3177,7 @@ draw_tcs_llvm_create_variant(struct draw_llvm *llvm,
|
|||
struct draw_tcs_llvm_variant *variant;
|
||||
struct llvm_tess_ctrl_shader *shader = llvm_tess_ctrl_shader(llvm->draw->tcs.tess_ctrl_shader);
|
||||
char module_name[64];
|
||||
unsigned char ir_sha1_cache_key[20];
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH];
|
||||
struct lp_cached_code cached = { 0 };
|
||||
bool needs_caching = false;
|
||||
|
||||
|
|
@ -3715,7 +3715,7 @@ draw_tes_llvm_create_variant(struct draw_llvm *llvm,
|
|||
struct draw_tes_llvm_variant *variant;
|
||||
struct llvm_tess_eval_shader *shader = llvm_tess_eval_shader(llvm->draw->tes.tess_eval_shader);
|
||||
char module_name[64];
|
||||
unsigned char ir_sha1_cache_key[20];
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH];
|
||||
struct lp_cached_code cached = { 0 };
|
||||
bool needs_caching = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "util/sha1/sha1.h"
|
||||
|
||||
#include "draw_vertex_header.h"
|
||||
|
||||
|
|
@ -399,10 +400,10 @@ struct draw_context
|
|||
void *disk_cache_cookie;
|
||||
void (*disk_cache_find_shader)(void *cookie,
|
||||
struct lp_cached_code *cache,
|
||||
unsigned char ir_sha1_cache_key[20]);
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH]);
|
||||
void (*disk_cache_insert_shader)(void *cookie,
|
||||
struct lp_cached_code *cache,
|
||||
unsigned char ir_sha1_cache_key[20]);
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH]);
|
||||
|
||||
void *driver_private;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ util_live_shader_cache_get(struct pipe_context *ctx,
|
|||
|
||||
/* Compute SHA1 of pipe_shader_state. */
|
||||
struct mesa_sha1 sha1_ctx;
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_init(&sha1_ctx);
|
||||
_mesa_sha1_update(&sha1_ctx, ir_binary, ir_size);
|
||||
if ((stage == MESA_SHADER_VERTEX ||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
#ifndef U_LIVE_SHADER_CACHE_H
|
||||
#define U_LIVE_SHADER_CACHE_H
|
||||
|
||||
#include "util/sha1/sha1.h"
|
||||
#include "util/simple_mtx.h"
|
||||
#include "pipe/p_state.h"
|
||||
|
||||
|
|
@ -69,7 +70,7 @@ struct util_live_shader_cache {
|
|||
|
||||
struct util_live_shader {
|
||||
struct pipe_reference reference;
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
};
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ agx_disk_cache_init(struct agx_screen *screen)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
uint64_t driver_flags = screen->dev.debug;
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ struct agx_uncompiled_shader {
|
|||
mesa_shader_stage type;
|
||||
struct blob early_serialized_nir;
|
||||
struct blob serialized_nir;
|
||||
uint8_t nir_sha1[20];
|
||||
uint8_t nir_sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
struct {
|
||||
uint64_t inputs_flat_shaded;
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ struct crocus_uncompiled_shader {
|
|||
struct pipe_stream_output_info stream_output;
|
||||
|
||||
/* A SHA1 of the serialized NIR for the disk cache. */
|
||||
unsigned char nir_sha1[20];
|
||||
unsigned char nir_sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
unsigned program_id;
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ crocus_disk_cache_store(struct disk_cache *cache,
|
|||
crocus_disk_cache_compute_key(cache, ish, prog_key, prog_key_size, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing %s\n", sha1);
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ crocus_disk_cache_retrieve(struct crocus_context *ice,
|
|||
crocus_disk_cache_compute_key(cache, ish, prog_key, key_size, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving %s: ", sha1);
|
||||
}
|
||||
|
|
@ -250,7 +250,7 @@ crocus_disk_cache_init(struct crocus_screen *screen)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
const uint64_t driver_flags =
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ etna_disk_cache_init(struct etna_compiler *compiler, const char *renderer)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
compiler->disk_cache = disk_cache_create(renderer, timestamp, etna_mesa_debug);
|
||||
|
|
@ -131,7 +131,7 @@ etna_disk_cache_retrieve(struct etna_compiler *compiler, struct etna_shader_vari
|
|||
compute_variant_key(compiler, v, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving variant %s: ", sha1);
|
||||
|
|
@ -167,7 +167,7 @@ etna_disk_cache_store(struct etna_compiler *compiler, struct etna_shader_variant
|
|||
compute_variant_key(compiler, v, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing variant %s\n", sha1);
|
||||
|
|
|
|||
|
|
@ -575,7 +575,7 @@ struct iris_uncompiled_shader {
|
|||
struct pipe_stream_output_info stream_output;
|
||||
|
||||
/* A SHA1 of the serialized NIR for the disk cache. */
|
||||
unsigned char nir_sha1[20];
|
||||
unsigned char nir_sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
/* Hash value based on shader source program */
|
||||
unsigned source_hash;
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ iris_disk_cache_store(struct disk_cache *cache,
|
|||
iris_disk_cache_compute_key(cache, ish, prog_key, prog_key_size, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing %s\n", sha1);
|
||||
}
|
||||
|
|
@ -203,7 +203,7 @@ iris_disk_cache_retrieve(struct iris_screen *screen,
|
|||
iris_disk_cache_compute_key(cache, ish, prog_key, key_size, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving %s: ", sha1);
|
||||
}
|
||||
|
|
@ -361,7 +361,7 @@ iris_disk_cache_init(struct iris_screen *screen)
|
|||
char renderer[5 + 40 + 1] = {0};
|
||||
|
||||
if (screen->brw) {
|
||||
char device_info_sha[41];
|
||||
char device_info_sha[SHA1_DIGEST_STRING_LENGTH];
|
||||
brw_device_sha1(device_info_sha, screen->devinfo);
|
||||
memcpy(renderer, "iris_", 5);
|
||||
memcpy(renderer + 5, device_info_sha, 40);
|
||||
|
|
@ -379,7 +379,7 @@ iris_disk_cache_init(struct iris_screen *screen)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
const uint64_t driver_flags =
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#define H_LIMA_CONTEXT
|
||||
|
||||
#include "util/list.h"
|
||||
#include "util/sha1/sha1.h"
|
||||
#include "util/slab.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
|
|
@ -56,11 +57,11 @@ struct lima_fs_compiled_shader {
|
|||
|
||||
struct lima_fs_uncompiled_shader {
|
||||
struct pipe_shader_state base;
|
||||
unsigned char nir_sha1[20];
|
||||
unsigned char nir_sha1[SHA1_DIGEST_LENGTH];
|
||||
};
|
||||
|
||||
struct lima_fs_key {
|
||||
unsigned char nir_sha1[20];
|
||||
unsigned char nir_sha1[SHA1_DIGEST_LENGTH];
|
||||
struct {
|
||||
uint8_t swizzle[4];
|
||||
} tex[PIPE_MAX_SAMPLERS];
|
||||
|
|
@ -94,11 +95,11 @@ struct lima_vs_compiled_shader {
|
|||
|
||||
struct lima_vs_uncompiled_shader {
|
||||
struct pipe_shader_state base;
|
||||
unsigned char nir_sha1[20];
|
||||
unsigned char nir_sha1[SHA1_DIGEST_LENGTH];
|
||||
};
|
||||
|
||||
struct lima_vs_key {
|
||||
unsigned char nir_sha1[20];
|
||||
unsigned char nir_sha1[SHA1_DIGEST_LENGTH];
|
||||
};
|
||||
|
||||
struct lima_rasterizer_state {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ lima_vs_disk_cache_store(struct disk_cache *cache,
|
|||
disk_cache_compute_key(cache, key, sizeof(*key), cache_key);
|
||||
|
||||
if (lima_debug & LIMA_DEBUG_DISK_CACHE) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing %s\n", sha1);
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ lima_fs_disk_cache_store(struct disk_cache *cache,
|
|||
disk_cache_compute_key(cache, key, sizeof(*key), cache_key);
|
||||
|
||||
if (lima_debug & LIMA_DEBUG_DISK_CACHE) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing %s\n", sha1);
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ lima_vs_disk_cache_retrieve(struct disk_cache *cache,
|
|||
disk_cache_compute_key(cache, key, sizeof(*key), cache_key);
|
||||
|
||||
if (lima_debug & LIMA_DEBUG_DISK_CACHE) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving %s: ", sha1);
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ lima_fs_disk_cache_retrieve(struct disk_cache *cache,
|
|||
disk_cache_compute_key(cache, key, sizeof(*key), cache_key);
|
||||
|
||||
if (lima_debug & LIMA_DEBUG_DISK_CACHE) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving %s: ", sha1);
|
||||
}
|
||||
|
|
@ -198,7 +198,7 @@ lima_disk_cache_init(struct lima_screen *screen)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
screen->disk_cache = disk_cache_create(screen->base.get_name(&screen->base), timestamp, 0);
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ llvmpipe_texture_barrier(struct pipe_context *pipe, unsigned flags)
|
|||
static void
|
||||
lp_draw_disk_cache_find_shader(void *cookie,
|
||||
struct lp_cached_code *cache,
|
||||
unsigned char ir_sha1_cache_key[20])
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH])
|
||||
{
|
||||
struct llvmpipe_screen *screen = cookie;
|
||||
lp_disk_cache_find_shader(screen, cache, ir_sha1_cache_key);
|
||||
|
|
@ -184,7 +184,7 @@ lp_draw_disk_cache_find_shader(void *cookie,
|
|||
static void
|
||||
lp_draw_disk_cache_insert_shader(void *cookie,
|
||||
struct lp_cached_code *cache,
|
||||
unsigned char ir_sha1_cache_key[20])
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH])
|
||||
{
|
||||
struct llvmpipe_screen *screen = cookie;
|
||||
lp_disk_cache_insert_shader(screen, cache, ir_sha1_cache_key);
|
||||
|
|
|
|||
|
|
@ -848,8 +848,8 @@ lp_disk_cache_create(struct llvmpipe_screen *screen)
|
|||
{
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned gallivm_perf = gallivm_get_perf_flags();
|
||||
unsigned char sha1[20];
|
||||
char cache_id[20 * 2 + 1];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
char cache_id[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_init(&ctx);
|
||||
|
||||
if (!disk_cache_get_function_identifier(lp_disk_cache_create, &ctx) ||
|
||||
|
|
@ -859,7 +859,7 @@ lp_disk_cache_create(struct llvmpipe_screen *screen)
|
|||
_mesa_sha1_update(&ctx, &gallivm_perf, sizeof(gallivm_perf));
|
||||
update_cache_sha1_cpu(&ctx);
|
||||
_mesa_sha1_final(&ctx, sha1);
|
||||
mesa_bytes_to_hex(cache_id, sha1, 20);
|
||||
mesa_bytes_to_hex(cache_id, sha1, SHA1_DIGEST_LENGTH);
|
||||
|
||||
screen->disk_shader_cache = disk_cache_create("llvmpipe", cache_id, 0);
|
||||
}
|
||||
|
|
@ -889,7 +889,7 @@ llvmpipe_screen_get_fd(struct pipe_screen *_screen)
|
|||
void
|
||||
lp_disk_cache_find_shader(struct llvmpipe_screen *screen,
|
||||
struct lp_cached_code *cache,
|
||||
unsigned char ir_sha1_cache_key[20])
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH])
|
||||
{
|
||||
unsigned char sha1[CACHE_KEY_SIZE];
|
||||
|
||||
|
|
@ -913,7 +913,7 @@ lp_disk_cache_find_shader(struct llvmpipe_screen *screen,
|
|||
void
|
||||
lp_disk_cache_insert_shader(struct llvmpipe_screen *screen,
|
||||
struct lp_cached_code *cache,
|
||||
unsigned char ir_sha1_cache_key[20])
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH])
|
||||
{
|
||||
unsigned char sha1[CACHE_KEY_SIZE];
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "pipe/p_defines.h"
|
||||
#include "util/u_thread.h"
|
||||
#include "util/list.h"
|
||||
#include "util/sha1/sha1.h"
|
||||
#include "util/vma.h"
|
||||
#include "gallivm/lp_bld.h"
|
||||
#include "gallivm/lp_bld_misc.h"
|
||||
|
|
@ -92,13 +93,13 @@ struct llvmpipe_screen
|
|||
void
|
||||
lp_disk_cache_find_shader(struct llvmpipe_screen *screen,
|
||||
struct lp_cached_code *cache,
|
||||
unsigned char ir_sha1_cache_key[20]);
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH]);
|
||||
|
||||
|
||||
void
|
||||
lp_disk_cache_insert_shader(struct llvmpipe_screen *screen,
|
||||
struct lp_cached_code *cache,
|
||||
unsigned char ir_sha1_cache_key[20]);
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH]);
|
||||
|
||||
bool
|
||||
llvmpipe_screen_late_init(struct llvmpipe_screen *screen);
|
||||
|
|
|
|||
|
|
@ -1251,7 +1251,7 @@ lp_debug_cs_variant(const struct lp_compute_shader_variant *variant)
|
|||
|
||||
static void
|
||||
lp_cs_get_ir_cache_key(struct lp_compute_shader_variant *variant,
|
||||
unsigned char ir_sha1_cache_key[20])
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH])
|
||||
{
|
||||
struct blob blob = { 0 };
|
||||
unsigned ir_size;
|
||||
|
|
@ -1296,7 +1296,7 @@ generate_variant(struct llvmpipe_context *lp,
|
|||
variant->shader = shader;
|
||||
memcpy(&variant->key, key, shader->variant_key_size);
|
||||
|
||||
unsigned char ir_sha1_cache_key[20];
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH];
|
||||
struct lp_cached_code cached = { 0 };
|
||||
bool needs_caching = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -3811,7 +3811,7 @@ lp_debug_fs_variant(struct lp_fragment_shader_variant *variant)
|
|||
|
||||
static void
|
||||
lp_fs_get_ir_cache_key(struct lp_fragment_shader_variant *variant,
|
||||
unsigned char ir_sha1_cache_key[20])
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH])
|
||||
{
|
||||
struct blob blob = { 0 };
|
||||
unsigned ir_size;
|
||||
|
|
@ -3856,7 +3856,7 @@ generate_variant(struct llvmpipe_context *lp,
|
|||
|
||||
struct llvmpipe_screen *screen = llvmpipe_screen(lp->pipe.screen);
|
||||
struct lp_cached_code cached = { 0 };
|
||||
unsigned char ir_sha1_cache_key[20];
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH];
|
||||
bool needs_caching = false;
|
||||
if (shader->base.ir.nir) {
|
||||
lp_fs_get_ir_cache_key(variant, ir_sha1_cache_key);
|
||||
|
|
|
|||
|
|
@ -176,8 +176,8 @@ static void
|
|||
nouveau_disk_cache_create(struct nouveau_screen *screen)
|
||||
{
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned char sha1[20];
|
||||
char cache_id[20 * 2 + 1];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
char cache_id[SHA1_DIGEST_STRING_LENGTH];
|
||||
uint64_t driver_flags = 0;
|
||||
|
||||
_mesa_sha1_init(&ctx);
|
||||
|
|
@ -186,7 +186,7 @@ nouveau_disk_cache_create(struct nouveau_screen *screen)
|
|||
return;
|
||||
|
||||
_mesa_sha1_final(&ctx, sha1);
|
||||
mesa_bytes_to_hex(cache_id, sha1, 20);
|
||||
mesa_bytes_to_hex(cache_id, sha1, SHA1_DIGEST_LENGTH);
|
||||
|
||||
driver_flags |= NOUVEAU_SHADER_CACHE_FLAGS_IR_NIR;
|
||||
|
||||
|
|
@ -276,7 +276,7 @@ nouveau_driver_uuid(struct pipe_screen *screen, char *uuid)
|
|||
{
|
||||
const char* driver = PACKAGE_VERSION MESA_GIT_SHA1;
|
||||
struct mesa_sha1 sha1_ctx;
|
||||
uint8_t sha1[20];
|
||||
uint8_t sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
_mesa_sha1_init(&sha1_ctx);
|
||||
_mesa_sha1_update(&sha1_ctx, driver, strlen(driver));
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ struct panfrost_uncompiled_shader {
|
|||
const nir_shader *nir;
|
||||
|
||||
/* A SHA1 of the serialized NIR for the disk cache. */
|
||||
unsigned char nir_sha1[20];
|
||||
unsigned char nir_sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
/* Stream output information */
|
||||
struct pipe_stream_output_info stream_output;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ panfrost_disk_cache_store(struct disk_cache *cache,
|
|||
panfrost_disk_cache_compute_key(cache, uncompiled, key, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing %s\n", sha1);
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ panfrost_disk_cache_retrieve(struct disk_cache *cache,
|
|||
panfrost_disk_cache_compute_key(cache, uncompiled, key, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving %s: ", sha1);
|
||||
}
|
||||
|
|
@ -174,7 +174,7 @@ panfrost_disk_cache_init(struct panfrost_screen *screen)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
/* Consider any flags affecting the compile when caching */
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ static const char* r300_get_name(struct pipe_screen* pscreen)
|
|||
static void r300_disk_cache_create(struct r300_screen* r300screen)
|
||||
{
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned char sha1[20];
|
||||
char cache_id[20 * 2 + 1];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
char cache_id[SHA1_DIGEST_STRING_LENGTH];
|
||||
|
||||
_mesa_sha1_init(&ctx);
|
||||
if (!disk_cache_get_function_identifier(r300_disk_cache_create,
|
||||
|
|
@ -89,7 +89,7 @@ static void r300_disk_cache_create(struct r300_screen* r300screen)
|
|||
return;
|
||||
|
||||
_mesa_sha1_final(&ctx, sha1);
|
||||
mesa_bytes_to_hex(cache_id, sha1, 20);
|
||||
mesa_bytes_to_hex(cache_id, sha1, SHA1_DIGEST_LENGTH);
|
||||
|
||||
r300screen->disk_shader_cache =
|
||||
disk_cache_create(r300_get_family_name(r300screen),
|
||||
|
|
|
|||
|
|
@ -754,8 +754,8 @@ static void r600_disk_cache_create(struct r600_common_screen *rscreen)
|
|||
return;
|
||||
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned char sha1[20];
|
||||
char cache_id[20 * 2 + 1];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
char cache_id[SHA1_DIGEST_STRING_LENGTH];
|
||||
|
||||
_mesa_sha1_init(&ctx);
|
||||
if (!disk_cache_get_function_identifier(r600_disk_cache_create,
|
||||
|
|
@ -763,7 +763,7 @@ static void r600_disk_cache_create(struct r600_common_screen *rscreen)
|
|||
return;
|
||||
|
||||
_mesa_sha1_final(&ctx, sha1);
|
||||
mesa_bytes_to_hex(cache_id, sha1, 20);
|
||||
mesa_bytes_to_hex(cache_id, sha1, SHA1_DIGEST_LENGTH);
|
||||
|
||||
/* These flags affect shader compilation. */
|
||||
rscreen->disk_shader_cache =
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ static void si_create_compute_state_async(void *job, void *gdata, int thread_ind
|
|||
program->shader.is_monolithic = true;
|
||||
program->shader.wave_size = si_determine_wave_size(sscreen, &program->shader);
|
||||
|
||||
unsigned char ir_sha1_cache_key[20];
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH];
|
||||
si_get_ir_cache_key(sel, false, false, shader->wave_size, ir_sha1_cache_key);
|
||||
|
||||
/* Try to load the shader from the shader cache. */
|
||||
|
|
|
|||
|
|
@ -1162,8 +1162,8 @@ static void si_disk_cache_create(struct si_screen *sscreen)
|
|||
return;
|
||||
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned char sha1[20];
|
||||
char cache_id[20 * 2 + 1];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
char cache_id[SHA1_DIGEST_STRING_LENGTH];
|
||||
|
||||
_mesa_sha1_init(&ctx);
|
||||
|
||||
|
|
@ -1190,7 +1190,7 @@ static void si_disk_cache_create(struct si_screen *sscreen)
|
|||
_mesa_sha1_update(&ctx, &sscreen->use_aco, sizeof(sscreen->use_aco));
|
||||
|
||||
_mesa_sha1_final(&ctx, sha1);
|
||||
mesa_bytes_to_hex(cache_id, sha1, 20);
|
||||
mesa_bytes_to_hex(cache_id, sha1, SHA1_DIGEST_LENGTH);
|
||||
|
||||
sscreen->disk_shader_cache = disk_cache_create(ac_get_family_name(sscreen->info.family),
|
||||
cache_id, sscreen->info.address32_hi);
|
||||
|
|
|
|||
|
|
@ -475,10 +475,10 @@ void si_emit_dpbb_state(struct si_context *sctx, unsigned index);
|
|||
|
||||
/* si_state_shaders.cpp */
|
||||
void si_get_ir_cache_key(struct si_shader_selector *sel, bool ngg, bool es,
|
||||
unsigned wave_size, unsigned char ir_sha1_cache_key[20]);
|
||||
bool si_shader_cache_load_shader(struct si_screen *sscreen, unsigned char ir_sha1_cache_key[20],
|
||||
unsigned wave_size, unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH]);
|
||||
bool si_shader_cache_load_shader(struct si_screen *sscreen, unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH],
|
||||
struct si_shader *shader);
|
||||
void si_shader_cache_insert_shader(struct si_screen *sscreen, unsigned char ir_sha1_cache_key[20],
|
||||
void si_shader_cache_insert_shader(struct si_screen *sscreen, unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH],
|
||||
struct si_shader *shader, bool insert_into_disk_cache);
|
||||
bool si_shader_mem_ordered(struct si_shader *shader);
|
||||
void si_init_screen_live_shader_cache(struct si_screen *sscreen);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ static bool si_shader_uses_bindless_images(struct si_shader_selector *selector)
|
|||
* Return the IR key for the shader cache.
|
||||
*/
|
||||
void si_get_ir_cache_key(struct si_shader_selector *sel, bool ngg, bool es,
|
||||
unsigned wave_size, unsigned char ir_sha1_cache_key[20])
|
||||
unsigned wave_size, unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH])
|
||||
{
|
||||
struct blob blob = {};
|
||||
unsigned ir_size;
|
||||
|
|
@ -344,7 +344,7 @@ static bool si_load_shader_binary(struct si_shader *shader, void *binary)
|
|||
* Insert a shader into the cache. It's assumed the shader is not in the cache.
|
||||
* Use si_shader_cache_load_shader before calling this.
|
||||
*/
|
||||
void si_shader_cache_insert_shader(struct si_screen *sscreen, unsigned char ir_sha1_cache_key[20],
|
||||
void si_shader_cache_insert_shader(struct si_screen *sscreen, unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH],
|
||||
struct si_shader *shader, bool insert_into_disk_cache)
|
||||
{
|
||||
uint32_t *hw_binary;
|
||||
|
|
@ -408,7 +408,7 @@ void si_shader_cache_insert_shader(struct si_screen *sscreen, unsigned char ir_s
|
|||
FREE(hw_binary);
|
||||
}
|
||||
|
||||
bool si_shader_cache_load_shader(struct si_screen *sscreen, unsigned char ir_sha1_cache_key[20],
|
||||
bool si_shader_cache_load_shader(struct si_screen *sscreen, unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH],
|
||||
struct si_shader *shader)
|
||||
{
|
||||
struct hash_entry *entry = _mesa_hash_table_search(sscreen->shader_cache, ir_sha1_cache_key);
|
||||
|
|
@ -3442,7 +3442,7 @@ static void si_init_shader_selector_async(void *job, void *gdata, int thread_ind
|
|||
*/
|
||||
if (!sscreen->use_monolithic_shaders) {
|
||||
struct si_shader *shader = CALLOC_STRUCT(si_shader);
|
||||
unsigned char ir_sha1_cache_key[20];
|
||||
unsigned char ir_sha1_cache_key[SHA1_DIGEST_LENGTH];
|
||||
|
||||
if (!shader) {
|
||||
mesa_loge("can't allocate a main shader part");
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ struct v3d_uncompiled_shader {
|
|||
uint32_t num_tf_specs;
|
||||
|
||||
/* For caching */
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
};
|
||||
|
||||
struct v3d_compiled_shader {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void v3d_disk_cache_init(struct v3d_screen *screen)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
screen->disk_cache =
|
||||
|
|
@ -85,7 +85,7 @@ v3d_disk_cache_compute_key(struct disk_cache *cache,
|
|||
struct blob blob;
|
||||
blob_init(&blob);
|
||||
blob_write_bytes(&blob, ckey, ckey_size);
|
||||
blob_write_bytes(&blob, uncompiled->sha1, 20);
|
||||
blob_write_bytes(&blob, uncompiled->sha1, SHA1_DIGEST_LENGTH);
|
||||
|
||||
disk_cache_compute_key(cache, blob.data, blob.size, cache_key);
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ v3d_disk_cache_retrieve(struct v3d_context *v3d,
|
|||
void *buffer = disk_cache_get(cache, cache_key, &buffer_size);
|
||||
|
||||
if (V3D_DBG(CACHE)) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[v3d on-disk cache] %s %s\n",
|
||||
buffer ? "hit" : "miss",
|
||||
|
|
@ -197,7 +197,7 @@ v3d_disk_cache_store(struct v3d_context *v3d,
|
|||
v3d_disk_cache_compute_key(cache, key, cache_key, uncompiled);
|
||||
|
||||
if (V3D_DBG(CACHE)) {
|
||||
char sha1[41];
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[v3d on-disk cache] storing %s\n", sha1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ v3d_shader_state_create(struct pipe_context *pctx,
|
|||
/* Key ued with the RAM cache */
|
||||
struct v3d_cache_key {
|
||||
struct v3d_key *key;
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
};
|
||||
|
||||
struct v3d_compiled_shader *
|
||||
|
|
@ -970,12 +970,12 @@ cache_hash(const void *_key, uint32_t key_size)
|
|||
const struct v3d_cache_key *key = (struct v3d_cache_key *) _key;
|
||||
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_init(&ctx);
|
||||
_mesa_sha1_update(&ctx, key->key, key_size);
|
||||
_mesa_sha1_update(&ctx, key->sha1, 20);
|
||||
_mesa_sha1_update(&ctx, key->sha1, SHA1_DIGEST_LENGTH);
|
||||
_mesa_sha1_final(&ctx, sha1);
|
||||
return _mesa_hash_data(sha1, 20);
|
||||
return _mesa_hash_data(sha1, SHA1_DIGEST_LENGTH);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
|
|
|||
|
|
@ -922,9 +922,9 @@ static void virgl_disk_cache_create(struct virgl_screen *screen)
|
|||
* apply different lowering. */
|
||||
_mesa_sha1_update(&sha1_ctx, &screen->caps, sizeof(screen->caps));
|
||||
|
||||
uint8_t sha1[20];
|
||||
uint8_t sha1[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_final(&sha1_ctx, sha1);
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, sha1);
|
||||
|
||||
screen->disk_cache = disk_cache_create("virgl", timestamp, 0);
|
||||
|
|
|
|||
|
|
@ -345,8 +345,8 @@ disk_cache_init(struct zink_screen *screen)
|
|||
blake3_hash blake3;
|
||||
_mesa_blake3_final(&ctx, blake3);
|
||||
|
||||
char cache_id[20 * 2 + 1];
|
||||
mesa_bytes_to_hex(cache_id, blake3, 20);
|
||||
char cache_id[SHA1_DIGEST_STRING_LENGTH];
|
||||
mesa_bytes_to_hex(cache_id, blake3, SHA1_DIGEST_LENGTH);
|
||||
|
||||
screen->disk_cache = disk_cache_create("zink", cache_id, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -1177,7 +1177,7 @@ create_shader_object(struct lvp_device *device, const VkShaderCreateInfoEXT *pCr
|
|||
if (memcmp(uuid, data, VK_UUID_SIZE))
|
||||
return VK_NULL_HANDLE;
|
||||
size_t size = pCreateInfo->codeSize - SHA1_DIGEST_LENGTH - VK_UUID_SIZE;
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
struct mesa_sha1 sctx;
|
||||
_mesa_sha1_init(&sctx);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#define _API_H_
|
||||
|
||||
#include "util/format/u_formats.h"
|
||||
#include "util/sha1/sha1.h"
|
||||
|
||||
struct st_context;
|
||||
|
||||
|
|
@ -207,7 +208,7 @@ struct st_config_options
|
|||
bool allow_multisampled_copyteximage;
|
||||
bool vertex_program_default_out;
|
||||
|
||||
unsigned char config_options_sha1[20];
|
||||
unsigned char config_options_sha1[SHA1_DIGEST_LENGTH];
|
||||
};
|
||||
|
||||
struct pipe_frontend_screen;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ intel_uuid_compute_driver_id(uint8_t *uuid,
|
|||
{
|
||||
const char* intelDriver = PACKAGE_VERSION MESA_GIT_SHA1;
|
||||
struct mesa_sha1 sha1_ctx;
|
||||
uint8_t sha1[20];
|
||||
uint8_t sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
assert(size <= sizeof(sha1));
|
||||
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ brw_device_sha1(char *hex,
|
|||
struct mesa_sha1 ctx;
|
||||
_mesa_sha1_init(&ctx);
|
||||
brw_device_sha1_update(&ctx, devinfo);
|
||||
unsigned char result[20];
|
||||
unsigned char result[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_final(&ctx, result);
|
||||
_mesa_sha1_format(hex, result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1483,8 +1483,8 @@ brw_generator::generate_code(const brw_shader &s,
|
|||
int after_size = p->next_insn_offset - start_offset;
|
||||
|
||||
bool dump_shader_bin = brw_should_dump_shader_bin();
|
||||
unsigned char sha1[21];
|
||||
char sha1buf[41];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH + 1];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
|
||||
auto override_path = debug_get_option_shader_bin_override_path();
|
||||
if (unlikely(debug_flag || dump_shader_bin || override_path != NULL ||
|
||||
|
|
|
|||
|
|
@ -2206,8 +2206,8 @@ elk_fs_generator::generate_code(const elk_cfg_t *cfg, int dispatch_width,
|
|||
int after_size = p->next_insn_offset - start_offset;
|
||||
|
||||
bool dump_shader_bin = elk_should_dump_shader_bin();
|
||||
unsigned char sha1[21];
|
||||
char sha1buf[41];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH + 1];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
|
||||
if (unlikely(debug_flag || dump_shader_bin)) {
|
||||
_mesa_sha1_compute(p->store + start_offset / sizeof(elk_inst),
|
||||
|
|
|
|||
|
|
@ -2238,8 +2238,8 @@ generate_code(struct elk_codegen *p,
|
|||
int after_size = p->next_insn_offset;
|
||||
|
||||
bool dump_shader_bin = elk_should_dump_shader_bin();
|
||||
unsigned char sha1[21];
|
||||
char sha1buf[41];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH + 1];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
|
||||
if (unlikely(debug_enabled || dump_shader_bin)) {
|
||||
_mesa_sha1_compute(p->store, p->next_insn_offset, sha1);
|
||||
|
|
|
|||
|
|
@ -815,10 +815,10 @@ intel_perf_store_configuration(struct intel_perf_config *perf_cfg, int fd,
|
|||
config->n_b_counter_regs);
|
||||
}
|
||||
|
||||
uint8_t hash[20];
|
||||
uint8_t hash[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_final(&sha1_ctx, hash);
|
||||
|
||||
char formatted_hash[41];
|
||||
char formatted_hash[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(formatted_hash, hash);
|
||||
|
||||
char generated_guid[37];
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ main(int argc, char *argv[])
|
|||
*/
|
||||
if (devinfo.ver >= 9) {
|
||||
JSON_Object *obj = json_object(json);
|
||||
char device_info_sha[41];
|
||||
char device_info_sha[SHA1_DIGEST_STRING_LENGTH];
|
||||
brw_device_sha1(device_info_sha, &devinfo);
|
||||
json_object_set_string(obj, "shader_cache_sha1", device_info_sha);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ VkResult anv_EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(
|
|||
counter->scope = VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_KHR;
|
||||
counter->storage = intel_perf_counter_data_type_to_vk_storage[intel_counter->data_type];
|
||||
|
||||
unsigned char sha1_result[20];
|
||||
unsigned char sha1_result[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_compute(intel_counter->symbol_name,
|
||||
strlen(intel_counter->symbol_name),
|
||||
sha1_result);
|
||||
|
|
|
|||
|
|
@ -1783,7 +1783,7 @@ get_properties(const struct anv_physical_device *pdevice,
|
|||
*/
|
||||
{
|
||||
struct mesa_sha1 sha1_ctx;
|
||||
uint8_t sha1[20];
|
||||
uint8_t sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
_mesa_sha1_init(&sha1_ctx);
|
||||
_mesa_sha1_update(&sha1_ctx, pdevice->driver_build_sha1,
|
||||
|
|
@ -2362,7 +2362,7 @@ anv_physical_device_init_uuids(struct anv_physical_device *device)
|
|||
memcpy(device->driver_build_sha1, build_id_data(note), 20);
|
||||
|
||||
struct mesa_sha1 sha1_ctx;
|
||||
uint8_t sha1[20];
|
||||
uint8_t sha1[SHA1_DIGEST_LENGTH];
|
||||
STATIC_ASSERT(VK_UUID_SIZE <= sizeof(sha1));
|
||||
|
||||
/* The pipeline cache UUID is used for determining when a pipeline cache is
|
||||
|
|
@ -2392,7 +2392,7 @@ anv_physical_device_init_disk_cache(struct anv_physical_device *device)
|
|||
device->info.pci_device_id);
|
||||
assert(len == sizeof(renderer) - 2);
|
||||
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, device->driver_build_sha1);
|
||||
|
||||
const uint64_t driver_flags =
|
||||
|
|
|
|||
|
|
@ -436,7 +436,7 @@ anv_load_fp64_shader(struct anv_device *device)
|
|||
|
||||
const char* shader_name = "float64_spv_lib";
|
||||
struct mesa_sha1 sha1_ctx;
|
||||
uint8_t sha1[20];
|
||||
uint8_t sha1[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_init(&sha1_ctx);
|
||||
_mesa_sha1_update(&sha1_ctx, shader_name, strlen(shader_name));
|
||||
_mesa_sha1_final(&sha1_ctx, sha1);
|
||||
|
|
|
|||
|
|
@ -1172,9 +1172,9 @@ enum anv_pipeline_bind_mask {
|
|||
#define ANV_PIPELINE_BIND_MASK_SET(i) (ANV_PIPELINE_BIND_MASK_SET0 << i)
|
||||
|
||||
struct anv_pipeline_bind_map {
|
||||
unsigned char surface_sha1[20];
|
||||
unsigned char sampler_sha1[20];
|
||||
unsigned char push_sha1[20];
|
||||
unsigned char surface_sha1[SHA1_DIGEST_LENGTH];
|
||||
unsigned char sampler_sha1[SHA1_DIGEST_LENGTH];
|
||||
unsigned char push_sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
/* enum anv_descriptor_set_layout_type */
|
||||
uint16_t layout_type;
|
||||
|
|
@ -1649,7 +1649,7 @@ struct anv_physical_device {
|
|||
struct anv_memregion vram_mappable;
|
||||
struct anv_memregion vram_non_mappable;
|
||||
struct anv_memregion sys;
|
||||
uint8_t driver_build_sha1[20];
|
||||
uint8_t driver_build_sha1[SHA1_DIGEST_LENGTH];
|
||||
uint8_t shader_binary_uuid[VK_UUID_SIZE];
|
||||
uint8_t pipeline_cache_uuid[VK_UUID_SIZE];
|
||||
uint8_t driver_uuid[VK_UUID_SIZE];
|
||||
|
|
@ -1876,14 +1876,14 @@ struct nir_shader *
|
|||
anv_device_search_for_nir(struct anv_device *device,
|
||||
struct vk_pipeline_cache *cache,
|
||||
const struct nir_shader_compiler_options *nir_options,
|
||||
unsigned char sha1_key[20],
|
||||
unsigned char sha1_key[SHA1_DIGEST_LENGTH],
|
||||
void *mem_ctx);
|
||||
|
||||
void
|
||||
anv_device_upload_nir(struct anv_device *device,
|
||||
struct vk_pipeline_cache *cache,
|
||||
const struct nir_shader *nir,
|
||||
unsigned char sha1_key[20]);
|
||||
unsigned char sha1_key[SHA1_DIGEST_LENGTH]);
|
||||
|
||||
void
|
||||
anv_load_fp64_shader(struct anv_device *device);
|
||||
|
|
@ -4720,9 +4720,9 @@ struct anv_cmd_state {
|
|||
struct anv_state binding_tables[MESA_VULKAN_SHADER_STAGES];
|
||||
struct anv_state samplers[MESA_VULKAN_SHADER_STAGES];
|
||||
|
||||
unsigned char sampler_sha1s[MESA_VULKAN_SHADER_STAGES][20];
|
||||
unsigned char surface_sha1s[MESA_VULKAN_SHADER_STAGES][20];
|
||||
unsigned char push_sha1s[MESA_VULKAN_SHADER_STAGES][20];
|
||||
unsigned char sampler_sha1s[MESA_VULKAN_SHADER_STAGES][SHA1_DIGEST_LENGTH];
|
||||
unsigned char surface_sha1s[MESA_VULKAN_SHADER_STAGES][SHA1_DIGEST_LENGTH];
|
||||
unsigned char push_sha1s[MESA_VULKAN_SHADER_STAGES][SHA1_DIGEST_LENGTH];
|
||||
|
||||
/* The last auxiliary surface operation (or equivalent operation) provided
|
||||
* to genX(cmd_buffer_update_color_aux_op).
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ anv_shader_init_uuid(struct anv_physical_device *device)
|
|||
device->instance->large_workgroup_non_coherent_image_workaround;
|
||||
_mesa_sha1_update(&ctx, &large_wg_wa, sizeof(large_wg_wa));
|
||||
|
||||
uint8_t sha1[20];
|
||||
uint8_t sha1[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_final(&ctx, sha1);
|
||||
memcpy(device->shader_binary_uuid, sha1, sizeof(device->shader_binary_uuid));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1412,7 +1412,7 @@ anv_physical_device_init_uuids(struct anv_physical_device *device)
|
|||
memcpy(device->driver_build_sha1, build_id_data(note), 20);
|
||||
|
||||
struct mesa_sha1 sha1_ctx;
|
||||
uint8_t sha1[20];
|
||||
uint8_t sha1[SHA1_DIGEST_LENGTH];
|
||||
STATIC_ASSERT(VK_UUID_SIZE <= sizeof(sha1));
|
||||
|
||||
/* The pipeline cache UUID is used for determining when a pipeline cache is
|
||||
|
|
@ -1446,7 +1446,7 @@ anv_physical_device_init_disk_cache(struct anv_physical_device *device)
|
|||
device->info.pci_device_id);
|
||||
assert(len == sizeof(renderer) - 2);
|
||||
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, device->driver_build_sha1);
|
||||
|
||||
const uint64_t driver_flags =
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ VkResult anv_EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(
|
|||
counter->scope = VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_KHR;
|
||||
counter->storage = intel_perf_counter_data_type_to_vk_storage[intel_counter->data_type];
|
||||
|
||||
unsigned char sha1_result[20];
|
||||
unsigned char sha1_result[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_compute(intel_counter->symbol_name,
|
||||
strlen(intel_counter->symbol_name),
|
||||
sha1_result);
|
||||
|
|
|
|||
|
|
@ -337,13 +337,13 @@ struct anv_pipeline_stage {
|
|||
VkPipelineCreateFlags2KHR pipeline_flags;
|
||||
const VkPipelineShaderStageCreateInfo *info;
|
||||
|
||||
unsigned char shader_sha1[20];
|
||||
unsigned char shader_sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
union elk_any_prog_key key;
|
||||
|
||||
struct {
|
||||
mesa_shader_stage stage;
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
} cache_key;
|
||||
|
||||
nir_shader *nir;
|
||||
|
|
@ -1230,7 +1230,7 @@ anv_graphics_pipeline_compile(struct anv_graphics_pipeline *pipeline,
|
|||
|
||||
anv_graphics_pipeline_init_keys(pipeline, state, stages);
|
||||
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
anv_pipeline_hash_graphics(pipeline, layout, stages, sha1);
|
||||
|
||||
for (unsigned s = 0; s < ARRAY_SIZE(stages); s++) {
|
||||
|
|
|
|||
|
|
@ -886,7 +886,7 @@ struct anv_physical_device {
|
|||
} memory;
|
||||
|
||||
struct anv_memregion sys;
|
||||
uint8_t driver_build_sha1[20];
|
||||
uint8_t driver_build_sha1[SHA1_DIGEST_LENGTH];
|
||||
uint8_t pipeline_cache_uuid[VK_UUID_SIZE];
|
||||
uint8_t driver_uuid[VK_UUID_SIZE];
|
||||
uint8_t device_uuid[VK_UUID_SIZE];
|
||||
|
|
@ -981,14 +981,14 @@ struct nir_shader *
|
|||
anv_device_search_for_nir(struct anv_device *device,
|
||||
struct vk_pipeline_cache *cache,
|
||||
const struct nir_shader_compiler_options *nir_options,
|
||||
unsigned char sha1_key[20],
|
||||
unsigned char sha1_key[SHA1_DIGEST_LENGTH],
|
||||
void *mem_ctx);
|
||||
|
||||
void
|
||||
anv_device_upload_nir(struct anv_device *device,
|
||||
struct vk_pipeline_cache *cache,
|
||||
const struct nir_shader *nir,
|
||||
unsigned char sha1_key[20]);
|
||||
unsigned char sha1_key[SHA1_DIGEST_LENGTH]);
|
||||
|
||||
struct anv_device {
|
||||
struct vk_device vk;
|
||||
|
|
@ -1932,7 +1932,7 @@ struct anv_pipeline_layout {
|
|||
|
||||
uint32_t num_sets;
|
||||
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
};
|
||||
|
||||
struct anv_buffer {
|
||||
|
|
@ -2481,9 +2481,9 @@ struct anv_cmd_state {
|
|||
struct anv_state binding_tables[MESA_VULKAN_SHADER_STAGES];
|
||||
struct anv_state samplers[MESA_VULKAN_SHADER_STAGES];
|
||||
|
||||
unsigned char sampler_sha1s[MESA_VULKAN_SHADER_STAGES][20];
|
||||
unsigned char surface_sha1s[MESA_VULKAN_SHADER_STAGES][20];
|
||||
unsigned char push_sha1s[MESA_VULKAN_SHADER_STAGES][20];
|
||||
unsigned char sampler_sha1s[MESA_VULKAN_SHADER_STAGES][SHA1_DIGEST_LENGTH];
|
||||
unsigned char surface_sha1s[MESA_VULKAN_SHADER_STAGES][SHA1_DIGEST_LENGTH];
|
||||
unsigned char push_sha1s[MESA_VULKAN_SHADER_STAGES][SHA1_DIGEST_LENGTH];
|
||||
|
||||
/**
|
||||
* Whether or not the gfx8 PMA fix is enabled. We ensure that, at the top
|
||||
|
|
@ -2702,9 +2702,9 @@ struct anv_event {
|
|||
__tmp &= ~(1 << (stage)))
|
||||
|
||||
struct anv_pipeline_bind_map {
|
||||
unsigned char surface_sha1[20];
|
||||
unsigned char sampler_sha1[20];
|
||||
unsigned char push_sha1[20];
|
||||
unsigned char surface_sha1[SHA1_DIGEST_LENGTH];
|
||||
unsigned char sampler_sha1[SHA1_DIGEST_LENGTH];
|
||||
unsigned char push_sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
uint32_t surface_count;
|
||||
uint32_t sampler_count;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ struct program_binary_header {
|
|||
* something besides a sha1, then a new internal_format value can be added.
|
||||
*/
|
||||
uint32_t internal_format;
|
||||
uint8_t sha1[20];
|
||||
uint8_t sha1[SHA1_DIGEST_LENGTH];
|
||||
/* Fields following sha1 can be changed since the sha1 will guarantee that
|
||||
* the binary only works with the same Mesa version.
|
||||
*/
|
||||
|
|
@ -236,7 +236,7 @@ _mesa_get_program_binary(struct gl_context *ctx,
|
|||
GLenum *binary_format, GLvoid *binary)
|
||||
{
|
||||
struct blob blob;
|
||||
uint8_t driver_sha1[20];
|
||||
uint8_t driver_sha1[SHA1_DIGEST_LENGTH];
|
||||
unsigned header_size = get_program_binary_header_size();
|
||||
|
||||
st_get_program_binary_driver_sha1(ctx, driver_sha1);
|
||||
|
|
@ -273,7 +273,7 @@ _mesa_program_binary(struct gl_context *ctx, struct gl_shader_program *sh_prog,
|
|||
GLenum binary_format, const GLvoid *binary,
|
||||
GLsizei length)
|
||||
{
|
||||
uint8_t driver_sha1[20];
|
||||
uint8_t driver_sha1[SHA1_DIGEST_LENGTH];
|
||||
unsigned header_size = get_program_binary_header_size();
|
||||
|
||||
st_get_program_binary_driver_sha1(ctx, driver_sha1);
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ struct gl_shader_program_data
|
|||
GLint RefCount; /**< Reference count */
|
||||
|
||||
/** SHA1 hash of linked shader program */
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
|
||||
unsigned NumUniformStorage;
|
||||
unsigned NumHiddenUniforms;
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ nvk_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||
}
|
||||
|
||||
unsigned build_id_len = build_id_length(note);
|
||||
if (build_id_len < SHA1_DIGEST_LENGTH) {
|
||||
if (build_id_len < 20) {
|
||||
result = vk_errorf(NULL, VK_ERROR_INITIALIZATION_FAILED,
|
||||
"build-id too short. It needs to be a SHA");
|
||||
goto fail_init;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ struct nvk_instance {
|
|||
struct driOptionCache dri_options;
|
||||
struct driOptionCache available_dri_options;
|
||||
|
||||
uint8_t driver_build_sha[20];
|
||||
uint8_t driver_build_sha[SHA1_DIGEST_LENGTH];
|
||||
uint32_t force_vk_vendor;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1329,7 +1329,7 @@ nvk_physical_device_init_pipeline_cache(struct nvk_physical_device *pdev)
|
|||
pdev->info.chipset);
|
||||
assert(len == sizeof(renderer) - 2);
|
||||
|
||||
char timestamp[41];
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(timestamp, instance->driver_build_sha);
|
||||
|
||||
const uint64_t driver_flags = nvk_physical_device_compiler_flags(pdev);
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ panvk_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||
}
|
||||
|
||||
unsigned build_id_len = build_id_length(note);
|
||||
if (build_id_len < SHA1_DIGEST_LENGTH) {
|
||||
if (build_id_len < 20) {
|
||||
return panvk_errorf(NULL, VK_ERROR_INITIALIZATION_FAILED,
|
||||
"build-id too short. It needs to be a SHA");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ struct panvk_instance {
|
|||
struct driOptionCache dri_options;
|
||||
struct driOptionCache available_dri_options;
|
||||
|
||||
uint8_t driver_build_sha[20];
|
||||
uint8_t driver_build_sha[SHA1_DIGEST_LENGTH];
|
||||
uint32_t force_vk_vendor;
|
||||
|
||||
bool enable_vertex_pipeline_stores_atomics;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/* Size of cache keys in bytes. */
|
||||
#define CACHE_KEY_SIZE 20
|
||||
#define CACHE_KEY_SIZE SHA1_DIGEST_LENGTH
|
||||
|
||||
#define CACHE_DIR_NAME "mesa_shader_cache"
|
||||
#define CACHE_DIR_NAME_SF "mesa_shader_cache_sf"
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ static void
|
|||
make_cache_file_directory(struct disk_cache *cache, const cache_key key)
|
||||
{
|
||||
char *dir;
|
||||
char buf[41];
|
||||
char buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
|
||||
_mesa_sha1_format(buf, key);
|
||||
if (asprintf(&dir, "%s/%c%c", cache->path, buf[0], buf[1]) == -1)
|
||||
|
|
@ -678,7 +678,7 @@ disk_cache_load_item(struct disk_cache *cache, char *filename, size_t *size)
|
|||
char *
|
||||
disk_cache_get_cache_filename(struct disk_cache *cache, const cache_key key)
|
||||
{
|
||||
char buf[41];
|
||||
char buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char *filename;
|
||||
|
||||
if (cache->path_init_failed)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sha1/sha1.h"
|
||||
#include "simple_mtx.h"
|
||||
|
||||
/* Max number of DBs our implementation can read from at once */
|
||||
|
|
@ -71,7 +72,7 @@ struct foz_payload_header {
|
|||
|
||||
struct foz_db_entry {
|
||||
uint8_t file_idx;
|
||||
uint8_t key[20];
|
||||
uint8_t key[SHA1_DIGEST_LENGTH];
|
||||
uint64_t offset;
|
||||
struct foz_payload_header header;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include <inttypes.h>
|
||||
|
||||
void
|
||||
_mesa_sha1_compute(const void *data, size_t size, unsigned char result[20])
|
||||
_mesa_sha1_compute(const void *data, size_t size, unsigned char result[SHA1_DIGEST_LENGTH])
|
||||
{
|
||||
struct mesa_sha1 ctx;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ _mesa_sha1_update(struct mesa_sha1 *ctx, const void *data, size_t size)
|
|||
}
|
||||
|
||||
static inline void
|
||||
_mesa_sha1_final(struct mesa_sha1 *ctx, unsigned char result[20])
|
||||
_mesa_sha1_final(struct mesa_sha1 *ctx, unsigned char result[SHA1_DIGEST_LENGTH])
|
||||
{
|
||||
SHA1Final(result, ctx);
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ void
|
|||
_mesa_sha1_hex_to_sha1(unsigned char *buf, const char *hex);
|
||||
|
||||
void
|
||||
_mesa_sha1_compute(const void *data, size_t size, unsigned char result[20]);
|
||||
_mesa_sha1_compute(const void *data, size_t size, unsigned char result[SHA1_DIGEST_LENGTH]);
|
||||
|
||||
void
|
||||
_mesa_sha1_print(FILE *f, const uint8_t sha1[SHA1_DIGEST_LENGTH]);
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ does_cache_contain(struct disk_cache *cache, const cache_key key)
|
|||
static bool
|
||||
cache_exists(struct disk_cache *cache)
|
||||
{
|
||||
uint8_t key[20];
|
||||
uint8_t key[SHA1_DIGEST_LENGTH];
|
||||
char data[] = "some test data";
|
||||
|
||||
if (!cache)
|
||||
|
|
@ -273,13 +273,13 @@ test_put_and_get(bool test_cache_size_limit, const char *driver_id)
|
|||
{
|
||||
struct disk_cache *cache;
|
||||
char blob[] = "This is a blob of thirty-seven bytes";
|
||||
uint8_t blob_key[20];
|
||||
uint8_t blob_key[SHA1_DIGEST_LENGTH];
|
||||
char string[] = "While this string has thirty-four";
|
||||
uint8_t string_key[20];
|
||||
uint8_t string_key[SHA1_DIGEST_LENGTH];
|
||||
char *result;
|
||||
size_t size;
|
||||
uint8_t *one_KB, *one_MB;
|
||||
uint8_t one_KB_key[20], one_MB_key[20];
|
||||
uint8_t one_KB_key[SHA1_DIGEST_LENGTH], one_MB_key[SHA1_DIGEST_LENGTH];
|
||||
int count;
|
||||
|
||||
#ifdef SHADER_CACHE_DISABLE_BY_DEFAULT
|
||||
|
|
@ -452,11 +452,11 @@ test_put_key_and_get_key(const char *driver_id)
|
|||
struct disk_cache *cache;
|
||||
bool result;
|
||||
|
||||
uint8_t key_a[20] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
|
||||
uint8_t key_b[20] = { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||
30, 33, 32, 33, 34, 35, 36, 37, 38, 39};
|
||||
uint8_t key_a_collide[20] =
|
||||
uint8_t key_a[SHA1_DIGEST_LENGTH] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
|
||||
uint8_t key_b[SHA1_DIGEST_LENGTH] = { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||
30, 33, 32, 33, 34, 35, 36, 37, 38, 39};
|
||||
uint8_t key_a_collide[SHA1_DIGEST_LENGTH] =
|
||||
{ 0, 1, 42, 43, 44, 45, 46, 47, 48, 49,
|
||||
50, 55, 52, 53, 54, 55, 56, 57, 58, 59};
|
||||
|
||||
|
|
@ -510,9 +510,9 @@ static void
|
|||
test_put_and_get_between_instances(const char *driver_id)
|
||||
{
|
||||
char blob[] = "This is a blob of thirty-seven bytes";
|
||||
uint8_t blob_key[20];
|
||||
uint8_t blob_key[SHA1_DIGEST_LENGTH];
|
||||
char string[] = "While this string has thirty-four";
|
||||
uint8_t string_key[20];
|
||||
uint8_t string_key[SHA1_DIGEST_LENGTH];
|
||||
char *result;
|
||||
size_t size;
|
||||
|
||||
|
|
@ -699,7 +699,7 @@ static void
|
|||
test_put_big_sized_entry_to_empty_cache(const char *driver_id)
|
||||
{
|
||||
static uint8_t blob[4096];
|
||||
uint8_t blob_key[20];
|
||||
uint8_t blob_key[SHA1_DIGEST_LENGTH];
|
||||
struct disk_cache *cache;
|
||||
char *result;
|
||||
size_t size;
|
||||
|
|
@ -861,9 +861,9 @@ TEST_F(Cache, Combined)
|
|||
const char *driver_id = "make_check";
|
||||
char blob[] = "This is a RO blob";
|
||||
char blob2[] = "This is a RW blob";
|
||||
uint8_t dummy_key[20] = { 0 };
|
||||
uint8_t blob_key[20];
|
||||
uint8_t blob_key2[20];
|
||||
uint8_t dummy_key[SHA1_DIGEST_LENGTH] = { 0 };
|
||||
uint8_t blob_key[SHA1_DIGEST_LENGTH];
|
||||
uint8_t blob_key2[SHA1_DIGEST_LENGTH];
|
||||
char foz_rw_idx_file[1024];
|
||||
char foz_ro_idx_file[1024];
|
||||
char foz_rw_file[1024];
|
||||
|
|
@ -1088,7 +1088,7 @@ TEST_F(Cache, List)
|
|||
{
|
||||
const char *driver_id = "make_check";
|
||||
char blob[] = "This is a RO blob";
|
||||
uint8_t blob_key[20];
|
||||
uint8_t blob_key[SHA1_DIGEST_LENGTH];
|
||||
char foz_rw_idx_file[1024];
|
||||
char foz_ro_idx_file[1024];
|
||||
char foz_rw_file[1024];
|
||||
|
|
@ -1355,7 +1355,7 @@ test_put_and_get_disabled(const char *driver_id)
|
|||
{
|
||||
struct disk_cache *cache;
|
||||
char blob[] = "This is a blob of thirty-seven bytes";
|
||||
uint8_t blob_key[20];
|
||||
uint8_t blob_key[SHA1_DIGEST_LENGTH];
|
||||
char *result;
|
||||
size_t size;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,10 +49,10 @@ TEST_P(MesaSHA1TestFixture, Match)
|
|||
{
|
||||
Params p = GetParam();
|
||||
|
||||
unsigned char sha1[20];
|
||||
unsigned char sha1[SHA1_DIGEST_LENGTH];
|
||||
_mesa_sha1_compute(p.string, strlen(p.string), sha1);
|
||||
|
||||
char buf[41];
|
||||
char buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
_mesa_sha1_format(buf, sha1);
|
||||
|
||||
ASSERT_TRUE(memcmp(buf, p.expected_sha1, SHA1_LENGTH) == 0)
|
||||
|
|
|
|||
|
|
@ -424,7 +424,7 @@ vn_device_update_shader_cache_id(struct vn_device *dev)
|
|||
/* The entry header is what contains the cache id / timestamp so we
|
||||
* need to create a fake entry.
|
||||
*/
|
||||
uint8_t key[20];
|
||||
uint8_t key[SHA1_DIGEST_LENGTH];
|
||||
char data[] = "Fake Shader";
|
||||
|
||||
disk_cache_compute_key(cache, data, sizeof(data), key);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue