Пример #1
0
//-----------------------------------------------------------------------------
/// Create a new map to associate a LinkId with profiling results.
/// \param pWrappedQueue The Queue that was submitted in order to retrieve profiling results.
/// \param inThreadId The thread being used to create a results map.
/// \returns A SampleIdToProfilerResultMap instance used to store profiler results.
//-----------------------------------------------------------------------------
SampleIdToProfilerResultMap* VktFrameProfilerLayer::FindOrCreateProfilerResultsMap(VktWrappedQueue* pWrappedQueue, UINT32 inThreadId)
{
    SampleIdToProfilerResultMap* pResultMap = nullptr;

    if (mEntriesWithProfilingResults.count(inThreadId) == 0)
    {
        // make the new map data for this thread
        QueueWrapperToProfilingResultsMap queueMap;
        pResultMap = new SampleIdToProfilerResultMap();
        queueMap.insert(make_pair(pWrappedQueue, pResultMap));
        {
            // Lock before we insert something new into this map.
            ScopeLock profilerResultsLock(&mProfilingResultsMutex);
            mEntriesWithProfilingResults[inThreadId] = queueMap;
        }
    }
    else
    {
        QueueWrapperToProfilingResultsMap& queueMap = mEntriesWithProfilingResults[inThreadId];

        QueueWrapperToProfilingResultsMap::const_iterator queueIt = queueMap.find(pWrappedQueue);

        if (queueIt != queueMap.end())
        {
            return queueIt->second;
        }
        else
        {
            pResultMap = new SampleIdToProfilerResultMap();
            queueMap.insert(make_pair(pWrappedQueue, pResultMap));
        }
    }

    return pResultMap;
}
Пример #2
0
//-----------------------------------------------------------------------------
/// Insert an APIEntry into the list of entries with profiler results.
/// \param pEntry An APIEntry with a sampled GPU time.
//-----------------------------------------------------------------------------
void VktFrameProfilerLayer::StoreProfilerResult(VktAPIEntry* pEntry)
{
    // Need to lock here to control access into our profiling results map
    ScopeLock profilerResultsLock(&mProfilingResultsMutex);

    UINT32 threadId = osGetCurrentThreadId();

    if (mSampleIdToEntry.find(threadId) == mSampleIdToEntry.end())
    {
        // create a new entry
        SampleIdToAPIEntryMap newMap;
        newMap[pEntry->m_sampleId] = pEntry;

        mSampleIdToEntry[threadId] = newMap;
    }
    else
    {
        SampleIdToAPIEntryMap& mapEntry = mSampleIdToEntry[threadId];
        mapEntry[pEntry->m_sampleId] = pEntry;
    }
}
Пример #3
0
//-----------------------------------------------------------------------------
/// Insert an APIEntry into the list of entries with profiler results.
/// \param inEntry An APIEntry with a sampled GPU time.
//-----------------------------------------------------------------------------
void DX12FrameProfilerLayer::StoreProfilerResult(DX12APIEntry* inEntry)
{
    UINT32 threadId = osGetCurrentThreadId();

    if (mSampleIdToEntry.find(threadId) == mSampleIdToEntry.end())
    {
        // create a new entry
        SampleIdToAPIEntryMap newMap;
        newMap[inEntry->mSampleId] = inEntry;

        // adding a new thread to the map so need to lock
        ScopeLock profilerResultsLock(&mProfilingResultsMutex);

        mSampleIdToEntry[threadId] = newMap;
    }
    else
    {
        SampleIdToAPIEntryMap& mapEntry = mSampleIdToEntry[threadId];
        mapEntry[inEntry->mSampleId] = inEntry;
    }
}