layers: NV per-viewport array count VUs - #12825
Open
Wint3rNight wants to merge 2 commits into
Open
Conversation
Collaborator
|
Author Wint3rNight not on autobuild list. Waiting for curator authorization before starting CI build. |
Collaborator
|
Author Wint3rNight not on autobuild list. Waiting for curator authorization before starting CI build. |
Four VUs require an NV per-viewport array to be at least as large as VkPipelineViewportStateCreateInfo::viewportCount. Only the viewport swizzle one (01215) was implemented that way. - 01726 (VkPipelineViewportWScalingStateCreateInfoNV) required equality - 02029 (VkPipelineViewportExclusiveScissorStateCreateInfoNV) required equality - 02056 (VkPipelineViewportShadingRateImageStateCreateInfoNV) was inverted and reported an error when the array was larger, so it also missed the case where the array is too small All three rejected valid pipelines. Existing tests asserted the old behaviour, so they are updated, and a negative test is added for the 02029 case that is a real violation.
When VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT is used, the viewport count is only known at draw time, so the pipeline's static NV per-viewport arrays have to be checked against it. The dynamic side of each of these was already validated, the static side was not. - 04137 VkPipelineViewportWScalingStateCreateInfoNV - 04139 VkPipelineViewportShadingRateImageStateCreateInfoNV - 07492 VkPipelineViewportSwizzleStateCreateInfoNV - 04142 VkPipelineViewportExclusiveScissorStateCreateInfoNV Setting more viewports than the array holds means the implementation indexes past the end of it. 04141 is left alone, it looks like a duplicate of 07492 from before the swizzle state could be dynamic.
Wint3rNight
force-pushed
the
nv-viewport-count-vus
branch
from
August 8, 2026 03:02
c16e246 to
483eb82
Compare
Collaborator
|
Author Wint3rNight not on autobuild list. Waiting for curator authorization before starting CI build. |
Collaborator
|
CI Vulkan-ValidationLayers build queued with queue ID 71319. |
Collaborator
|
CI Vulkan-ValidationLayers build # 24074 running. |
Collaborator
|
CI Vulkan-ValidationLayers build # 24074 passed. |
Contributor
|
@Wint3rNight I was on PTO all of last week and catching up on things, will give this a review by end of the week. It "seems" good, but dynamic state stuff has many sharp edges and I need to read up on these vendor extensions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four VUs require an NV per-viewport array to be at least as large as the
viewport count. Only the viewport swizzle one was implemented that way, so this
started as adding the missing draw time checks and turned up three bugs in the
pipeline creation ones along the way.
Fixing the pipeline creation VUs
nv >= viewportCountnv < viewportCount— correctnv >= viewportCountnv != viewportCountnv == 0 || nv >= viewportCountnv != 0 && nv != viewportCountnv >= viewportCountnv > viewportCountAll three rejected valid pipelines. 02056 is the worst of them: it was inverted,
so it also never caught the case the VU actually describes.
Three existing tests asserted the old behaviour and are updated. Since that
removed the only coverage of a real 02029 violation, a negative test is added
for it.
Adding the draw time VUs
With
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNTthe viewport count is only known atdraw time, so the pipeline's static NV arrays have to be checked against it. The
dynamic side of each of these was already validated, the static side was not.
VUID-vkCmdDraw-viewportCount-04137—VkPipelineViewportWScalingStateCreateInfoNVVUID-vkCmdDraw-viewportCount-04139—VkPipelineViewportShadingRateImageStateCreateInfoNVVUID-vkCmdDraw-viewportCount-07492—VkPipelineViewportSwizzleStateCreateInfoNVVUID-vkCmdDraw-VkPipelineVieportCreateInfo-04142—VkPipelineViewportExclusiveScissorStateCreateInfoNVSetting more viewports than the array holds means the implementation indexes
past the end of it, and nothing else reports that.
vk_validation_statsgoes from 3520 to 3416 unimplemented, which is these fouracross the 26 action commands, with nothing newly uncovered.
Question on 04141
I left
VUID-vkCmdDraw-VkPipelineVieportCreateInfo-04141unimplemented. Itcompares against the same
VkPipelineViewportSwizzleStateCreateInfoNV::viewportCountas 07492 and only differs in how the condition is worded, so it looks like the
older form from before the swizzle state could be dynamic. Happy to emit it
alongside 07492, or add it to
unimplementable_validation.hnext to the otherredundant VUID variants, whichever you prefer.
Testing
the new 02029 negative test
sl_pipeline.cppfails all 3 positive tests, revertingcc_cmd_buffer_dynamic.cppfails all 4 negative testsNegativeDynamicState,PositiveDynamicState,NegativePipeline,PositivePipeline,NegativeCommand,NegativeFragmentShadingRate,NegativeShaderObject,PositiveShaderObjectand
NegativeViewportInheritance, with no failurescheck_code_format.pypasses, clang-format 22.1.8Two things I could not check locally. The full suite does not finish here, it
crashes in
PositiveDescriptorHeapUntyped.BufferAsFunctionParameter, and itdoes that on an unmodified checkout too, so it is unrelated to this change but
it does mean I ran the suites above rather than everything.
NegativeFragmentShadingRate.ShadingRateImageNValso skips on my device, thoughShadingRateImageNVViewportCount, which is the one this changes, does run.