Hash :
33b9c065
Author :
Date :
2025-03-27T18:22:30
Capture/Replay: Fix sample build It still doesn't correctly run however, it looks like loading the entry points is broken. Bug: angleproject:42264451 Change-Id: I946b07ea622145e62410d9739541e074904b7a6c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6406213 Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
//
// Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CaptureReplay: Template for replaying a frame capture with ANGLE.
#include "SampleApplication.h"
#include <functional>
#include "util/capture/frame_capture_test_utils.h"
class CaptureReplaySample : public SampleApplication
{
public:
CaptureReplaySample(int argc, char **argv, const angle::TraceInfo &traceInfo)
: SampleApplication("CaptureReplaySample",
argc,
argv,
ClientType::ES3_0,
traceInfo.drawSurfaceWidth,
traceInfo.drawSurfaceHeight),
mTraceInfo(traceInfo)
{}
bool initialize() override
{
mTraceLibrary.reset(new angle::TraceLibrary("capture_replay_sample_trace", mTraceInfo, ""));
assert(mTraceLibrary->valid());
std::stringstream binaryPathStream;
binaryPathStream << angle::GetExecutableDirectory() << angle::GetPathSeparator()
<< ANGLE_CAPTURE_REPLAY_SAMPLE_DATA_DIR;
mTraceLibrary->setBinaryDataDir(binaryPathStream.str().c_str());
mTraceLibrary->setupReplay();
return true;
}
void destroy() override { mTraceLibrary->finishReplay(); }
void draw() override
{
// Compute the current frame, looping from frameStart to frameEnd.
uint32_t frame = mTraceInfo.frameStart +
(mCurrentFrame % ((mTraceInfo.frameEnd - mTraceInfo.frameStart) + 1));
if (mPreviousFrame > frame)
{
mTraceLibrary->resetReplay();
}
mTraceLibrary->replayFrame(frame);
mPreviousFrame = frame;
mCurrentFrame++;
}
private:
uint32_t mCurrentFrame = 0;
uint32_t mPreviousFrame = 0;
const angle::TraceInfo mTraceInfo;
std::unique_ptr<angle::TraceLibrary> mTraceLibrary;
};
int main(int argc, char **argv)
{
std::string exeDir = angle::GetExecutableDirectory();
std::stringstream traceJsonPathStream;
traceJsonPathStream << exeDir << angle::GetPathSeparator()
<< ANGLE_CAPTURE_REPLAY_SAMPLE_DATA_DIR << angle::GetPathSeparator()
<< "angle_capture.json";
std::string traceJsonPath = traceJsonPathStream.str();
angle::TraceInfo traceInfo = {};
if (!angle::LoadTraceInfoFromJSON("capture_replay_sample_trace", traceJsonPath, &traceInfo))
{
std::cout << "Unable to load trace data: " << traceJsonPath << "\n";
return 1;
}
CaptureReplaySample app(argc, argv, traceInfo);
return app.run();
}