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

[dxvk] Implement method to signal GPU events

This commit is contained in:
Philip Rebohle 2018-11-16 23:47:31 +01:00
parent 6b9653d261
commit 3dbd755075
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 41 additions and 0 deletions

View File

@ -124,6 +124,7 @@ namespace dxvk {
void DxvkCommandList::reset() {
m_statCounters.reset();
m_bufferTracker.reset();
m_gpuEventTracker.reset();
m_eventTracker.reset();
m_queryTracker.reset();
m_stagingAlloc.reset();

View File

@ -6,6 +6,7 @@
#include "dxvk_buffer.h"
#include "dxvk_descriptor.h"
#include "dxvk_event.h"
#include "dxvk_gpu_event.h"
#include "dxvk_lifetime.h"
#include "dxvk_limits.h"
#include "dxvk_pipelayout.h"
@ -164,6 +165,17 @@ namespace dxvk {
m_descriptorPoolTracker.trackDescriptorPool(pool);
}
/**
* \brief Tracks a GPU event
*
* The event will be returned to its event pool
* after the command buffer has finished executing.
* \param [in] handle Event handle
*/
void trackGpuEvent(DxvkGpuEventHandle handle) {
m_gpuEventTracker.trackEvent(handle);
}
/**
* \brief Signals tracked events
*
@ -592,6 +604,13 @@ namespace dxvk {
depthBiasSlopeFactor);
}
void cmdSetEvent(
VkEvent event,
VkPipelineStageFlags stages) {
m_vkd->vkCmdSetEvent(m_execBuffer, event, stages);
}
void cmdSetScissor(
uint32_t firstScissor,
@ -661,6 +680,7 @@ namespace dxvk {
DxvkStagingAlloc m_stagingAlloc;
DxvkQueryTracker m_queryTracker;
DxvkEventTracker m_eventTracker;
DxvkGpuEventTracker m_gpuEventTracker;
DxvkBufferTracker m_bufferTracker;
DxvkStatCounters m_statCounters;

View File

@ -1762,6 +1762,19 @@ namespace dxvk {
void DxvkContext::signalEvent(const DxvkEventRevision& event) {
m_cmd->trackEvent(event);
}
void DxvkContext::signalGpuEvent(const Rc<DxvkGpuEvent>& event) {
this->spillRenderPass();
DxvkGpuEventHandle handle = m_gpuEvents->allocEvent();
m_cmd->cmdSetEvent(handle.event,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT);
m_cmd->trackGpuEvent(event->reset(handle));
m_cmd->trackResource(event);
}
void DxvkContext::writeTimestamp(const DxvkQueryRevision& query) {

View File

@ -773,6 +773,13 @@ namespace dxvk {
void signalEvent(
const DxvkEventRevision& event);
/**
* \brief Signals a GPU event
* \param [in] event The event
*/
void signalGpuEvent(
const Rc<DxvkGpuEvent>& event);
/**
* \brief Writes to a timestamp query
* \param [in] query The timestamp query