mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-26 00:24:14 +01:00
Fix indirect draws with direct buffers
We need to wait on the GPFIFO manually as we won't hit the traps when accesing the indirect params with direct as we usually would.
This commit is contained in:
parent
68ad052cb1
commit
45bbf3bb2a
@ -1,6 +1,8 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2021 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <range/v3/view.hpp>
|
||||
#include <adrenotools/driver.h>
|
||||
#include <common/settings.h>
|
||||
@ -555,7 +557,7 @@ namespace skyline::gpu::interconnect {
|
||||
}
|
||||
}
|
||||
|
||||
void CommandExecutor::Submit(std::function<void()> &&callback) {
|
||||
void CommandExecutor::Submit(std::function<void()> &&callback, bool wait) {
|
||||
for (const auto &flushCallback : flushCallbacks)
|
||||
flushCallback();
|
||||
|
||||
@ -581,6 +583,21 @@ namespace skyline::gpu::interconnect {
|
||||
callback();
|
||||
|
||||
ResetInternal();
|
||||
|
||||
if (wait) {
|
||||
std::condition_variable cv;
|
||||
std::mutex mutex;
|
||||
bool gpuDone{};
|
||||
|
||||
waiterThread.Queue(nullptr, [&cv, &mutex, &gpuDone] {
|
||||
std::scoped_lock lock{mutex};
|
||||
gpuDone = true;
|
||||
cv.notify_one();
|
||||
});
|
||||
|
||||
std::unique_lock lock{mutex};
|
||||
cv.wait(lock, [&gpuDone] { return gpuDone; });
|
||||
}
|
||||
}
|
||||
|
||||
void CommandExecutor::LockPreserve() {
|
||||
|
@ -301,8 +301,9 @@ namespace skyline::gpu::interconnect {
|
||||
/**
|
||||
* @brief Execute all the nodes and submit the resulting command buffer to the GPU
|
||||
* @param callback A function to call upon GPU completion of the submission
|
||||
* @param wait Whether to wait synchronously for GPU completion of the submit
|
||||
*/
|
||||
void Submit(std::function<void()> &&callback = {});
|
||||
void Submit(std::function<void()> &&callback = {}, bool wait = false);
|
||||
|
||||
/**
|
||||
* @brief Locks all preserve attached buffers/textures
|
||||
|
@ -1,7 +1,9 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include <gpu.h>
|
||||
#include <common/signal.h>
|
||||
#include <common/settings.h>
|
||||
#include <loader/loader.h>
|
||||
#include <kernel/types/KProcess.h>
|
||||
#include <soc.h>
|
||||
@ -156,7 +158,7 @@ namespace skyline::soc::gm20b {
|
||||
void ChannelGpfifo::Process(GpEntry gpEntry) {
|
||||
// Submit if required by the GpEntry, this is needed as some games dynamically generate pushbuffer contents
|
||||
if (gpEntry.sync == GpEntry::Sync::Wait)
|
||||
channelCtx.executor.Submit();
|
||||
channelCtx.executor.Submit({}, *state.settings->useDirectMemoryImport);
|
||||
|
||||
if (!gpEntry.size) {
|
||||
// This is a GPFIFO control entry, all control entries have a zero length and contain no pushbuffers
|
||||
|
Loading…
Reference in New Issue
Block a user