Edit

kc3-lang/angle/samples/capture_replay/CaptureReplay.cpp

Branch :

  • Show log

    Commit

  • Author : Jamie Madill
    Date : 2019-10-24 12:42:36
    Hash : f251995d
    Message : Capture/Replay: Write capture index file. This file will be used with multi-frame captures to share common code. Common code is global state, resource maps, and a list of frame replay functions. This should make converting a CPP replay into a functional test quite a bit simpler. The replay files will now be something like: angle_capture_context1.cpp angle_capture_context1.h angle_capture_context1_frame000.cpp angle_capture_context1_frame001.cpp ... etc Also adds a template for adding a capture/replay sample. Instructions are located in samples/BUILD.gn and docs in doc/CaptureAndReplay.md. Bug: angleproject:3611 Change-Id: I437b338fd84689d670a7d9e3e219d9334de25fd8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1869543 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>

  • samples/capture_replay/CaptureReplay.cpp
  • //
    // 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, 2, 0)
        {}
    
        bool initialize() override { return true; }
        void destroy() override {}
    
        void draw() override
        {
            ReplayContext1Frame(kReplayFrameStart + (mCurrentFrame % kReplayFrameEnd));
            mCurrentFrame++;
        }
    
      private:
        uint32_t mCurrentFrame = 0;
    };
    
    int main(int argc, char **argv)
    {
        CaptureReplaySample app(argc, argv);
        return app.run();
    }