Hash :
52152933
        
        Author :
  
        
        Date :
2023-06-06T15:36:36
        
      
Add trace_interface: functions and callbacks for traces Defines the interface between the test suite (or an other TraceLibrary class user) and trace libraries. TraceFunctions defines entry points for calls suite->trace, such as SetupReplay() or SetBinaryDataDir(). TraceCallbacks defines entry points for calls trace->suite, for example for loading .angledata.gz files. These are set up via the exported SetupEntryPoints() call. Functions like SetupReplay etc no longer need to be exported from the trace library. TraceInfo (parsed representation of the trace json) is moved to trace_interface as is. This is convenient for further changes to the fixture that will allow to easily move some of the captured parameters to json. This also moves Decompress functionality (and memory ownership) to test suite entirely, which avoids Decompress/Delete callbacks - the trace just calls LoadBinaryData via TraceCallbacks and TraceLibrary releases the memory either on FinishReplay or in its destructor. This should also take care of the memory leak described in https://crrev.com/c/3858185 Bug: b/286072760 Change-Id: Ibc6f6f64156ad805b1917c8fc41a3b0d2c0d6375 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4594445 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Cody Northrop <cnorthrop@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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
//
// Copyright 2023 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.
//
// trace_interface:
//   Interface shared between trace libraries and the test suite.
//
#ifndef UTIL_CAPTURE_TRACE_INTERFACE_H_
#define UTIL_CAPTURE_TRACE_INTERFACE_H_
#include <string>
#include <vector>
namespace angle
{
static constexpr size_t kTraceInfoMaxNameLen = 128;
struct TraceInfo
{
    char name[kTraceInfoMaxNameLen];
    bool initialized = false;
    uint32_t contextClientMajorVersion;
    uint32_t contextClientMinorVersion;
    uint32_t frameStart;
    uint32_t frameEnd;
    uint32_t drawSurfaceWidth;
    uint32_t drawSurfaceHeight;
    uint32_t drawSurfaceColorSpace;
    uint32_t displayPlatformType;
    uint32_t displayDeviceType;
    int configRedBits;
    int configBlueBits;
    int configGreenBits;
    int configAlphaBits;
    int configDepthBits;
    int configStencilBits;
    bool isBinaryDataCompressed;
    bool areClientArraysEnabled;
    bool isBindGeneratesResourcesEnabled;
    bool isWebGLCompatibilityEnabled;
    bool isRobustResourceInitEnabled;
    std::vector<std::string> traceFiles;
    int windowSurfaceContextId;
    std::vector<std::string> requiredExtensions;
    std::vector<int> keyFrames;
};
// Test suite calls into the trace library (fixture).
struct TraceFunctions
{
    virtual void SetupReplay()                    = 0;
    virtual void ReplayFrame(uint32_t frameIndex) = 0;
    virtual void ResetReplay()                    = 0;
    virtual void FinishReplay()                   = 0;
    virtual void SetBinaryDataDir(const char *dataDir) = 0;
    virtual void SetTraceInfo(const TraceInfo &traceInfo);
    virtual void SetTraceGzPath(const std::string &traceGzPath);
    virtual ~TraceFunctions() {}
};
// Trace library (fixture) calls into the test suite.
struct TraceCallbacks
{
    virtual uint8_t *LoadBinaryData(const char *fileName) = 0;
    virtual ~TraceCallbacks() {}
};
}  // namespace angle
#endif  // UTIL_CAPTURE_TRACE_INTERFACE_H_