Skip to content

v3dv: check correct format when storing on a depth/stencil format

When we create a image view with D24S8 format we made a reformatting to RGBA8UI if the aspect selected is just STENCIL. But when configuring the stores we select the aspects based on the attachment format. Quoting from cmd_buffer_render_pass_emit_stores:

  /* From the Vulkan spec, VkImageSubresourceRange:
   *
   *   "When an image view of a depth/stencil image is used as a
   *   depth/stencil framebuffer attachment, the aspectMask is ignored
   *   and both depth and stencil image subresources are used."
   *
   * So we ignore the aspects from the subresource range of the image
   * view for the depth/stencil attachment, but we still need to restrict
   * the to aspects compatible with the render pass and the image.
   */
  const VkImageAspectFlags aspects =
     vk_format_aspects(ds_attachment->desc.format);

So we could ending trying to store on a Z+Stencil buffer, using a RGBA8UI format.

So far this only affected some tests when using the simulator (assert). Those were working on the real hw, but probably would fail on other situations, so lets use the original image format on that case.

Merge request reports