mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Add support for new signals to the backend
This commit is contained in:
parent
4e8122eda9
commit
f0acc40e50
@ -171,6 +171,7 @@ namespace dxvk {
|
||||
// Signal resources and events to
|
||||
// avoid stalling main thread
|
||||
m_eventTracker.reset();
|
||||
m_signalTracker.reset();
|
||||
m_resources.reset();
|
||||
|
||||
// Recycle heavy Vulkan objects
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "dxvk_lifetime.h"
|
||||
#include "dxvk_limits.h"
|
||||
#include "dxvk_pipelayout.h"
|
||||
#include "dxvk_signal.h"
|
||||
#include "dxvk_staging.h"
|
||||
#include "dxvk_stats.h"
|
||||
|
||||
@ -199,6 +200,23 @@ namespace dxvk {
|
||||
void signalEvents() {
|
||||
m_eventTracker.signalEvents();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Queues signal
|
||||
*
|
||||
* The signal will be notified once the command
|
||||
* buffer has finished executing on the GPU.
|
||||
*/
|
||||
void queueSignal(const Rc<sync::Signal>& signal) {
|
||||
m_signalTracker.add(signal);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Notifies signals
|
||||
*/
|
||||
void notifySignals() {
|
||||
m_signalTracker.notify();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Resets the command list
|
||||
@ -769,6 +787,7 @@ namespace dxvk {
|
||||
DxvkLifetimeTracker m_resources;
|
||||
DxvkDescriptorPoolTracker m_descriptorPoolTracker;
|
||||
DxvkEventTracker m_eventTracker;
|
||||
DxvkSignalTracker m_signalTracker;
|
||||
DxvkGpuEventTracker m_gpuEventTracker;
|
||||
DxvkGpuQueryTracker m_gpuQueryTracker;
|
||||
DxvkBufferTracker m_bufferTracker;
|
||||
|
@ -2395,6 +2395,11 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::queueSignal(const Rc<sync::Signal>& signal) {
|
||||
m_cmd->queueSignal(signal);
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::trimStagingBuffers() {
|
||||
m_staging.trim();
|
||||
}
|
||||
|
@ -982,6 +982,17 @@ namespace dxvk {
|
||||
void writeTimestamp(
|
||||
const Rc<DxvkGpuQuery>& query);
|
||||
|
||||
/**
|
||||
* \brief Queues a signal
|
||||
*
|
||||
* The signal will be notified after all
|
||||
* previously submitted commands have
|
||||
* finished execution on the GPU.
|
||||
* \param [in] signal The signal
|
||||
*/
|
||||
void queueSignal(
|
||||
const Rc<sync::Signal>& signal);
|
||||
|
||||
/**
|
||||
* \brief Trims staging buffers
|
||||
*
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "../util/sha1/sha1_util.h"
|
||||
|
||||
#include "../util/sync/sync_signal.h"
|
||||
#include "../util/sync/sync_spinlock.h"
|
||||
#include "../util/sync/sync_ticketlock.h"
|
||||
|
||||
|
@ -151,6 +151,7 @@ namespace dxvk {
|
||||
|
||||
if (status == VK_SUCCESS) {
|
||||
entry.submit.cmdList->signalEvents();
|
||||
entry.submit.cmdList->notifySignals();
|
||||
entry.submit.cmdList->reset();
|
||||
|
||||
m_device->recycleCommandList(entry.submit.cmdList);
|
||||
|
30
src/dxvk/dxvk_signal.cpp
Normal file
30
src/dxvk/dxvk_signal.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include "dxvk_signal.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
DxvkSignalTracker::DxvkSignalTracker() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
DxvkSignalTracker::~DxvkSignalTracker() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DxvkSignalTracker::add(const Rc<sync::Signal>& signal) {
|
||||
m_signals.push_back(signal);
|
||||
}
|
||||
|
||||
|
||||
void DxvkSignalTracker::notify() {
|
||||
for (const auto& sig : m_signals)
|
||||
sig->notify();
|
||||
}
|
||||
|
||||
|
||||
void DxvkSignalTracker::reset() {
|
||||
m_signals.clear();
|
||||
}
|
||||
|
||||
}
|
39
src/dxvk/dxvk_signal.h
Normal file
39
src/dxvk/dxvk_signal.h
Normal file
@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "dxvk_include.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
/**
|
||||
* \brief Signal tracker
|
||||
*/
|
||||
class DxvkSignalTracker {
|
||||
|
||||
public:
|
||||
|
||||
DxvkSignalTracker();
|
||||
~DxvkSignalTracker();
|
||||
|
||||
/**
|
||||
* \brief Adds a signal to track
|
||||
* \param [in] signal The signal
|
||||
*/
|
||||
void add(const Rc<sync::Signal>& signal);
|
||||
|
||||
/**
|
||||
* \brief Notifies tracked signals
|
||||
*/
|
||||
void notify();
|
||||
|
||||
/**
|
||||
* \brief Resets signal tracker
|
||||
*/
|
||||
void reset();
|
||||
|
||||
private:
|
||||
|
||||
std::vector<Rc<sync::Signal>> m_signals;
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -86,6 +86,7 @@ dxvk_src = files([
|
||||
'dxvk_sampler.cpp',
|
||||
'dxvk_shader.cpp',
|
||||
'dxvk_shader_key.cpp',
|
||||
'dxvk_signal.cpp',
|
||||
'dxvk_spec_const.cpp',
|
||||
'dxvk_staging.cpp',
|
||||
'dxvk_state_cache.cpp',
|
||||
|
Loading…
x
Reference in New Issue
Block a user