MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / CaptureFrame

Method CaptureFrame

GTE/Samples/Imagics/VideoStreams/VideoStream.cpp:22–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22void 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
46void VideoStream::ResetPerformanceMeasurements()
47{

Callers 2

CaptureFrameSerialMethod · 0.80
CaptureFrameParallelMethod · 0.80

Calls 3

SetDataMethod · 0.80
GetMicrosecondsMethod · 0.45
BindMethod · 0.45

Tested by

no test coverage detected