Skip to content

Commit

Permalink
capture: Remove extra sampling fence and document workaround
Browse files Browse the repository at this point in the history
Seems that this is another victim of the AMD GPU bugs.
  • Loading branch information
YaLTeR committed Jul 3, 2023
1 parent fc08f76 commit 4a00b77
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -43,6 +43,8 @@ If the video looks glitched or the game crashes when starting recording (happens
1. Update your GPU driver.
1. If the problem still occurs, try `_bxt_cap_force_fallback 1`.

If on Linux on an AMD GPU recording causes black screens and freezes, try running the game with `GALLIUM_THREAD=0` environment variable.

### Profiling

Start Half-Life with the `BXT_RS_PROFILE` environment variable set to make bxt-rs output a `trace.json` file in the Half-Life folder. This is a Chrome JSON trace file which you can view in [Perfetto](https://ui.perfetto.dev/) or in `chrome://tracing`.
Expand Down
18 changes: 1 addition & 17 deletions src/modules/capture/vulkan.rs
Expand Up @@ -710,26 +710,10 @@ impl Vulkan {
self.device
.end_command_buffer(self.command_buffer_accumulate)?;

// XXX: As far as I can tell, waiting for a fence here should not be required (and it makes
// the process quite slower). Unfortunately, I'm getting GPU fence timeouts if I don't do
// it. Maybe there's a synchronization bug in the code, but I don't see it, and the
// validation layers are silent too.
let create_info = vk::FenceCreateInfo::default();
let fence = self.device.create_fence(&create_info, None)?;

let command_buffers = [self.command_buffer_accumulate];
let submit_info = vk::SubmitInfo::builder().command_buffers(&command_buffers);
self.device
.queue_submit(self.queue, &[*submit_info], fence)?;

{
let _span = info_span!("wait for fence").entered();

self.device
.wait_for_fences(&[fence], true, u64::max_value())?;
}

self.device.destroy_fence(fence, None);
.queue_submit(self.queue, &[*submit_info], vk::Fence::null())?;

Ok(())
}
Expand Down

0 comments on commit 4a00b77

Please sign in to comment.