mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2026-05-10 19:21:42 +00:00
feat(bindless): Split synchronization into another thread in debug tool
I think RenderDoc attaches a fence or something, so the dispatch never returns. And ontop of this it looks like timeline semaphores can be signaled back to a lower value, when shared across processes
This commit is contained in:
parent
cb4992a5dc
commit
e611c5b27d
2 changed files with 14 additions and 7 deletions
|
|
@ -138,7 +138,7 @@ int benchmark::run(const Options& opts) {
|
||||||
|
|
||||||
auto success = sync.wait(vk, idx++);
|
auto success = sync.wait(vk, idx++);
|
||||||
if (!success)
|
if (!success)
|
||||||
throw ls::error("failed to wait for frame");
|
throw ls::error("Failed to wait for frame");
|
||||||
|
|
||||||
total_frames++;
|
total_frames++;
|
||||||
generated_frames++;
|
generated_frames++;
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
@ -185,6 +186,7 @@ int debug::run(const Options& opts) {
|
||||||
// Render destination images
|
// Render destination images
|
||||||
const uint32_t total{static_cast<uint32_t>(opts.multiplier) - 1U};
|
const uint32_t total{static_cast<uint32_t>(opts.multiplier) - 1U};
|
||||||
|
|
||||||
|
size_t idx{1};
|
||||||
for (size_t j = 0; j < paths.size(); j++) {
|
for (size_t j = 0; j < paths.size(); j++) {
|
||||||
uploadDDS(vk, source, paths.at(j).string(), j % 2);
|
uploadDDS(vk, source, paths.at(j).string(), j % 2);
|
||||||
|
|
||||||
|
|
@ -192,19 +194,24 @@ int debug::run(const Options& opts) {
|
||||||
rdoc_api->StartFrameCapture(rdoc_device, nullptr);
|
rdoc_api->StartFrameCapture(rdoc_device, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t idx{(j + 1) * total * 2};
|
std::thread signal_thread{[&sync, &vk, &idx, total] {
|
||||||
sync.signal(vk, idx - 1);
|
for (size_t i = 0; i < total; i++) {
|
||||||
|
sync.signal(vk, idx++);
|
||||||
|
|
||||||
|
auto success = sync.wait(vk, idx++);
|
||||||
|
if (!success)
|
||||||
|
throw ls::error("Failed to wait for frame");
|
||||||
|
}
|
||||||
|
}};
|
||||||
|
|
||||||
lsfgvk_ctx.dispatch(total);
|
lsfgvk_ctx.dispatch(total);
|
||||||
|
|
||||||
auto success = sync.wait(vk, idx);
|
|
||||||
if (!success)
|
|
||||||
throw ls::error("Failed to wait for frame");
|
|
||||||
|
|
||||||
if (rdoc_api) {
|
if (rdoc_api) {
|
||||||
lsfgvk_ctx.idle();
|
lsfgvk_ctx.idle();
|
||||||
rdoc_api->EndFrameCapture(rdoc_device, nullptr);
|
rdoc_api->EndFrameCapture(rdoc_device, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signal_thread.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for idle
|
// Wait for idle
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue