diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c index 1ec34eb127d..e93ebdafadb 100644 --- a/src/amd/common/ac_gpu_info.c +++ b/src/amd/common/ac_gpu_info.c @@ -236,6 +236,8 @@ static bool handle_env_var_force_family(struct radeon_info *info) void ac_fill_compiler_info(struct radeon_info *info, const struct drm_amdgpu_info_device *device_info) { + /* We use ac_compiler_info for shader cache keys, so make sure there is no padding. */ + STATIC_ASSERT(sizeof(enum amd_gfx_level) == 4); STATIC_ASSERT(sizeof(struct ac_compiler_info) == 56); struct ac_compiler_info *out = &info->compiler_info; diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 826b505e949..a284f4f6275 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -864,6 +864,8 @@ capture_trace(VkQueue _queue) static void radv_device_init_cache_key(struct radv_device *device) { + STATIC_ASSERT(sizeof(struct radv_device_cache_key) == 4); + const struct radv_physical_device *pdev = radv_device_physical(device); struct radv_device_cache_key *key = &device->cache_key; struct mesa_blake3 ctx; diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index b9d8bbd9b32..5e4222c0ff1 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -291,6 +291,9 @@ parse_hex(char *out, const char *in, unsigned length) static void radv_physical_device_init_cache_key(struct radv_physical_device *pdev) { + STATIC_ASSERT(sizeof(enum radeon_family) == 4); + STATIC_ASSERT(sizeof(struct radv_physical_device_cache_key) == 12); + const struct radv_instance *instance = radv_physical_device_instance(pdev); struct radv_physical_device_cache_key *key = &pdev->cache_key;