mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 04:23:51 +00:00
Reverted out-of-order execution sorting
This commit is contained in:
parent
c8bfa43f22
commit
6e03bb1c2c
@ -30,8 +30,6 @@ using TracyD3D12Ctx = void*;
|
|||||||
#include <d3d12.h>
|
#include <d3d12.h>
|
||||||
#include <dxgi.h>
|
#include <dxgi.h>
|
||||||
#include <wrl/client.h>
|
#include <wrl/client.h>
|
||||||
#include <algorithm>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
@ -177,31 +175,9 @@ namespace tracy
|
|||||||
|
|
||||||
auto* timestampData = static_cast<uint64_t*>(readbackBufferMapping);
|
auto* timestampData = static_cast<uint64_t*>(readbackBufferMapping);
|
||||||
|
|
||||||
// First off we need to sort our query data. Without this, out-of-order command list execution (with respect to CPU timeline recording)
|
for (uint32_t index = 0; index < m_queryCounter; ++index)
|
||||||
// would cause view artifacts in the viewer (zones disappear, take up the whole timeline, etc.)
|
|
||||||
|
|
||||||
std::vector<uint64_t> queryData;
|
|
||||||
queryData.resize(m_queryCounter);
|
|
||||||
|
|
||||||
if (m_previousQueryCounter + m_queryCounter <= m_queryLimit) // Make sure we don't need to loop over.
|
|
||||||
{
|
{
|
||||||
std::copy(timestampData + m_previousQueryCounter, timestampData + m_previousQueryCounter + m_queryCounter, queryData.begin());
|
const auto timestamp = timestampData[(m_previousQueryCounter + index) % m_queryLimit];
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const auto firstBatch = (m_previousQueryCounter + m_queryCounter) - m_queryLimit;
|
|
||||||
std::copy(timestampData + m_previousQueryCounter, timestampData + m_queryLimit, queryData.begin());
|
|
||||||
std::copy(timestampData, timestampData + (m_queryCounter - firstBatch), std::next(queryData.begin(), m_queryCounter - firstBatch));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::sort(queryData.begin(), queryData.end(), std::less<uint64_t>{});
|
|
||||||
|
|
||||||
// Data is sorted, send it to the profiler.
|
|
||||||
|
|
||||||
for (uint32_t index = 0; index < queryData.size(); ++index)
|
|
||||||
{
|
|
||||||
const auto timestamp = queryData[index];
|
|
||||||
const auto queryId = m_previousQueryCounter + index;
|
const auto queryId = m_previousQueryCounter + index;
|
||||||
|
|
||||||
auto* item = Profiler::QueueSerial();
|
auto* item = Profiler::QueueSerial();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user