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

Trim swapchain buffer #1727

Closed
wants to merge 2 commits into from
Closed

Conversation

locke-lunarg
Copy link
Contributor

No description provided.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 250630.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 4787 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 4787 passed.

swapchain = reinterpret_cast<IDXGISwapChain3*>(swapchain_info->object);
while (extra_info->buffer_index != swapchain->GetCurrentBackBufferIndex())
{
swapchain->Present(0, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Making the Present() calls here will inject extra frames when a trimmed capture is recaptured. Dx12ReplayConsumerBase::ProcessSetSwapchainImageStateCommand can also inject Present() frames. Those get reported in the output of gfxrecon-info as Blank frames. Dx12StatsConsumer tracks those here:

virtual void ProcessSetSwapchainImageStateCommand(format::HandleId device_id,
format::HandleId swapchain_id,
uint32_t current_buffer_index,
const std::vector<format::SwapchainImageStateInfo>& image_state)
{
dummy_trim_frame_count_ = current_buffer_index;
}

The value of Blank frames is used by our CI to offset screenshot frame indices after recapture. However this PR passed the CI tests. So some follow up questions are:

  1. Why didn't this change affect CI success?
  2. Do we need to account for these Present calls in Blank frames, and if so, how can it be done?

One thought I have as a solution for 2 (if it is needed) is that we add a new meta data command that is like InitSubresourceCommand but is specific for swapchain images, something like InitDxgiSwapchainBufferCommand and use that for restoring swapchain buffer data instead.

Copy link
Contributor Author

@locke-lunarg locke-lunarg Sep 18, 2024

Choose a reason for hiding this comment

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

For question 1:
The test needs to trimming capture, and then capture the trimmed file again, and then replay the file, it will happen the Blank frames issue. Our ci didn't do that kind of test.

Plus, although, some original files were trimmed captured files, those files were captured by old code. The old code didn't write swapchain buffer, so even it captured the trim captured files, it didn't include Blank frames.

Dx12ReplayConsumerBase::ProcessSetSwapchainImageStateQueueSubmit that initialize swapchain buffer index also runs Present to match the correct buffer index if in need. So Blank frames issue exists for long.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 251211.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 4792 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 4792 passed.

For copy swapchain buffers:
1. The queue has to been swapchain's queue.
2. One ExecuteCommandLists could work for only one swapchain buffer.
3. The current back buffer index has to match the swapchain buffer.
4. After ExecuteCommandLists, the current back buffer index has to back init.
@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 251278.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 4793 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 4793 passed.

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.

3 participants