| 318 | } |
| 319 | |
| 320 | void Profiler::startEvent(RenderContext* pRenderContext, const std::string& name, Flags flags) |
| 321 | { |
| 322 | if (mEnabled && is_set(flags, Flags::Internal)) |
| 323 | { |
| 324 | // '/' is used as a "path delimiter", so it cannot be used in the event name. |
| 325 | if (name.find('/') != std::string::npos) |
| 326 | { |
| 327 | logWarning("Profiler event names must not contain '/'. Ignoring this profiler event."); |
| 328 | return; |
| 329 | } |
| 330 | |
| 331 | mCurrentEventName = mCurrentEventName + "/" + name; |
| 332 | |
| 333 | Event* pEvent = getEvent(mCurrentEventName); |
| 334 | FALCOR_ASSERT(pEvent != nullptr); |
| 335 | if (!mPaused) |
| 336 | pEvent->start(*this, mFrameIndex); |
| 337 | |
| 338 | if (std::find(mCurrentFrameEvents.begin(), mCurrentFrameEvents.end(), pEvent) == mCurrentFrameEvents.end()) |
| 339 | { |
| 340 | mCurrentFrameEvents.push_back(pEvent); |
| 341 | } |
| 342 | } |
| 343 | if (is_set(flags, Flags::Pix)) |
| 344 | { |
| 345 | FALCOR_ASSERT(pRenderContext); |
| 346 | pRenderContext->getLowLevelData()->beginDebugEvent(name.c_str()); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | void Profiler::endEvent(RenderContext* pRenderContext, const std::string& name, Flags flags) |
| 351 | { |