venus: subtract appended header size in vn_CreatePipelineCache

Use header->header_size to offset cache data as well in case the header
struct extends on a newer driver but the cache data was appended with
an old header.

Fixes: 723f0bf74a ("venus: initial support for module and pipelines")

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14463>
This commit is contained in:
Yiwei Zhang 2022-01-07 18:41:43 +00:00 committed by Marge Bot
parent 3792fbfcf6
commit 48712b8cc5
1 changed files with 5 additions and 2 deletions

View File

@ -140,9 +140,12 @@ vn_CreatePipelineCache(VkDevice device,
VkPipelineCacheCreateInfo local_create_info;
if (pCreateInfo->initialDataSize) {
const struct vk_pipeline_cache_header *header =
pCreateInfo->pInitialData;
local_create_info = *pCreateInfo;
local_create_info.pInitialData +=
sizeof(struct vk_pipeline_cache_header);
local_create_info.initialDataSize -= header->header_size;
local_create_info.pInitialData += header->header_size;
pCreateInfo = &local_create_info;
}