| 434 | } |
| 435 | |
| 436 | void AftermathContext::addMarker(const LowLevelContextData* pLowLevelContextData, std::string_view name) |
| 437 | { |
| 438 | if (!mInitialized) |
| 439 | return; |
| 440 | |
| 441 | #if FALCOR_HAS_D3D12 |
| 442 | if (mpDevice->getType() == Device::Type::D3D12) |
| 443 | { |
| 444 | auto& context = reinterpret_cast<GFSDK_Aftermath_ContextHandle&>(mContextHandle); |
| 445 | ID3D12GraphicsCommandList* pCommandList = pLowLevelContextData->getCommandBufferNativeHandle().as<ID3D12GraphicsCommandList*>(); |
| 446 | GFSDK_Aftermath_Result result; |
| 447 | |
| 448 | if (pCommandList != mpLastCommandList) |
| 449 | { |
| 450 | // TODO should we call |
| 451 | // GFSDK_Aftermath_ReleaseContextHandle(context); |
| 452 | mpLastCommandList = pCommandList; |
| 453 | result = GFSDK_Aftermath_DX12_CreateContextHandle(pCommandList, &context); |
| 454 | if (!GFSDK_Aftermath_SUCCEED(result)) |
| 455 | { |
| 456 | logWarning("Aftermath failed to create context handle: {}", getResultString(result)); |
| 457 | mInitialized = false; |
| 458 | return; |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | result = GFSDK_Aftermath_SetEventMarker(context, name.data(), name.size()); |
| 463 | if (!GFSDK_Aftermath_SUCCEED(result)) |
| 464 | { |
| 465 | logWarning("Aftermath failed to set event marker: {}", getResultString(result)); |
| 466 | mInitialized = false; |
| 467 | return; |
| 468 | } |
| 469 | } |
| 470 | #endif |
| 471 | } |
| 472 | |
| 473 | } // namespace Falcor |
| 474 |
no test coverage detected