anv: Move shader hashing to anv_pipeline
Shader hashing is very closely related to shader compilation. Putting them right next to each other in anv_pipeline makes it easier to verify that we're actually hashing everything we need to be hashing. The only real change (other than the order of hashing) is that we now hash in the shader stage. Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "util/mesa-sha1.h"
|
||||
#include "util/hash_table.h"
|
||||
#include "util/debug.h"
|
||||
#include "anv_private.h"
|
||||
@@ -198,32 +197,6 @@ anv_pipeline_cache_finish(struct anv_pipeline_cache *cache)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
anv_hash_shader(unsigned char *hash, const void *key, size_t key_size,
|
||||
struct anv_shader_module *module,
|
||||
const char *entrypoint,
|
||||
const struct anv_pipeline_layout *pipeline_layout,
|
||||
const VkSpecializationInfo *spec_info)
|
||||
{
|
||||
struct mesa_sha1 ctx;
|
||||
|
||||
_mesa_sha1_init(&ctx);
|
||||
_mesa_sha1_update(&ctx, key, key_size);
|
||||
_mesa_sha1_update(&ctx, module->sha1, sizeof(module->sha1));
|
||||
_mesa_sha1_update(&ctx, entrypoint, strlen(entrypoint));
|
||||
if (pipeline_layout) {
|
||||
_mesa_sha1_update(&ctx, pipeline_layout->sha1,
|
||||
sizeof(pipeline_layout->sha1));
|
||||
}
|
||||
/* hash in shader stage, pipeline layout? */
|
||||
if (spec_info) {
|
||||
_mesa_sha1_update(&ctx, spec_info->pMapEntries,
|
||||
spec_info->mapEntryCount * sizeof spec_info->pMapEntries[0]);
|
||||
_mesa_sha1_update(&ctx, spec_info->pData, spec_info->dataSize);
|
||||
}
|
||||
_mesa_sha1_final(&ctx, hash);
|
||||
}
|
||||
|
||||
static struct anv_shader_bin *
|
||||
anv_pipeline_cache_search_locked(struct anv_pipeline_cache *cache,
|
||||
const void *key_data, uint32_t key_size)
|
||||
|
Reference in New Issue
Block a user