mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 01:04:36 +00:00
Fix d3d12 gpu zones for multithreaded use
This commit is contained in:
parent
11b11d5f51
commit
391cb4242e
@ -69,7 +69,7 @@ namespace tracy
|
|||||||
|
|
||||||
// In-progress payload.
|
// In-progress payload.
|
||||||
uint32_t m_queryLimit = MaxQueries;
|
uint32_t m_queryLimit = MaxQueries;
|
||||||
uint32_t m_queryCounter = 0;
|
std::atomic<uint32_t> m_queryCounter = 0;
|
||||||
uint32_t m_previousQueryCounter = 0;
|
uint32_t m_previousQueryCounter = 0;
|
||||||
|
|
||||||
uint32_t m_activePayload = 0;
|
uint32_t m_activePayload = 0;
|
||||||
@ -180,7 +180,7 @@ namespace tracy
|
|||||||
void NewFrame()
|
void NewFrame()
|
||||||
{
|
{
|
||||||
m_payloadQueue.emplace(D3D12QueryPayload{ m_previousQueryCounter, m_queryCounter });
|
m_payloadQueue.emplace(D3D12QueryPayload{ m_previousQueryCounter, m_queryCounter });
|
||||||
m_previousQueryCounter += m_queryCounter;
|
m_previousQueryCounter += m_queryCounter.load(std::memory_order::memory_order_acquire);
|
||||||
m_queryCounter = 0;
|
m_queryCounter = 0;
|
||||||
|
|
||||||
if (m_previousQueryCounter >= m_queryLimit)
|
if (m_previousQueryCounter >= m_queryLimit)
|
||||||
@ -297,10 +297,10 @@ namespace tracy
|
|||||||
private:
|
private:
|
||||||
tracy_force_inline uint32_t NextQueryId()
|
tracy_force_inline uint32_t NextQueryId()
|
||||||
{
|
{
|
||||||
assert(m_queryCounter < m_queryLimit && "Submitted too many GPU queries! Consider increasing MaxQueries.");
|
uint32_t localQueryCounter = m_queryCounter.fetch_add(2);
|
||||||
|
assert(localQueryCounter < m_queryLimit && "Submitted too many GPU queries! Consider increasing MaxQueries.");
|
||||||
|
|
||||||
const uint32_t id = (m_previousQueryCounter + m_queryCounter) % m_queryLimit;
|
const uint32_t id = (m_previousQueryCounter + localQueryCounter) % m_queryLimit;
|
||||||
m_queryCounter += 2; // Allocate space for a begin and end query.
|
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user