Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could validate stageFlags for INPUT_ATTACHMENT? #54

Closed
karl-lunarg opened this issue May 14, 2018 · 6 comments
Closed

Could validate stageFlags for INPUT_ATTACHMENT? #54

karl-lunarg opened this issue May 14, 2018 · 6 comments
Labels
Incomplete Missing Validation VUs to be added
Milestone

Comments

@karl-lunarg
Copy link
Contributor

Issue by toten (MIGRATED)
Friday Nov 03, 2017 at 07:03 GMT
Originally opened as KhronosGroup/Vulkan-LoaderAndValidationLayers#2178


My case is:

When creating VkDescriptorSetLayoutBinding structure, the descriptorType is VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT; from the spec, the stageFlags must be VK_SHADER_STAGE_FRAGMENT_BIT. However I forgot setting the stageFlags (partially due to the code is originally copied from others), so the input_attachment reading in fragment shader returns black. It took me one or two hours to finally figure out where the problem is.

Just curious if the core-validation layer or parameter-validation layer could check this, and help to locate the problem quickly.

Thanks a lot.

@karl-lunarg karl-lunarg added this to the P1 milestone May 14, 2018
@karl-lunarg
Copy link
Contributor Author

Comment by tobine (MIGRATED)
Friday Nov 03, 2017 at 17:31 GMT


This is missing check VALIDATION_ERROR_04e00bcc.

@toten note from spec that stageFlags can be 0 or *FRAGMENT_BIT:

If descriptorType is VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT and descriptorCount is not 0, then stageFlags must be 0 or VK_SHADER_STAGE_FRAGMENT_BIT

Not sure what your stageFlags was, but if it was 0, the new validation check won't catch that case.

@karl-lunarg
Copy link
Contributor Author

Comment by chrisforbes (MIGRATED)
Thursday Nov 09, 2017 at 22:03 GMT


@tobine can we justify emitting a warning for stageFlags=0? We already have the option of descriptorCount=0 for making unusable placeholder bindings.

@karl-lunarg
Copy link
Contributor Author

Comment by tobine (MIGRATED)
Friday Nov 10, 2017 at 16:37 GMT


Well, if @toten had stageFlags=0, then I'd say the fact that the warning would have been a help in that case justifies it. At least until/unless someone else complains about the warning with a reasonable use case that requires stageFlags=0. I can't think of a good case offhand as the descriptorCount=0 option is already there as you said for unusable bindings.
@toten please confirm if your stageFlags was 0 and we can put in a warning for that case to assist other users in the future.

@karl-lunarg
Copy link
Contributor Author

Comment by toten (MIGRATED)
Monday Nov 13, 2017 at 02:20 GMT


I used the api-dump layer (also debug) and could confirm the stageFlags was 0. The input-attachment loading returns black color when stageFlags was 0.

When I explicitly set to VK_SHADER_STAGE_FRAGMENT_BIT, input-attachment loading works as expected. BTW, the api-dump layer returns:
stageFlags: VkShaderStageFlags = 16 (VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_ALL_GRAPHICS | VK_SHADER_STAGE_ALL)
It looks a little strange that | VK_SHADER_STAGE_ALL_GRAPHICS | VK_SHADER_STAGE_ALL ??

Thanks all the help!

@mark-lunarg mark-lunarg self-assigned this May 14, 2018
@KarenGhavam-lunarG KarenGhavam-lunarG added Incomplete Missing Validation VUs to be added and removed incomplete labels Sep 3, 2018
@jzulauf-lunarg
Copy link
Contributor

Triage notes: This can't be done at bindtime, but could be added to the validation of the subpass attachments at CmdBeginRenderPass time.

@mark-lunarg
Copy link
Contributor

Moving this warning issue to best practices tracking issue, #24.

@shannon-lunarg shannon-lunarg modified the milestones: P1, sdk-1.2.135.0 Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Incomplete Missing Validation VUs to be added
Projects
None yet
Development

No branches or pull requests

5 participants