-
Notifications
You must be signed in to change notification settings - Fork 425
Missing image layout validation on draw #551
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
Comments
@ShabbyX -- is there a test case you can share? This case should be covered by the existing code, and it would be good to discover and resolve any latent bugs in the image layout transition and validation code. BackgroundImage layout validation is done in multiple places throughout the core_validation layer. When it is possible to know the layout at command buffer record time (for example if an image layout transition was done earlier in that command buffer), the current image layout is compared against the binding/usage in copy, dispatch, and draw calls. Where the image layout state cannot be determined that check is deferred until queue submission of the command buffer, when the required state of the image layout from the point of view of the command buffer is compared to the current/global state of the image layout. |
@jzulauf-lunarg I don't have a simple test case, but this is on ANGLE, so you can give it a try. Give me a day or two to land the change that's affected by this, then I can provide you a patch that disables the layout transition I'm talking about + instructions on how to build and what to run (and therefore trace). |
Sorry for the late reply. Here's the patch to ANGLE that can repro the issue: https://chromium-review.googlesource.com/c/angle/angle/+/1401020 To perform the test, follow these (untried) instructions:
Observe that the test output tells that the image is in the wrong layout. That error is generated (part of the repro patch) when using an image for shader read, but the layout is neither This indeed caused failures on some tests on AMD where the image was written to as color attachment, then read from in a shader. The validation layers don't complain about this missing transition/barrier. |
triage notes: currently the descriptor set validation at draw doesn't have the information needed to do this check (it currently isn't extracted with the other spirv static analysis). Needs to be added to the shader_validation path and probably can be plumbed through with an additional descriptor_req bit. |
"Upon further review" -- it looks like the best way to catch this is by implementing VUID-VkWriteDescriptorSet-descriptorType-01403 and allow the existing checks for descriptor layout and image layout to catch any draw time discrepancy. However ...1403 looks to be out of date, which I'm addressing separately. |
* Update release number to 99. Public Issues: * Add missing pname:pMemoryHostPointerProperties description to flink:vkGetMemoryHostPointerPropertiesEXT.txt (public pull request 896). * Minor markup fixes (public pull request 900). * Minor update to `khronos.css` and markup fixes (originally proposed in public pull request 901, but done via an internal MR). Internal Issues: * Document restrictions on image queries for Y'CbCr formats in the <<features-formats-requiring-sampler-ycbcr-conversion>> table as well as for slink:sname:VkImageFormatProperties and slink:VkImageCreateInfo (internal issue 1361). * Correct type of the code:FragSizeEXT built-in in the <<interfaces-builtin-variables, Built-In Variables>> section (internal issue 1526). * Clean up math in the <<textures, Image Operations>> chapter by refactoring, using better naming conventions, updating diagrams to use the correct orientation, etc. (internal merge request 2968). * Fix minor typos for slink:VkImageCreateInfo and slink:VkImageStencilUsageCreateInfoEXT. * Add missing documentation for tlink:VkResolveModeFlagsKHR. * Fix extension dependency of pname:scalarBlockLayout in the <<features-features-requirements, Feature Requirements>> section. * Fix indexing math for shader binding table calculations in the <<shader-binding-table-indexing-rules, Indexing Rules>> section, and use spelling "`any-hit`" consistently. * Reconcile valid usage statement and text for sampled image layouts in slink:VkWriteDescriptorSet (KhronosGroup/Vulkan-ValidationLayers#551). * Make SPIR-V code:OpConvertUToPtr and code:OpConvertPtrToU operations require a 64-bit integer for physical storage buffer pointers in the <<spirvenv-module-validation, Validation Rules within a Module>> section. * Update to KaTeX 10.0. New Extensions: * `VK_EXT_filter_cubic` * `VK_NV_dedicated_allocation_image_aliasing`
I came across a bug recently where an image was not transitioned to the right layout, and the validation layers didn't catch this. In short, the application does the following:
The bug was that step 5 was missing, i.e. image 1 was in COLOR_ATTACHMENT_OPTIMAL but was being read by a fragment shader. In effect, the color cache was not flushed and the changes in step 3 were not visible to step 6.
It looks like the validation layers don't validate the image layouts on draw call. As a test, I change step 5 to transition to TRANSFER_SRC_OPTIMAL with no complaint from the layers either.
This page indicates the image layouts are validated only in the following functions (though the page is dated):
Is there a reason why they are not validated on draw/dispatch calls too?
The text was updated successfully, but these errors were encountered: