summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2017-01-24 21:21:09 +0000
committerEmil Velikov <[email protected]>2017-03-15 11:18:43 +0000
commita9a4028fd7136ee2ee7bf0efa8179e7a6312f008 (patch)
tree453980dcab1abb0de018129f4b6a5fd6de8f8218 /src/amd/vulkan
parentc96127e873584e6ea3808d5cdb661d2135de1ff2 (diff)
util/sha1: rework _mesa_sha1_{init,final}
Rather than having an extra memory allocation [that we currently do not and act accordingly] just make the API take an pointer to a stack allocated instance. This and follow-up steps will effectively make the _mesa_sha1_foo simple define/inlines around their SHA1 counterparts. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Grazvydas Ignotas <[email protected]>
Diffstat (limited to 'src/amd/vulkan')
-rw-r--r--src/amd/vulkan/radv_descriptor_set.c10
-rw-r--r--src/amd/vulkan/radv_pipeline_cache.c20
2 files changed, 15 insertions, 15 deletions
diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c
index 7dade3eeed3..9afc025d84d 100644
--- a/src/amd/vulkan/radv_descriptor_set.c
+++ b/src/amd/vulkan/radv_descriptor_set.c
@@ -187,7 +187,7 @@ VkResult radv_CreatePipelineLayout(
{
RADV_FROM_HANDLE(radv_device, device, _device);
struct radv_pipeline_layout *layout;
- struct mesa_sha1 *ctx;
+ struct mesa_sha1 ctx;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO);
@@ -201,7 +201,7 @@ VkResult radv_CreatePipelineLayout(
unsigned dynamic_offset_count = 0;
- ctx = _mesa_sha1_init();
+ _mesa_sha1_init(&ctx);
for (uint32_t set = 0; set < pCreateInfo->setLayoutCount; set++) {
RADV_FROM_HANDLE(radv_descriptor_set_layout, set_layout,
pCreateInfo->pSetLayouts[set]);
@@ -211,7 +211,7 @@ VkResult radv_CreatePipelineLayout(
for (uint32_t b = 0; b < set_layout->binding_count; b++) {
dynamic_offset_count += set_layout->binding[b].array_size * set_layout->binding[b].dynamic_offset_count;
}
- _mesa_sha1_update(ctx, set_layout->binding,
+ _mesa_sha1_update(&ctx, set_layout->binding,
sizeof(set_layout->binding[0]) * set_layout->binding_count);
}
@@ -224,9 +224,9 @@ VkResult radv_CreatePipelineLayout(
}
layout->push_constant_size = align(layout->push_constant_size, 16);
- _mesa_sha1_update(ctx, &layout->push_constant_size,
+ _mesa_sha1_update(&ctx, &layout->push_constant_size,
sizeof(layout->push_constant_size));
- _mesa_sha1_final(ctx, layout->sha1);
+ _mesa_sha1_final(&ctx, layout->sha1);
*pPipelineLayout = radv_pipeline_layout_to_handle(layout);
return VK_SUCCESS;
diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c
index 30f2dc16d3f..83bf3cb6af4 100644
--- a/src/amd/vulkan/radv_pipeline_cache.c
+++ b/src/amd/vulkan/radv_pipeline_cache.c
@@ -91,22 +91,22 @@ radv_hash_shader(unsigned char *hash, struct radv_shader_module *module,
const union ac_shader_variant_key *key,
uint32_t is_geom_copy_shader)
{
- struct mesa_sha1 *ctx;
+ struct mesa_sha1 ctx;
- ctx = _mesa_sha1_init();
+ _mesa_sha1_init(&ctx);
if (key)
- _mesa_sha1_update(ctx, key, sizeof(*key));
- _mesa_sha1_update(ctx, module->sha1, sizeof(module->sha1));
- _mesa_sha1_update(ctx, entrypoint, strlen(entrypoint));
+ _mesa_sha1_update(&ctx, key, sizeof(*key));
+ _mesa_sha1_update(&ctx, module->sha1, sizeof(module->sha1));
+ _mesa_sha1_update(&ctx, entrypoint, strlen(entrypoint));
if (layout)
- _mesa_sha1_update(ctx, layout->sha1, sizeof(layout->sha1));
+ _mesa_sha1_update(&ctx, layout->sha1, sizeof(layout->sha1));
if (spec_info) {
- _mesa_sha1_update(ctx, spec_info->pMapEntries,
+ _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_update(&ctx, spec_info->pData, spec_info->dataSize);
}
- _mesa_sha1_update(ctx, &is_geom_copy_shader, 4);
- _mesa_sha1_final(ctx, hash);
+ _mesa_sha1_update(&ctx, &is_geom_copy_shader, 4);
+ _mesa_sha1_final(&ctx, hash);
}