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

Option for offscreen frame boundary conversion #1440

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

marius-pelegrin-arm
Copy link
Contributor

@marius-pelegrin-arm marius-pelegrin-arm commented Mar 7, 2024

Add --use-ext-frame-boundary option to convert all offscreen frame boundaries to VK_EXT_frame_boundary frame boundaries.

Extensions used to specify an offscreen frame boundary can be unsupported by the replay device. As there are many of such extensions, it seems important to be able to "convert" these frame boundaries to a more "standard" one.
The VK_EXT_frame_boundary seems to be the best choice as it is specialy designed for this purpose, platform independent, and supports all functionnalities supported by other extensions:

  • Specifying resources attached to the frame (images and buffers)
  • Depending on the execution of other commands
  • Specifying frame number, label and description

This commit depends on:

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 146186.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 3826 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 146199.

@marius-pelegrin-arm
Copy link
Contributor Author

I just saw that I forgot that PR #1301 wasn't merged. So... This commit "relies" on this PR. There's no real dependency (this commit still has a point and can perfectly be written without PR #1301) but this commit applies modification to the override of vkCmdInsertDebugUtilsLabelEXT that is created by PR #1301.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 146202.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 3828 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 3828 passed.

Add `--use-ext-frame-boundary` option to convert all offscreen
frame boundaries to `VK_EXT_frame_boundary` frame boundaries.

Extensions used to specify an offscreen frame boundary can be
unsupported by the replay device. As there are many of such
extensions, it seems important to be able to "convert" these
frame boundaries to a more "standard" one.
The `VK_EXT_frame_boundary` seems to be the best choice as it
is specialy designed for this purpose, platform independent,
and supports all functionnalities supported by other extensions:
- Specifying resources attached to the frame (images and buffers)
- Depending on the execution of other commands
- Specifying frame number, label and description

Change-Id: I9fb932b219380c6f9098a16a83de2086f2b424ee
@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 150909.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 3870 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 3870 passed.

Comment on lines +7287 to +7315
VkSubmitInfo submitInfo;
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
submitInfo.pNext = nullptr;
submitInfo.waitSemaphoreCount = 1;
submitInfo.pWaitSemaphores = &semaphore;
submitInfo.pWaitDstStageMask = &dstStageMask;
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &it->second.second;
submitInfo.signalSemaphoreCount = 0;
submitInfo.pSignalSemaphores = nullptr;

VkFrameBoundaryEXT frameBoundaryExt;
frameBoundaryExt.sType = VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT;
frameBoundaryExt.pNext = nullptr;
frameBoundaryExt.flags = VK_FRAME_BOUNDARY_FRAME_END_BIT_EXT;
frameBoundaryExt.frameID = application_->GetCurrentFrameNumber();
frameBoundaryExt.imageCount = (image == VK_NULL_HANDLE ? 0 : 1);
frameBoundaryExt.pImages = (image == VK_NULL_HANDLE ? nullptr : &image);
frameBoundaryExt.bufferCount = 0;
frameBoundaryExt.pBuffers = nullptr;
frameBoundaryExt.tagName = frameBoundaryExt.frameID;
frameBoundaryExt.tagSize = 0;
frameBoundaryExt.pTag = nullptr;

submitInfo.pNext = &frameBoundaryExt;

VkQueue queue;
device_table->GetDeviceQueue(device, queueFamily, 0, &queue);
device_table->QueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE);
Copy link
Contributor

Choose a reason for hiding this comment

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

One of the big concerns I have here is something we ran into before with the virtual swapchain code. We were running into a race condition when code was being submitted into a different Queue than the triggering semaphore completion work. This resulted in us performing the virtual swapchain update with incorrect content. Sometimes "future" content so we saw frame stuttering.

In this case, you may be receiving the semaphore from work that executed a queue that is not index 0. If this is the case, you're adding additional code to queue 0 potentially well after the work was done. This may result in the application already sending pending work onto that queue and the resultant "end of frame" may actually be after this content which correctly belongs to the next frame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants