mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 10:24:12 +01:00
[dxvk] Remove obsolete DxvkEvent class
This commit is contained in:
parent
15072afa1f
commit
24e1969dc4
@ -11,7 +11,6 @@ namespace dxvk {
|
|||||||
class DxvkAdapter;
|
class DxvkAdapter;
|
||||||
class DxvkBuffer;
|
class DxvkBuffer;
|
||||||
class DxvkDevice;
|
class DxvkDevice;
|
||||||
class DxvkEvent;
|
|
||||||
class DxvkImage;
|
class DxvkImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,6 @@ namespace dxvk {
|
|||||||
void DxvkCommandList::reset() {
|
void DxvkCommandList::reset() {
|
||||||
// Signal resources and events to
|
// Signal resources and events to
|
||||||
// avoid stalling main thread
|
// avoid stalling main thread
|
||||||
m_eventTracker.reset();
|
|
||||||
m_signalTracker.reset();
|
m_signalTracker.reset();
|
||||||
m_resources.reset();
|
m_resources.reset();
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "dxvk_bind_mask.h"
|
#include "dxvk_bind_mask.h"
|
||||||
#include "dxvk_buffer.h"
|
#include "dxvk_buffer.h"
|
||||||
#include "dxvk_descriptor.h"
|
#include "dxvk_descriptor.h"
|
||||||
#include "dxvk_event.h"
|
|
||||||
#include "dxvk_gpu_event.h"
|
#include "dxvk_gpu_event.h"
|
||||||
#include "dxvk_gpu_query.h"
|
#include "dxvk_gpu_query.h"
|
||||||
#include "dxvk_lifetime.h"
|
#include "dxvk_lifetime.h"
|
||||||
@ -151,16 +150,6 @@ namespace dxvk {
|
|||||||
m_resources.trackResource(std::move(rc));
|
m_resources.trackResource(std::move(rc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Adds an event revision to track
|
|
||||||
*
|
|
||||||
* The event will be signaled after the command
|
|
||||||
* buffer has finished executing on the GPU.
|
|
||||||
*/
|
|
||||||
void trackEvent(const DxvkEventRevision& event) {
|
|
||||||
m_eventTracker.trackEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Tracks a descriptor pool
|
* \brief Tracks a descriptor pool
|
||||||
* \param [in] pool The descriptor pool
|
* \param [in] pool The descriptor pool
|
||||||
@ -191,16 +180,6 @@ namespace dxvk {
|
|||||||
m_gpuQueryTracker.trackQuery(handle);
|
m_gpuQueryTracker.trackQuery(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Signals tracked events
|
|
||||||
*
|
|
||||||
* Marks all tracked events as signaled. Call this after
|
|
||||||
* synchronizing with a fence for this command list.
|
|
||||||
*/
|
|
||||||
void signalEvents() {
|
|
||||||
m_eventTracker.signalEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Queues signal
|
* \brief Queues signal
|
||||||
*
|
*
|
||||||
@ -786,7 +765,6 @@ namespace dxvk {
|
|||||||
DxvkCmdBufferFlags m_cmdBuffersUsed;
|
DxvkCmdBufferFlags m_cmdBuffersUsed;
|
||||||
DxvkLifetimeTracker m_resources;
|
DxvkLifetimeTracker m_resources;
|
||||||
DxvkDescriptorPoolTracker m_descriptorPoolTracker;
|
DxvkDescriptorPoolTracker m_descriptorPoolTracker;
|
||||||
DxvkEventTracker m_eventTracker;
|
|
||||||
DxvkSignalTracker m_signalTracker;
|
DxvkSignalTracker m_signalTracker;
|
||||||
DxvkGpuEventTracker m_gpuEventTracker;
|
DxvkGpuEventTracker m_gpuEventTracker;
|
||||||
DxvkGpuQueryTracker m_gpuQueryTracker;
|
DxvkGpuQueryTracker m_gpuQueryTracker;
|
||||||
|
@ -2357,11 +2357,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::signalEvent(const DxvkEventRevision& event) {
|
|
||||||
m_cmd->trackEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::signalGpuEvent(const Rc<DxvkGpuEvent>& event) {
|
void DxvkContext::signalGpuEvent(const Rc<DxvkGpuEvent>& event) {
|
||||||
this->spillRenderPass();
|
this->spillRenderPass();
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "dxvk_cmdlist.h"
|
#include "dxvk_cmdlist.h"
|
||||||
#include "dxvk_context_state.h"
|
#include "dxvk_context_state.h"
|
||||||
#include "dxvk_data.h"
|
#include "dxvk_data.h"
|
||||||
#include "dxvk_event.h"
|
|
||||||
#include "dxvk_gpu_event.h"
|
#include "dxvk_gpu_event.h"
|
||||||
#include "dxvk_gpu_query.h"
|
#include "dxvk_gpu_query.h"
|
||||||
#include "dxvk_meta_clear.h"
|
#include "dxvk_meta_clear.h"
|
||||||
@ -949,13 +948,6 @@ namespace dxvk {
|
|||||||
void setBarrierControl(
|
void setBarrierControl(
|
||||||
DxvkBarrierControlFlags control);
|
DxvkBarrierControlFlags control);
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Signals an event
|
|
||||||
* \param [in] event The event
|
|
||||||
*/
|
|
||||||
void signalEvent(
|
|
||||||
const DxvkEventRevision& event);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Signals a GPU event
|
* \brief Signals a GPU event
|
||||||
* \param [in] event The event
|
* \param [in] event The event
|
||||||
|
@ -1,84 +0,0 @@
|
|||||||
#include "dxvk_event.h"
|
|
||||||
|
|
||||||
namespace dxvk {
|
|
||||||
|
|
||||||
DxvkEvent::DxvkEvent()
|
|
||||||
: m_packed(pack({ DxvkEventStatus::Signaled, 0u })) { }
|
|
||||||
|
|
||||||
|
|
||||||
DxvkEvent::~DxvkEvent() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t DxvkEvent::reset() {
|
|
||||||
Status info;
|
|
||||||
|
|
||||||
uint64_t packed = m_packed.load();
|
|
||||||
|
|
||||||
do {
|
|
||||||
info.status = DxvkEventStatus::Reset;
|
|
||||||
info.revision = unpack(packed).revision + 1;
|
|
||||||
} while (!m_packed.compare_exchange_strong(packed, pack(info)));
|
|
||||||
|
|
||||||
return info.revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkEvent::signal(uint32_t revision) {
|
|
||||||
uint64_t expected = pack({ DxvkEventStatus::Reset, revision });
|
|
||||||
uint64_t desired = pack({ DxvkEventStatus::Signaled, revision });
|
|
||||||
m_packed.compare_exchange_strong(expected, desired);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkEventStatus DxvkEvent::getStatus() const {
|
|
||||||
return unpack(m_packed.load()).status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkEvent::wait() const {
|
|
||||||
while (this->getStatus() != DxvkEventStatus::Signaled)
|
|
||||||
dxvk::this_thread::yield();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint64_t DxvkEvent::pack(Status info) {
|
|
||||||
return (uint64_t(info.revision))
|
|
||||||
| (uint64_t(info.status) << 32);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkEvent::Status DxvkEvent::unpack(uint64_t packed) {
|
|
||||||
return { DxvkEventStatus(packed >> 32), uint32_t(packed) };
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DxvkEventTracker::DxvkEventTracker() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkEventTracker::~DxvkEventTracker() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkEventTracker::trackEvent(const DxvkEventRevision& event) {
|
|
||||||
m_events.push_back(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkEventTracker::signalEvents() {
|
|
||||||
for (const DxvkEventRevision& event : m_events)
|
|
||||||
event.event->signal(event.revision);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkEventTracker::reset() {
|
|
||||||
m_events.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,125 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <atomic>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "dxvk_include.h"
|
|
||||||
|
|
||||||
namespace dxvk {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Event status
|
|
||||||
*/
|
|
||||||
enum class DxvkEventStatus {
|
|
||||||
Reset = 0,
|
|
||||||
Signaled = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Event
|
|
||||||
*
|
|
||||||
* A CPU-side fence that will be signaled after
|
|
||||||
* all previous Vulkan commands recorded to a
|
|
||||||
* command buffer have finished executing.
|
|
||||||
*/
|
|
||||||
class DxvkEvent : public RcObject {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DxvkEvent();
|
|
||||||
~DxvkEvent();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Resets the event
|
|
||||||
* \returns New revision ID
|
|
||||||
*/
|
|
||||||
uint32_t reset();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Signals the event
|
|
||||||
* \param [in] revision The revision ID
|
|
||||||
*/
|
|
||||||
void signal(uint32_t revision);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Queries event status
|
|
||||||
* \returns Current event status
|
|
||||||
*/
|
|
||||||
DxvkEventStatus getStatus() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Waits for event to get signaled
|
|
||||||
*
|
|
||||||
* Blocks the calling thread until another
|
|
||||||
* thread calls \ref signal for the current
|
|
||||||
* revision of the event.
|
|
||||||
*/
|
|
||||||
void wait() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
struct Status {
|
|
||||||
DxvkEventStatus status = DxvkEventStatus::Signaled;
|
|
||||||
uint32_t revision = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Packed status and revision
|
|
||||||
std::atomic<uint64_t> m_packed;
|
|
||||||
|
|
||||||
static uint64_t pack(Status info);
|
|
||||||
static Status unpack(uint64_t packed);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Event revision
|
|
||||||
*
|
|
||||||
* Stores the event object and the
|
|
||||||
* version ID for event operations.
|
|
||||||
*/
|
|
||||||
struct DxvkEventRevision {
|
|
||||||
Rc<DxvkEvent> event;
|
|
||||||
uint32_t revision;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Event tracker
|
|
||||||
*/
|
|
||||||
class DxvkEventTracker {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DxvkEventTracker();
|
|
||||||
~DxvkEventTracker();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Adds an event to track
|
|
||||||
* \param [in] event The event revision
|
|
||||||
*/
|
|
||||||
void trackEvent(const DxvkEventRevision& event);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Signals tracked events
|
|
||||||
*
|
|
||||||
* Retrieves query data from the query pools
|
|
||||||
* and writes it back to the query objects.
|
|
||||||
*/
|
|
||||||
void signalEvents();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Resets event tracker
|
|
||||||
*
|
|
||||||
* Releases all events from the tracker.
|
|
||||||
* Call this after signaling the events.
|
|
||||||
*/
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
std::vector<DxvkEventRevision> m_events;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@ -150,7 +150,6 @@ namespace dxvk {
|
|||||||
VkResult status = entry.submit.cmdList->synchronize();
|
VkResult status = entry.submit.cmdList->synchronize();
|
||||||
|
|
||||||
if (status == VK_SUCCESS) {
|
if (status == VK_SUCCESS) {
|
||||||
entry.submit.cmdList->signalEvents();
|
|
||||||
entry.submit.cmdList->notifySignals();
|
entry.submit.cmdList->notifySignals();
|
||||||
entry.submit.cmdList->reset();
|
entry.submit.cmdList->reset();
|
||||||
|
|
||||||
|
@ -59,7 +59,6 @@ dxvk_src = files([
|
|||||||
'dxvk_device.cpp',
|
'dxvk_device.cpp',
|
||||||
'dxvk_device_filter.cpp',
|
'dxvk_device_filter.cpp',
|
||||||
'dxvk_extensions.cpp',
|
'dxvk_extensions.cpp',
|
||||||
'dxvk_event.cpp',
|
|
||||||
'dxvk_format.cpp',
|
'dxvk_format.cpp',
|
||||||
'dxvk_framebuffer.cpp',
|
'dxvk_framebuffer.cpp',
|
||||||
'dxvk_gpu_event.cpp',
|
'dxvk_gpu_event.cpp',
|
||||||
|
Loading…
Reference in New Issue
Block a user