mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxvk] Removed stat counters
This commit is contained in:
parent
b9e1646453
commit
fb36b56891
@ -118,7 +118,6 @@ namespace dxvk {
|
|||||||
Rc<DxvkBuffer> DxvkDevice::createBuffer(
|
Rc<DxvkBuffer> DxvkDevice::createBuffer(
|
||||||
const DxvkBufferCreateInfo& createInfo,
|
const DxvkBufferCreateInfo& createInfo,
|
||||||
VkMemoryPropertyFlags memoryType) {
|
VkMemoryPropertyFlags memoryType) {
|
||||||
m_statCounters.increment(DxvkStat::ResBufferCreations, 1);
|
|
||||||
return new DxvkBuffer(this, createInfo, memoryType);
|
return new DxvkBuffer(this, createInfo, memoryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +132,6 @@ namespace dxvk {
|
|||||||
Rc<DxvkImage> DxvkDevice::createImage(
|
Rc<DxvkImage> DxvkDevice::createImage(
|
||||||
const DxvkImageCreateInfo& createInfo,
|
const DxvkImageCreateInfo& createInfo,
|
||||||
VkMemoryPropertyFlags memoryType) {
|
VkMemoryPropertyFlags memoryType) {
|
||||||
m_statCounters.increment(DxvkStat::ResImageCreations, 1);
|
|
||||||
return new DxvkImage(m_vkd, createInfo, *m_memory, memoryType);
|
return new DxvkImage(m_vkd, createInfo, *m_memory, memoryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,8 +204,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
VkResult DxvkDevice::presentSwapImage(
|
VkResult DxvkDevice::presentSwapImage(
|
||||||
const VkPresentInfoKHR& presentInfo) {
|
const VkPresentInfoKHR& presentInfo) {
|
||||||
m_statCounters.increment(DxvkStat::DevQueuePresents, 1);
|
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(m_submissionLock);
|
std::lock_guard<std::mutex> lock(m_submissionLock);
|
||||||
return m_vkd->vkQueuePresentKHR(m_presentQueue, &presentInfo);
|
return m_vkd->vkQueuePresentKHR(m_presentQueue, &presentInfo);
|
||||||
}
|
}
|
||||||
@ -240,14 +236,11 @@ namespace dxvk {
|
|||||||
|
|
||||||
// Add this to the set of running submissions
|
// Add this to the set of running submissions
|
||||||
m_submissionQueue.submit(fence, commandList);
|
m_submissionQueue.submit(fence, commandList);
|
||||||
m_statCounters.increment(DxvkStat::DevQueueSubmissions, 1);
|
|
||||||
return fence;
|
return fence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkDevice::waitForIdle() {
|
void DxvkDevice::waitForIdle() {
|
||||||
m_statCounters.increment(DxvkStat::DevSynchronizations, 1);
|
|
||||||
|
|
||||||
if (m_vkd->vkDeviceWaitIdle(m_vkd->device()) != VK_SUCCESS)
|
if (m_vkd->vkDeviceWaitIdle(m_vkd->device()) != VK_SUCCESS)
|
||||||
Logger::err("DxvkDevice: waitForIdle: Operation failed");
|
Logger::err("DxvkDevice: waitForIdle: Operation failed");
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "dxvk_renderpass.h"
|
#include "dxvk_renderpass.h"
|
||||||
#include "dxvk_sampler.h"
|
#include "dxvk_sampler.h"
|
||||||
#include "dxvk_shader.h"
|
#include "dxvk_shader.h"
|
||||||
#include "dxvk_stats.h"
|
|
||||||
#include "dxvk_swapchain.h"
|
#include "dxvk_swapchain.h"
|
||||||
#include "dxvk_sync.h"
|
#include "dxvk_sync.h"
|
||||||
#include "dxvk_unbound.h"
|
#include "dxvk_unbound.h"
|
||||||
@ -329,14 +328,6 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
void waitForIdle();
|
void waitForIdle();
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Retrieves stat counters
|
|
||||||
* \returns Stat counters
|
|
||||||
*/
|
|
||||||
DxvkStatCounters queryCounters() const {
|
|
||||||
return m_statCounters;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Rc<DxvkAdapter> m_adapter;
|
Rc<DxvkAdapter> m_adapter;
|
||||||
@ -359,8 +350,6 @@ namespace dxvk {
|
|||||||
DxvkRecycler<DxvkCommandList, 16> m_recycledCommandLists;
|
DxvkRecycler<DxvkCommandList, 16> m_recycledCommandLists;
|
||||||
DxvkRecycler<DxvkStagingBuffer, 4> m_recycledStagingBuffers;
|
DxvkRecycler<DxvkStagingBuffer, 4> m_recycledStagingBuffers;
|
||||||
|
|
||||||
DxvkStatCounters m_statCounters;
|
|
||||||
|
|
||||||
DxvkSubmissionQueue m_submissionQueue;
|
DxvkSubmissionQueue m_submissionQueue;
|
||||||
|
|
||||||
void recycleCommandList(
|
void recycleCommandList(
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
#include "dxvk_stats.h"
|
|
||||||
|
|
||||||
namespace dxvk {
|
|
||||||
|
|
||||||
DxvkStatCounters:: DxvkStatCounters() { }
|
|
||||||
DxvkStatCounters::~DxvkStatCounters() { }
|
|
||||||
|
|
||||||
|
|
||||||
DxvkStatCounters::DxvkStatCounters(const DxvkStatCounters& other) {
|
|
||||||
for (size_t i = 0; i < m_counters.size(); i++)
|
|
||||||
m_counters[i] = other.m_counters[i].load();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkStatCounters& DxvkStatCounters::operator = (const DxvkStatCounters& other) {
|
|
||||||
for (size_t i = 0; i < m_counters.size(); i++)
|
|
||||||
m_counters[i] = other.m_counters[i].load();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkStatCounters DxvkStatCounters::delta(const DxvkStatCounters& oldState) const {
|
|
||||||
DxvkStatCounters result;
|
|
||||||
for (size_t i = 0; i < m_counters.size(); i++)
|
|
||||||
result.m_counters[i] = m_counters[i] - oldState.m_counters[i];;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkStatCounters::addCounters(const DxvkStatCounters& counters) {
|
|
||||||
for (size_t i = 0; i < m_counters.size(); i++)
|
|
||||||
m_counters[i] += counters.m_counters[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkStatCounters::clear() {
|
|
||||||
for (size_t i = 0; i < m_counters.size(); i++)
|
|
||||||
m_counters[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <atomic>
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include "dxvk_include.h"
|
|
||||||
|
|
||||||
namespace dxvk {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Statistics counter
|
|
||||||
*/
|
|
||||||
enum class DxvkStat : uint32_t {
|
|
||||||
CtxDescriptorUpdates, ///< # of descriptor set writes
|
|
||||||
CtxDrawCalls, ///< # of vkCmdDraw/vkCmdDrawIndexed
|
|
||||||
CtxDispatchCalls, ///< # of vkCmdDispatch
|
|
||||||
CtxFramebufferBinds, ///< # of render pass begin/end
|
|
||||||
CtxPipelineBinds, ///< # of vkCmdBindPipeline
|
|
||||||
DevQueueSubmissions, ///< # of vkQueueSubmit
|
|
||||||
DevQueuePresents, ///< # of vkQueuePresentKHR (aka frames)
|
|
||||||
DevSynchronizations, ///< # of vkDeviceWaitIdle
|
|
||||||
ResBufferCreations, ///< # of buffer creations
|
|
||||||
ResBufferUpdates, ///< # of unmapped buffer updates
|
|
||||||
ResImageCreations, ///< # of image creations
|
|
||||||
ResImageUpdates, ///< # of unmapped image updates
|
|
||||||
// Do not remove
|
|
||||||
MaxCounterId
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Device statistics
|
|
||||||
*
|
|
||||||
* Stores a bunch of counters that may be useful
|
|
||||||
* for performance evaluation and optimization.
|
|
||||||
*/
|
|
||||||
class DxvkStatCounters {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DxvkStatCounters();
|
|
||||||
~DxvkStatCounters();
|
|
||||||
|
|
||||||
DxvkStatCounters(
|
|
||||||
const DxvkStatCounters& other);
|
|
||||||
|
|
||||||
DxvkStatCounters& operator = (const DxvkStatCounters& other);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Increments a counter by a given value
|
|
||||||
*
|
|
||||||
* \param [in] counter The counter to increment
|
|
||||||
* \param [in] amount Number to add to the counter
|
|
||||||
*/
|
|
||||||
void increment(DxvkStat counter, uint32_t amount) {
|
|
||||||
m_counters[counterId(counter)] += amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Returns a counter
|
|
||||||
*
|
|
||||||
* \param [in] counter The counter to retrieve
|
|
||||||
* \returns Current value of the counter
|
|
||||||
*/
|
|
||||||
uint32_t get(DxvkStat counter) const {
|
|
||||||
return m_counters[counterId(counter)];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Computes delta to a previous state
|
|
||||||
*
|
|
||||||
* \param [in] oldState previous state
|
|
||||||
* \returns Difference to previous state
|
|
||||||
*/
|
|
||||||
DxvkStatCounters delta(
|
|
||||||
const DxvkStatCounters& oldState) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Adds counters from another source
|
|
||||||
*
|
|
||||||
* Adds each counter from the source operand to the
|
|
||||||
* corresponding counter in this set. Useful to merge
|
|
||||||
* context counters and device counters.
|
|
||||||
* \param [in] counters Counters to add
|
|
||||||
*/
|
|
||||||
void addCounters(
|
|
||||||
const DxvkStatCounters& counters);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Clears counters
|
|
||||||
*
|
|
||||||
* Should be used to clear per-context counters.
|
|
||||||
* Do not clear the global device counters.
|
|
||||||
*/
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
std::array<std::atomic<uint32_t>,
|
|
||||||
static_cast<uint32_t>(DxvkStat::MaxCounterId)> m_counters;
|
|
||||||
|
|
||||||
static size_t counterId(DxvkStat counter) {
|
|
||||||
return static_cast<uint32_t>(counter);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@ -40,7 +40,6 @@ dxvk_src = files([
|
|||||||
'dxvk_sampler.cpp',
|
'dxvk_sampler.cpp',
|
||||||
'dxvk_shader.cpp',
|
'dxvk_shader.cpp',
|
||||||
'dxvk_staging.cpp',
|
'dxvk_staging.cpp',
|
||||||
'dxvk_stats.cpp',
|
|
||||||
'dxvk_surface.cpp',
|
'dxvk_surface.cpp',
|
||||||
'dxvk_swapchain.cpp',
|
'dxvk_swapchain.cpp',
|
||||||
'dxvk_sync.cpp',
|
'dxvk_sync.cpp',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user