About Social Code
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2025-07-29 10:29:45 +0300
committerMarge Bot <marge-bot@fdo.invalid>2025-11-06 15:27:19 +0000
commitfc6d17a2900ec8bed96748cbe6da9188f94b44b4 (patch)
treeabd576438b98d5bc8f07f7709d865eaa226add9f
parentf56e118ecdb926c85282d90b178c60d220539ea4 (diff)
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> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36647>
-rw-r--r--src/vulkan/runtime/vk_pipeline.c26
-rw-r--r--src/vulkan/runtime/vk_pipeline.h5
2 files changed, 15 insertions, 16 deletions
diff --git a/src/vulkan/runtime/vk_pipeline.c b/src/vulkan/runtime/vk_pipeline.c
index 993dee1581a..ecf35ec82e0 100644
--- a/src/vulkan/runtime/vk_pipeline.c
+++ b/src/vulkan/runtime/vk_pipeline.c
@@ -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,
diff --git a/src/vulkan/runtime/vk_pipeline.h b/src/vulkan/runtime/vk_pipeline.h
index ef917bdf442..b0405368efc 100644
--- a/src/vulkan/runtime/vk_pipeline.h
+++ b/src/vulkan/runtime/vk_pipeline.h
@@ -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
*