Skip to content

safe_struct: Copy every pSampleMask word - #423

Merged
spencer-lunarg merged 1 commit into
KhronosGroup:mainfrom
lordalcol:sample-mask-copy
Nov 23, 2026
Merged

spencer-lunarg merged 1 commit into
KhronosGroup:mainfrom
lordalcol:sample-mask-copy

Conversation

@lordalcol

Copy link
Copy Markdown
Contributor

VkPipelineMultisampleStateCreateInfo::pSampleMask has (rasterizationSamples + 31) / 32 words, but the safe struct copies only the first one. With 64 samples the second word is lost, and the validation layers read past the copy when they compare the sample masks of pipeline libraries (VUID-VkGraphicsPipelineCreateInfo-pLibraries-06635), so that error comes and goes in the CTS pipeline_library and fast_linked_library sample_mask samples_64 cases, depending on what the heap holds.

The single-element copy comes from the fix for Vulkan-ValidationLayers#1383, when the length was read as rasterizationSamples/32, which is 0 below 32 samples. The length now comes from altlen, so this copies the whole array and adds a test with a 64-sample mask.

@CLAassistant

CLAassistant commented Oct 16, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ziga-lunarg

Copy link
Copy Markdown
Contributor

@lordalcol Can you rebase

In 2017 (VVL GH1383) the generator read the latexmath length of
pSampleMask as rasterizationSamples/32, which is 0 below 32 samples, so
the copy was empty. The fix copied a single element for every length
with a division. The length now comes from altlen as
(rasterizationSamples + 31) / 32.

pSampleMask is the only such array without custom code (pCode has its
own). A 64-sample mask loses its second word, so VVL reads past the copy
when it compares two words for pLibraries-06635 and reports the error at
random.

Copy the whole array, and put the length in parentheses since it is
multiplied by the element size.
@spencer-lunarg
spencer-lunarg merged commit 92ff93e into KhronosGroup:main Nov 23, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants