Hash :
5c0e6e52
Author :
Date :
2019-11-08T17:05:38
Capture/Replay: Implement more state for mid-execution replay. Includes much more state serialization. Notably Vertex Arrays were missing as well as multiple GL render states. Also fixes many serialization bugs. For example, we would not be using the correct client array and pack/unpack state in the mid-execution capture. Also depth/stencil attachments were missing from the capture. Also fixes the replay sample to work with non-zero starting frames. With these fixes we can run mid-execution replay of the T-Rex demo. Bug: angleproject:3611 Change-Id: I6945eb9b30a5137be996956b43f074a0a750b333 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1895112 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
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
//
// 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 "angle_capture_context1.h"
class CaptureReplaySample : public SampleApplication
{
public:
CaptureReplaySample(int argc, char **argv)
: SampleApplication("CaptureReplaySample", argc, argv, 3, 0)
{}
bool initialize() override
{
// Set CWD to executable directory.
std::string exeDir = angle::GetExecutableDirectory();
if (!angle::SetCWD(exeDir.c_str()))
return false;
SetBinaryDataDir(ANGLE_CAPTURE_REPLAY_SAMPLE_DATA_DIR);
SetupContext1Replay();
eglSwapInterval(getDisplay(), 1);
return true;
}
void destroy() override {}
void draw() override
{
// Compute the current frame, looping from kReplayFrameStart to kReplayFrameEnd.
uint32_t frame =
kReplayFrameStart + (mCurrentFrame % (kReplayFrameEnd - kReplayFrameStart));
ReplayContext1Frame(frame);
mCurrentFrame++;
}
private:
uint32_t mCurrentFrame = 0;
};
int main(int argc, char **argv)
{
CaptureReplaySample app(argc, argv);
return app.run();
}