2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #7814 from FernandoS27/another-bug-in-my-schedule

Vulkan: Fix Scheduler Chunks when their FuncType is 0.
This commit is contained in:
bunnei 2022-02-02 19:15:06 -07:00 committed by GitHub
commit 8ec32e9755
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -140,12 +140,12 @@ bool VKScheduler::UpdateRescaling(bool is_rescaling) {
void VKScheduler::WorkerThread(std::stop_token stop_token) { void VKScheduler::WorkerThread(std::stop_token stop_token) {
Common::SetCurrentThreadName("yuzu:VulkanWorker"); Common::SetCurrentThreadName("yuzu:VulkanWorker");
do { do {
if (work_queue.empty()) {
wait_cv.notify_all();
}
std::unique_ptr<CommandChunk> work; std::unique_ptr<CommandChunk> work;
{ {
std::unique_lock lock{work_mutex}; std::unique_lock lock{work_mutex};
if (work_queue.empty()) {
wait_cv.notify_all();
}
work_cv.wait(lock, stop_token, [this] { return !work_queue.empty(); }); work_cv.wait(lock, stop_token, [this] { return !work_queue.empty(); });
if (stop_token.stop_requested()) { if (stop_token.stop_requested()) {
continue; continue;

View file

@ -146,6 +146,7 @@ private:
using FuncType = TypedCommand<T>; using FuncType = TypedCommand<T>;
static_assert(sizeof(FuncType) < sizeof(data), "Lambda is too large"); static_assert(sizeof(FuncType) < sizeof(data), "Lambda is too large");
recorded_counts++;
command_offset = Common::AlignUp(command_offset, alignof(FuncType)); command_offset = Common::AlignUp(command_offset, alignof(FuncType));
if (command_offset > sizeof(data) - sizeof(FuncType)) { if (command_offset > sizeof(data) - sizeof(FuncType)) {
return false; return false;
@ -167,7 +168,7 @@ private:
} }
bool Empty() const { bool Empty() const {
return command_offset == 0; return recorded_counts == 0;
} }
bool HasSubmit() const { bool HasSubmit() const {
@ -178,6 +179,7 @@ private:
Command* first = nullptr; Command* first = nullptr;
Command* last = nullptr; Command* last = nullptr;
size_t recorded_counts = 0;
size_t command_offset = 0; size_t command_offset = 0;
bool submit = false; bool submit = false;
alignas(std::max_align_t) std::array<u8, 0x8000> data{}; alignas(std::max_align_t) std::array<u8, 0x8000> data{};