dzn: Always align cached pipeline header size to input element align
authorJesse Natalie <jenatali@microsoft.com>
Tue, 10 Jan 2023 00:44:02 +0000 (16:44 -0800)
committerMarge Bot <emma+marge@anholt.net>
Tue, 17 Jan 2023 20:17:42 +0000 (20:17 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20617>

src/microsoft/vulkan/dzn_pipeline.c

index 74d276d..e3f3190 100644 (file)
@@ -562,12 +562,11 @@ dzn_pipeline_cache_lookup_gfx_pipeline(struct dzn_graphics_pipeline *pipeline,
 
    const struct dzn_cached_gfx_pipeline_header *info =
       (const struct dzn_cached_gfx_pipeline_header *)(cached_blob->data);
-   size_t offset = sizeof(*info);
+   size_t offset = ALIGN_POT(sizeof(*info), alignof(D3D12_INPUT_ELEMENT_DESC));
 
    assert(cached_blob->size >= sizeof(*info));
 
    if (info->input_count > 0) {
-      offset = ALIGN_POT(offset, alignof(D3D12_INPUT_LAYOUT_DESC));
       const D3D12_INPUT_ELEMENT_DESC *inputs =
          (const D3D12_INPUT_ELEMENT_DESC *)((uint8_t *)cached_blob->data + offset);