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

Fix resolving DS with different formats #3389

Merged
merged 3 commits into from
May 3, 2023

Conversation

K0bin
Copy link
Collaborator

@K0bin K0bin commented May 3, 2023

Fixes #3386

This fixes 3 different validation errors in that game.

Resolves

Resolves hit the new temp image code path which didn't account for depth stencil (or passing VK_FORMAT_UNDEFINED as the resolve format) at all. So we ended up creating an image with VK_FORMAT_UNDEFINED and there were a ton of usage and image aspect errors.

It uses the new code path because the check for view compatibility fails because that check doesn't account for VK_FORMAT_UNDEFINED. resolveImageFbDirect will just get the formats off the srcImage & dstImage if it receives VK_FORMAT_UNDEFINED, so the format will automatically be compatible.

0 sized clears

Fairly self explainatory.

Image layout error with feedback loops

err: Validation Error: [ VUID-VkImageMemoryBarrier2-oldLayout-01197 ] Object 0: handle = 0x2100ef03060, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x2c8c6e7d | vkCmdPipelineBarrier2(): .pImageMemoryBarriers[0] VkImage 0xfd2cdd000000045a[] cannot transition the layout of aspect=1 level=0 layer=0 from VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL when the previous known layout is VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT. The Vulkan spec states: If srcQueueFamilyIndex and dstQueueFamilyIndex define a queue family ownership transfer or oldLayout and newLayout define an image layout transition, oldLayout must be VK_IMAGE_LAYOUT_UNDEFINED or the current layout of the image subresources affected by the barrier (https://vulkan.lunarg.com/doc/view/1.3.239.0/windows/1.3-extensions/vkspec.html#VUID-VkImageMemoryBarrier2-oldLayout-01197)

This was caused by the following events:

  • call changeImageLayout to change to a feedback loop layout
  • this calls spillRenderPass(true)
  • this checks whether there's a render pass bound. There isn't. In that case it checks whether there's a suspended render pass end, which is the case, and ends that with transitionRenderTargetLayouts()
  • this then stores the layout of the images currently bound as RTs: m_rtLayouts.color[i] = color.view->imageInfo().layout;
  • immediately after this, we change the layout of that image

So to fix this, I just opted to update the tracked render target layouts in changeImageLayout if necessary.

@K0bin K0bin requested a review from doitsujin May 3, 2023 00:08
If the format is undefined, we use the format of each image
which is obviously also view compatible with the imge.
Copy link
Owner

@doitsujin doitsujin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one nit

src/d3d9/d3d9_device.cpp Outdated Show resolved Hide resolved
src/dxvk/dxvk_context.cpp Show resolved Hide resolved
@doitsujin doitsujin merged commit 9ce1c4d into doitsujin:master May 3, 2023
@K0bin K0bin deleted the resolvefix2 branch May 3, 2023 11:28
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.

RaceRoom Racing Experience (211500) Crashes when trying to do a race
2 participants