| 20 | } |
| 21 | |
| 22 | void VideoStream::CaptureFrame() |
| 23 | { |
| 24 | int64_t startMicroseconds = mProductionTimer.GetMicroseconds(); |
| 25 | |
| 26 | char* data = GetImage(); |
| 27 | if (data) |
| 28 | { |
| 29 | // The texture is created without system memory. The derived class |
| 30 | // provides this data, so the texture is given temporary access to |
| 31 | // it in order for the Bind(...) call to copy the data to the GPU. |
| 32 | mFrame.image = std::make_shared<Texture2>(mType, mWidth, mHeight, false, false); |
| 33 | mFrame.image->SetData(data); |
| 34 | mEngine->Bind(mFrame.image); |
| 35 | mFrame.image->SetData(nullptr); |
| 36 | } |
| 37 | // else: GetImage has signaled that there is no image available. |
| 38 | |
| 39 | int64_t finalMicroseconds = mProductionTimer.GetMicroseconds(); |
| 40 | mFrame.microseconds = finalMicroseconds - startMicroseconds; |
| 41 | |
| 42 | mPerformanceMicroseconds = mPerformanceTimer.GetMicroseconds(); |
| 43 | ++mPerformanceFrames; |
| 44 | } |
| 45 | |
| 46 | void VideoStream::ResetPerformanceMeasurements() |
| 47 | { |
no test coverage detected