1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-03 22:24:13 +01:00

[dxvk] Move DxvkEventTracker to dxvk_event.{h,cpp}

The upcoming new event and query classes will follow this design.
Reduces the number of files around these small classes.
This commit is contained in:
Philip Rebohle 2018-11-17 01:15:22 +01:00
parent aea4162198
commit 85f0fe729c
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
6 changed files with 72 additions and 81 deletions

View File

@ -5,7 +5,7 @@
#include "dxvk_bind_mask.h"
#include "dxvk_buffer.h"
#include "dxvk_descriptor.h"
#include "dxvk_event_tracker.h"
#include "dxvk_event.h"
#include "dxvk_lifetime.h"
#include "dxvk_limits.h"
#include "dxvk_pipelayout.h"

View File

@ -52,5 +52,33 @@ namespace dxvk {
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();
}
}

View File

@ -1,6 +1,7 @@
#pragma once
#include <mutex>
#include <atomic>
#include <vector>
#include "dxvk_include.h"
@ -69,7 +70,8 @@ namespace dxvk {
static Status unpack(uint64_t packed);
};
/**
* \brief Event revision
*
@ -80,5 +82,44 @@ namespace dxvk {
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;
};
}

View File

@ -1,30 +0,0 @@
#include "dxvk_event_tracker.h"
namespace dxvk {
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();
}
}

View File

@ -1,47 +0,0 @@
#pragma once
#include <vector>
#include "dxvk_event.h"
namespace dxvk {
/**
* \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;
};
}

View File

@ -54,7 +54,6 @@ dxvk_src = files([
'dxvk_device_filter.cpp',
'dxvk_extensions.cpp',
'dxvk_event.cpp',
'dxvk_event_tracker.cpp',
'dxvk_format.cpp',
'dxvk_framebuffer.cpp',
'dxvk_graphics.cpp',