vulkan/runtime: simplify robustness state hashing

We're doing the same in vk_pipeline_precomp_shader_create().

Also fixes valgrind warning due to uninitialized fields

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
(cherry picked from commit fc6d17a290)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38432>
This commit is contained in:
Lionel Landwerlin 2025-07-29 10:29:45 +03:00 committed by Dylan Baker
parent b17381dc8d
commit 8a813632c3
3 changed files with 16 additions and 17 deletions

View file

@ -624,7 +624,7 @@
"description": "vulkan/runtime: simplify robustness state hashing",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -267,16 +267,8 @@ vk_pipeline_hash_shader_stage(VkPipelineCreateFlags2KHR pipeline_flags,
_mesa_sha1_update(&ctx, iinfo->pIdentifier, iinfo->identifierSize);
}
if (rstate) {
_mesa_sha1_update(&ctx, &rstate->storage_buffers, sizeof(rstate->storage_buffers));
_mesa_sha1_update(&ctx, &rstate->uniform_buffers, sizeof(rstate->uniform_buffers));
_mesa_sha1_update(&ctx, &rstate->vertex_inputs, sizeof(rstate->vertex_inputs));
_mesa_sha1_update(&ctx, &rstate->images, sizeof(rstate->images));
_mesa_sha1_update(&ctx, &rstate->null_uniform_buffer_descriptor,
sizeof(rstate->null_uniform_buffer_descriptor));
_mesa_sha1_update(&ctx, &rstate->null_storage_buffer_descriptor,
sizeof(rstate->null_storage_buffer_descriptor));
}
if (rstate)
_mesa_sha1_update(&ctx, rstate, sizeof(*rstate));
_mesa_sha1_update(&ctx, info->pName, strlen(info->pName));
@ -324,12 +316,14 @@ vk_pipeline_robustness_state_fill(const struct vk_device *device,
const void *pipeline_pNext,
const void *shader_stage_pNext)
{
rs->uniform_buffers = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DEVICE_DEFAULT_EXT;
rs->storage_buffers = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DEVICE_DEFAULT_EXT;
rs->vertex_inputs = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DEVICE_DEFAULT_EXT;
rs->images = VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_DEVICE_DEFAULT_EXT;
rs->null_uniform_buffer_descriptor = device->enabled_features.nullDescriptor;
rs->null_storage_buffer_descriptor = device->enabled_features.nullDescriptor;
*rs = (struct vk_pipeline_robustness_state) {
.uniform_buffers = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DEVICE_DEFAULT_EXT,
.storage_buffers = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DEVICE_DEFAULT_EXT,
.vertex_inputs = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DEVICE_DEFAULT_EXT,
.images = VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_DEVICE_DEFAULT_EXT,
.null_uniform_buffer_descriptor = device->enabled_features.nullDescriptor,
.null_storage_buffer_descriptor = device->enabled_features.nullDescriptor,
};
const VkPipelineRobustnessCreateInfoEXT *shader_info =
vk_find_struct_const(shader_stage_pNext,

View file

@ -64,6 +64,9 @@ vk_set_subgroup_size(struct vk_device *device,
bool allow_varying,
bool require_full);
/* This struct needs to be hashable mem-comparable */
PRAGMA_DIAGNOSTIC_PUSH
PRAGMA_DIAGNOSTIC_ERROR(-Wpadded)
struct vk_pipeline_robustness_state {
VkPipelineRobustnessBufferBehaviorEXT storage_buffers;
VkPipelineRobustnessBufferBehaviorEXT uniform_buffers;
@ -71,7 +74,9 @@ struct vk_pipeline_robustness_state {
VkPipelineRobustnessImageBehaviorEXT images;
bool null_uniform_buffer_descriptor;
bool null_storage_buffer_descriptor;
bool _pad[2];
};
PRAGMA_DIAGNOSTIC_POP
/** Hash VkPipelineShaderStageCreateInfo info
*