7.2. Render Pass Compatibility

Framebuffers and graphics pipelines are created based on a specific
render pass object. They must only be used with that render pass object, or
one compatible with it.

Two attachment references are compatible if they have matching format and
sample count, or are both VK_ATTACHMENT_UNUSED or the pointer that
would contain the reference is NULL.

Two arrays of attachment references are compatible if all corresponding
pairs of attachments are compatible. If the arrays are of different lengths,
attachment references not present in the smaller array are treated as
VK_ATTACHMENT_UNUSED.

Two render passes that contain only a single subpass are compatible if
their corresponding color, input, resolve, and depth/stencil attachment
references are compatible.

If two render passes contain more than one subpass, they are compatible if
they are identical except for:

Initial and final image layout in attachment descriptions

Load and store operations in attachment descriptions

Image layout in attachment references

A framebuffer is compatible with a render pass if it was created using the
same render pass or a compatible render pass.