| 46 | } |
| 47 | |
| 48 | GpuTimer::GpuTimer(ref<Device> pDevice) : mpDevice(pDevice) |
| 49 | { |
| 50 | FALCOR_ASSERT(mpDevice); |
| 51 | |
| 52 | mpResolveBuffer = mpDevice->createBuffer(sizeof(uint64_t) * 2, ResourceBindFlags::None, MemoryType::DeviceLocal, nullptr); |
| 53 | mpResolveBuffer->breakStrongReferenceToDevice(); |
| 54 | mpResolveStagingBuffer = mpDevice->createBuffer(sizeof(uint64_t) * 2, ResourceBindFlags::None, MemoryType::ReadBack, nullptr); |
| 55 | mpResolveStagingBuffer->breakStrongReferenceToDevice(); |
| 56 | |
| 57 | // Create timestamp query heap upon first use. |
| 58 | mStart = mpDevice->getTimestampQueryHeap()->allocate(); |
| 59 | mEnd = mpDevice->getTimestampQueryHeap()->allocate(); |
| 60 | if (mStart == QueryHeap::kInvalidIndex || mEnd == QueryHeap::kInvalidIndex) |
| 61 | { |
| 62 | FALCOR_THROW("Can't create GPU timer, no available timestamp queries."); |
| 63 | } |
| 64 | FALCOR_ASSERT(mEnd == (mStart + 1)); |
| 65 | } |
| 66 | |
| 67 | GpuTimer::~GpuTimer() |
| 68 | { |
nothing calls this directly
no test coverage detected