2018-02-15 13:26:05 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
#include "dxvk_include.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
2018-02-18 22:57:45 +01:00
|
|
|
/**
|
|
|
|
* \brief Event status
|
|
|
|
*/
|
2018-02-15 13:26:05 +01:00
|
|
|
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
|
|
|
|
*/
|
2018-02-18 22:57:45 +01:00
|
|
|
void signal(uint32_t revision);
|
2018-02-15 13:26:05 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Queries event status
|
|
|
|
* \returns Current event status
|
|
|
|
*/
|
|
|
|
DxvkEventStatus getStatus();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2018-02-19 11:27:14 +01:00
|
|
|
std::mutex m_mutex;
|
2018-02-15 13:26:05 +01:00
|
|
|
|
2018-02-27 10:14:53 +01:00
|
|
|
DxvkEventStatus m_status = DxvkEventStatus::Signaled;
|
2018-02-15 13:26:05 +01:00
|
|
|
uint32_t m_revision = 0;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2018-02-18 22:57:45 +01:00
|
|
|
/**
|
|
|
|
* \brief Event revision
|
|
|
|
*
|
|
|
|
* Stores the event object and the
|
|
|
|
* version ID for event operations.
|
|
|
|
*/
|
|
|
|
struct DxvkEventRevision {
|
|
|
|
Rc<DxvkEvent> event;
|
|
|
|
uint32_t revision;
|
|
|
|
};
|
|
|
|
|
2018-02-15 13:26:05 +01:00
|
|
|
}
|