Mesa (main): radv: Use vk_pipeline_hash_shader_stage()
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 28 09:37:16 UTC 2022
Module: Mesa
Branch: main
Commit: 6a491d16284ca7387eb47e41f53eccba2c14a760
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a491d16284ca7387eb47e41f53eccba2c14a760
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Wed Jun 22 19:02:44 2022 +0200
radv: Use vk_pipeline_hash_shader_stage()
Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17186>
---
src/amd/vulkan/radv_pipeline.c | 34 ++++------------------------------
1 file changed, 4 insertions(+), 30 deletions(-)
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index a5fe0cc3ebb..36dce343fd5 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -38,6 +38,7 @@
#include "radv_private.h"
#include "radv_shader.h"
#include "radv_shader_args.h"
+#include "vk_pipeline.h"
#include "vk_util.h"
#include "util/debug.h"
@@ -4477,25 +4478,6 @@ radv_lower_fs_output(nir_shader *nir, const struct radv_pipeline_key *pipeline_k
return progress;
}
-static void
-radv_pipeline_hash_shader(const unsigned char *spirv_sha1, const uint32_t spirv_sha1_size,
- const char *entrypoint, gl_shader_stage stage,
- const VkSpecializationInfo *spec_info, unsigned char *sha1_out)
-{
- struct mesa_sha1 ctx;
- _mesa_sha1_init(&ctx);
-
- _mesa_sha1_update(&ctx, spirv_sha1, spirv_sha1_size);
- _mesa_sha1_update(&ctx, entrypoint, strlen(entrypoint));
- if (spec_info) {
- _mesa_sha1_update(&ctx, spec_info->pMapEntries,
- spec_info->mapEntryCount * sizeof(*spec_info->pMapEntries));
- _mesa_sha1_update(&ctx, spec_info->pData, spec_info->dataSize);
- }
-
- _mesa_sha1_final(&ctx, sha1_out);
-}
-
void
radv_pipeline_stage_init(const VkPipelineShaderStageCreateInfo *sinfo,
struct radv_pipeline_stage *out_stage, gl_shader_stage stage)
@@ -4515,28 +4497,20 @@ radv_pipeline_stage_init(const VkPipelineShaderStageCreateInfo *sinfo,
if (sinfo->module != VK_NULL_HANDLE) {
struct vk_shader_module *module = vk_shader_module_from_handle(sinfo->module);
+ STATIC_ASSERT(sizeof(out_stage->spirv.sha1) == sizeof(module->sha1));
out_stage->spirv.data = module->data;
out_stage->spirv.size = module->size;
out_stage->spirv.object = &module->base;
- if (module->nir) {
+ if (module->nir)
out_stage->internal_nir = module->nir;
- _mesa_sha1_compute(module->nir->info.name, strlen(module->nir->info.name),
- out_stage->spirv.sha1);
- } else {
- assert(sizeof(out_stage->spirv.sha1) == sizeof(module->sha1));
- memcpy(out_stage->spirv.sha1, module->sha1, sizeof(out_stage->spirv.sha1));
- }
} else {
out_stage->spirv.data = (const char *) minfo->pCode;
out_stage->spirv.size = minfo->codeSize;
- _mesa_sha1_compute(out_stage->spirv.data, out_stage->spirv.size, out_stage->spirv.sha1);
}
- radv_pipeline_hash_shader(out_stage->spirv.sha1, sizeof(out_stage->spirv.sha1),
- out_stage->entrypoint, stage, out_stage->spec_info,
- out_stage->shader_sha1);
+ vk_pipeline_hash_shader_stage(sinfo, out_stage->shader_sha1);
}
static struct radv_shader *
More information about the mesa-commit
mailing list