Repository navigation
Conversation
fixup_device_id_vulkan() passes the ids through struct pci_id so the existing fixup can match them, but then copies the struct back unconditionally. The wider Vulkan value is narrowed to 16 bits on the way in, which is harmless while it is only used for matching, and becomes a silent identity change once it is published again. On hardware whose Vulkan IDs don't fit in 16 bits this rewrites the reported identity, e.g. Qualcomm's 0x43050a01 becomes 0x00000a01. Vulkan expects the application to validate cached pipeline data against the device: VkPipelineCacheHeaderVersionOne stores the vendor ID, device ID and pipelineCacheUUID of the device that produced it, and data whose header does not match is meant to be discarded. With the reported IDs altered, such an application discards its cache and recompiles every pipeline on each run. This was observed with Unity - a 2021.3.34f1 reference build and a shipping 2021.3.34f5 title both compare all four header fields and log "Vulkan PSO: Invalid vulkan pipeline cache header, skipping save to disk" - but the check follows directly from the header layout and is not specific to that engine. The WINE_HIDE_*_GPU options only deal with 16-bit PCI identities, so the narrowing is lossless wherever they can apply; writing the values back only when the fixup matched confines it to those cases. Signed-off-by: sodo <djdisodo@gmail.com>
|
there are more things that might break shader caching A. Legacy properties path skips the override — fix
physical_device->instance->p_vkGetPhysicalDeviceProperties( ..., properties );
fixup_device_id_vulkan( &properties->vendorID, &properties->deviceID );
return;B. UUID/LUID structures
C. Pipeline cache headerThe header carries the driver's real ids and UUID; the properties report the masked ones, Coherent masking needs rewrite-on-read and restore-on-write — the driver validates with the override active, caches cannot be reused. |
fixup_device_id_vulkan() passes the ids through struct pci_id so the existing fixup can match them, but then copies the struct back unconditionally. The wider Vulkan value is narrowed to 16 bits on the way in, which is harmless while it is only used for matching, and becomes a silent identity change once it is published again.
On hardware whose Vulkan IDs don't fit in 16 bits this rewrites the reported identity, e.g. Qualcomm's 0x43050a01 becomes 0x00000a01.
Vulkan expects the application to validate cached pipeline data against the device: VkPipelineCacheHeaderVersionOne stores the vendor ID, device ID and pipelineCacheUUID of the device that produced it, and data whose header does not match is meant to be discarded. With the reported IDs altered, such an application discards its cache and recompiles every pipeline on each run.
This was observed with Unity - a 2021.3.34f1 reference build and a shipping 2021.3.34f5 title both compare all four header fields and log "Vulkan PSO: Invalid vulkan pipeline cache header, skipping save to disk" - but the check follows directly from the header layout and is not specific to that engine.
The WINE_HIDE_*_GPU options only deal with 16-bit PCI identities, so the narrowing is lossless wherever they can apply; writing the values back only when the fixup matched confines it to those cases.