D3D12: Implement perf query support

This commit is contained in:
Stenzek
2016-03-06 21:34:41 +10:00
parent 25d5da0ea3
commit 4269abdc3e
5 changed files with 280 additions and 25 deletions

View File

@ -5,6 +5,7 @@
#pragma once
#include <array>
#include <d3d12.h>
#include "VideoCommon/PerfQueryBase.h"
@ -27,20 +28,33 @@ public:
private:
struct ActiveQuery
{
//ID3D11Query* query;
PerfQueryGroup query_type;
UINT64 fence_value;
};
void WeakFlush();
// Find the last fence value of all pending queries.
UINT64 FindLastPendingFenceValue() const;
// Only use when non-empty
void FlushOne();
// when testing in SMS: 64 was too small, 128 was ok
static const int s_perf_query_buffer_size = 512;
static void QueueFenceCallback(void* owning_object, UINT64 fence_value);
void QueueFence(UINT64 fence_value);
std::array<ActiveQuery, s_perf_query_buffer_size> m_query_buffer;
// when testing in SMS: 64 was too small, 128 was ok
static constexpr size_t PERF_QUERY_BUFFER_SIZE = 512;
static constexpr size_t QUERY_READBACK_BUFFER_SIZE = PERF_QUERY_BUFFER_SIZE * sizeof(UINT64);
std::array<ActiveQuery, PERF_QUERY_BUFFER_SIZE> m_query_buffer;
int m_query_read_pos = 0;
ID3D12QueryHeap* m_query_heap = nullptr;
ID3D12Resource* m_query_readback_buffer = nullptr;
ID3D12Fence* m_tracking_fence = nullptr;
UINT64 m_next_fence_value = 0;
};
} // namespace