chromium/third_party/angle/src/libANGLE/capture/FrameCapture.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.
//
// FrameCapture.cpp:
//   ANGLE Frame capture implementation.
//

#include "libANGLE/capture/FrameCapture.h"

#include <cerrno>
#include <cstring>
#include <fstream>
#include <queue>
#include <string>

#include "sys/stat.h"

#include "common/aligned_memory.h"
#include "common/angle_version_info.h"
#include "common/frame_capture_utils.h"
#include "common/gl_enum_utils.h"
#include "common/mathutil.h"
#include "common/serializer/JsonSerializer.h"
#include "common/string_utils.h"
#include "common/system_utils.h"
#include "gpu_info_util/SystemInfo.h"
#include "image_util/storeimage.h"
#include "libANGLE/Config.h"
#include "libANGLE/Context.h"
#include "libANGLE/Context.inl.h"
#include "libANGLE/Display.h"
#include "libANGLE/EGLSync.h"
#include "libANGLE/Fence.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/GLES1Renderer.h"
#include "libANGLE/Query.h"
#include "libANGLE/ResourceMap.h"
#include "libANGLE/Shader.h"
#include "libANGLE/Surface.h"
#include "libANGLE/VertexArray.h"
#include "libANGLE/capture/capture_egl_autogen.h"
#include "libANGLE/capture/capture_gles_1_0_autogen.h"
#include "libANGLE/capture/capture_gles_2_0_autogen.h"
#include "libANGLE/capture/capture_gles_3_0_autogen.h"
#include "libANGLE/capture/capture_gles_3_1_autogen.h"
#include "libANGLE/capture/capture_gles_3_2_autogen.h"
#include "libANGLE/capture/capture_gles_ext_autogen.h"
#include "libANGLE/capture/serialize.h"
#include "libANGLE/entry_points_utils.h"
#include "libANGLE/queryconversions.h"
#include "libANGLE/queryutils.h"
#include "libANGLE/renderer/driver_utils.h"
#include "libANGLE/validationEGL.h"
#include "third_party/ceval/ceval.h"

#define USE_SYSTEM_ZLIB
#include "compression_utils_portable.h"

#if !ANGLE_CAPTURE_ENABLED
#    error Frame capture must be enabled to include this file.
#endif  // !ANGLE_CAPTURE_ENABLED

namespace angle
{
namespace
{

// TODO: Consolidate to C output and remove option. http://anglebug.com/42266223

constexpr char kEnabledVarName[]        =;
constexpr char kOutDirectoryVarName[]   =;
constexpr char kFrameStartVarName[]     =;
constexpr char kFrameEndVarName[]       =;
constexpr char kTriggerVarName[]        =;
constexpr char kCaptureLabelVarName[]   =;
constexpr char kCompressionVarName[]    =;
constexpr char kSerializeStateVarName[] =;
constexpr char kValidationVarName[]     =;
constexpr char kValidationExprVarName[] =;
constexpr char kSourceExtVarName[]      =;
constexpr char kSourceSizeVarName[]     =;
constexpr char kForceShadowVarName[]    =;

constexpr size_t kBinaryAlignment   =;
constexpr size_t kFunctionSizeLimit =;

// Limit based on MSVC Compiler Error C2026
constexpr size_t kStringLengthLimit =;

// Default limit to number of bytes in a capture source files.
constexpr char kDefaultSourceFileExt[]           =;
constexpr size_t kDefaultSourceFileSizeThreshold =;

// Android debug properties that correspond to the above environment variables
constexpr char kAndroidEnabled[]        =;
constexpr char kAndroidOutDir[]         =;
constexpr char kAndroidFrameStart[]     =;
constexpr char kAndroidFrameEnd[]       =;
constexpr char kAndroidTrigger[]        =;
constexpr char kAndroidCaptureLabel[]   =;
constexpr char kAndroidCompression[]    =;
constexpr char kAndroidValidation[]     =;
constexpr char kAndroidValidationExpr[] =;
constexpr char kAndroidSourceExt[]      =;
constexpr char kAndroidSourceSize[]     =;
constexpr char kAndroidForceShadow[]    =;

struct FramebufferCaptureFuncs
{};

struct VertexArrayCaptureFuncs
{};

std::string GetDefaultOutDirectory()
{}

std::string GetCaptureTrigger()
{}

std::ostream &operator<<(std::ostream &os, gl::ContextID contextId)
{}

// Used to indicate that "shared" should be used to identify the files.
constexpr gl::ContextID kSharedContextId =;
// Used to indicate no context ID should be output.
constexpr gl::ContextID kNoContextId =;

struct FmtCapturePrefix
{};

std::ostream &operator<<(std::ostream &os, const FmtCapturePrefix &fmt)
{}

enum class ReplayFunc
{};

constexpr uint32_t kNoPartId =;

// In C, when you declare or define a function that takes no parameters, you must explicitly say the
// function takes "void" parameters. When you're calling the function you omit this void. It's
// therefore necessary to know how we're using a function to know if we should emi the "void".
enum FuncUsage
{};

std::ostream &operator<<(std::ostream &os, FuncUsage usage)
{}

struct FmtReplayFunction
{};

std::ostream &operator<<(std::ostream &os, const FmtReplayFunction &fmt)
{}

struct FmtSetupFunction
{};

std::ostream &operator<<(std::ostream &os, const FmtSetupFunction &fmt)
{}

struct FmtSetupInactiveFunction
{};

std::ostream &operator<<(std::ostream &os, const FmtSetupInactiveFunction &fmt)
{}

struct FmtResetFunction
{};

std::ostream &operator<<(std::ostream &os, const FmtResetFunction &fmt)
{}

struct FmtFunction
{};

std::ostream &operator<<(std::ostream &os, const FmtFunction &fmt)
{}

struct FmtGetSerializedContextStateFunction
{};

std::ostream &operator<<(std::ostream &os, const FmtGetSerializedContextStateFunction &fmt)
{}

void WriteGLFloatValue(std::ostream &out, GLfloat value)
{}

template <typename T, typename CastT = T>
void WriteInlineData(const std::vector<uint8_t> &vec, std::ostream &out)
{}

template <>
void WriteInlineData<GLchar>(const std::vector<uint8_t> &vec, std::ostream &out)
{}

// For compatibility with C, which does not have multi-line string literals, we break strings up
// into multiple lines like:
//
//   const char *str[] = {
//   "multiple\n"
//   "line\n"
//   "strings may have \"quotes\"\n"
//   "and \\slashes\\\n",
//   };
//
// Note we need to emit extra escapes to ensure quotes and other special characters are preserved.
struct FmtMultiLineString
{};

std::string EscapeString(const std::string &string)
{}

std::ostream &operator<<(std::ostream &ostr, const FmtMultiLineString &fmt)
{}

void WriteStringParamReplay(ReplayWriter &replayWriter,
                            std::ostream &out,
                            std::ostream &header,
                            const CallCapture &call,
                            const ParamCapture &param,
                            std::vector<uint8_t> *binaryData)
{}

void WriteStringPointerParamReplay(ReplayWriter &replayWriter,
                                   std::ostream &out,
                                   std::ostream &header,
                                   const CallCapture &call,
                                   const ParamCapture &param)
{}

enum class Indent
{};

void UpdateResourceIDBuffer(std::ostream &out,
                            Indent indent,
                            size_t bufferIndex,
                            const char *mapName,
                            GLuint resourceID)
{}

template <typename ParamT>
void WriteResourceIDPointerParamReplay(ReplayWriter &replayWriter,
                                       std::ostream &out,
                                       std::ostream &header,
                                       const CallCapture &call,
                                       const ParamCapture &param,
                                       size_t *maxResourceIDBufferSize)
{}

void WriteBinaryParamReplay(ReplayWriter &replayWriter,
                            std::ostream &out,
                            std::ostream &header,
                            const CallCapture &call,
                            const ParamCapture &param,
                            std::vector<uint8_t> *binaryData)
{}

void WriteComment(std::ostream &out, const CallCapture &call)
{}

void WriteCppReplayForCall(const CallCapture &call,
                           ReplayWriter &replayWriter,
                           std::ostream &out,
                           std::ostream &header,
                           std::vector<uint8_t> *binaryData,
                           size_t *maxResourceIDBufferSize)
{}

void AddComment(std::vector<CallCapture> *outCalls, const std::string &comment)
{}

size_t MaxClientArraySize(const gl::AttribArray<size_t> &clientArraySizes)
{}

std::string GetBinaryDataFilePath(bool compression, const std::string &captureLabel)
{}

struct SaveFileHelper
{};

void SaveBinaryData(bool compression,
                    const std::string &outDir,
                    gl::ContextID contextId,
                    const std::string &captureLabel,
                    const std::vector<uint8_t> &binaryData)
{}

void WriteInitReplayCall(bool compression,
                         std::ostream &out,
                         gl::ContextID contextID,
                         const std::string &captureLabel,
                         size_t maxClientArraySize,
                         size_t readBufferSize,
                         size_t resourceIDBufferSize,
                         const PackedEnumMap<ResourceIDType, uint32_t> &maxIDs)
{}

void DeleteResourcesInReset(std::stringstream &out,
                            const ResourceSet &newResources,
                            const ResourceSet &resourcesToDelete,
                            const char *resourceName,
                            size_t *maxResourceIDBufferSize)
{}

// TODO (http://anglebug.com/42263204): Reset more state on frame loop
void MaybeResetResources(egl::Display *display,
                         gl::ContextID contextID,
                         ResourceIDType resourceIDType,
                         ReplayWriter &replayWriter,
                         std::stringstream &out,
                         std::stringstream &header,
                         ResourceTracker *resourceTracker,
                         std::vector<uint8_t> *binaryData,
                         bool &anyResourceReset,
                         size_t *maxResourceIDBufferSize)
{}

void MaybeResetFenceSyncObjects(std::stringstream &out,
                                ReplayWriter &replayWriter,
                                std::stringstream &header,
                                ResourceTracker *resourceTracker,
                                std::vector<uint8_t> *binaryData,
                                size_t *maxResourceIDBufferSize)
{}

void Capture(std::vector<CallCapture> *setupCalls, CallCapture &&call)
{}

void CaptureUpdateCurrentProgram(const CallCapture &call,
                                 int programParamPos,
                                 std::vector<CallCapture> *callsOut)
{}

bool ProgramNeedsReset(const gl::Context *context,
                       ResourceTracker *resourceTracker,
                       gl::ShaderProgramID programID)
{}

void MaybeResetDefaultUniforms(std::stringstream &out,
                               ReplayWriter &replayWriter,
                               std::stringstream &header,
                               const gl::Context *context,
                               ResourceTracker *resourceTracker,
                               std::vector<uint8_t> *binaryData,
                               size_t *maxResourceIDBufferSize)
{}

void MaybeResetOpaqueTypeObjects(ReplayWriter &replayWriter,
                                 std::stringstream &out,
                                 std::stringstream &header,
                                 const gl::Context *context,
                                 ResourceTracker *resourceTracker,
                                 std::vector<uint8_t> *binaryData,
                                 size_t *maxResourceIDBufferSize)
{}

void MaybeResetContextState(ReplayWriter &replayWriter,
                            std::stringstream &out,
                            std::stringstream &header,
                            ResourceTracker *resourceTracker,
                            const gl::Context *context,
                            std::vector<uint8_t> *binaryData,
                            StateResetHelper &stateResetHelper,
                            size_t *maxResourceIDBufferSize)
{}

void MarkResourceIDActive(ResourceIDType resourceType,
                          GLuint id,
                          std::vector<CallCapture> *setupCalls,
                          const ResourceIDToSetupCallsMap *resourceIDToSetupCallsMap)
{}

// Some replay functions can get quite large. If over a certain size, this method breaks up the
// function into parts to avoid overflowing the stack and causing slow compilation.
void WriteCppReplayFunctionWithParts(const gl::ContextID contextID,
                                     ReplayFunc replayFunc,
                                     ReplayWriter &replayWriter,
                                     uint32_t frameIndex,
                                     std::vector<uint8_t> *binaryData,
                                     const std::vector<CallCapture> &calls,
                                     std::stringstream &header,
                                     std::stringstream &out,
                                     size_t *maxResourceIDBufferSize)
{}

// Performance can be gained by reordering traced calls and grouping them by context.
// Side context calls (as opposed to main context) can be grouped together paying attention
// to synchronization points in the original call stream.
void WriteCppReplayFunctionWithPartsMultiContext(const gl::ContextID contextID,
                                                 ReplayFunc replayFunc,
                                                 ReplayWriter &replayWriter,
                                                 uint32_t frameIndex,
                                                 std::vector<uint8_t> *binaryData,
                                                 std::vector<CallCapture> &calls,
                                                 std::stringstream &header,
                                                 std::stringstream &out,
                                                 size_t *maxResourceIDBufferSize)
{}

// Auxiliary contexts are other contexts in the share group that aren't the context calling
// eglSwapBuffers().
void WriteAuxiliaryContextCppSetupReplay(ReplayWriter &replayWriter,
                                         bool compression,
                                         const std::string &outDir,
                                         const gl::Context *context,
                                         const std::string &captureLabel,
                                         uint32_t frameIndex,
                                         const std::vector<CallCapture> &setupCalls,
                                         std::vector<uint8_t> *binaryData,
                                         bool serializeStateEnabled,
                                         const FrameCaptureShared &frameCaptureShared,
                                         size_t *maxResourceIDBufferSize)
{}

void WriteShareGroupCppSetupReplay(ReplayWriter &replayWriter,
                                   bool compression,
                                   const std::string &outDir,
                                   const std::string &captureLabel,
                                   uint32_t frameIndex,
                                   uint32_t frameCount,
                                   const std::vector<CallCapture> &setupCalls,
                                   ResourceTracker *resourceTracker,
                                   std::vector<uint8_t> *binaryData,
                                   bool serializeStateEnabled,
                                   gl::ContextID windowSurfaceContextID,
                                   size_t *maxResourceIDBufferSize)
{}

ProgramSources GetAttachedProgramSources(const gl::Context *context, const gl::Program *program)
{}

template <typename IDType>
void CaptureUpdateResourceIDs(const gl::Context *context,
                              const CallCapture &call,
                              const ParamCapture &param,
                              ResourceTracker *resourceTracker,
                              std::vector<CallCapture> *callsOut)
{}

void CaptureUpdateUniformLocations(const gl::Program *program, std::vector<CallCapture> *callsOut)
{}

void CaptureValidateSerializedState(const gl::Context *context, std::vector<CallCapture> *callsOut)
{}

void CaptureUpdateUniformBlockIndexes(const gl::Program *program,
                                      std::vector<CallCapture> *callsOut)
{}

void CaptureDeleteUniformLocations(gl::ShaderProgramID program, std::vector<CallCapture> *callsOut)
{}

void MaybeCaptureUpdateResourceIDs(const gl::Context *context,
                                   ResourceTracker *resourceTracker,
                                   std::vector<CallCapture> *callsOut)
{}

bool IsDefaultCurrentValue(const gl::VertexAttribCurrentValueData &currentValue)
{}

bool IsQueryActive(const gl::State &glState, gl::QueryID &queryID)
{}

bool IsTextureUpdate(CallCapture &call)
{}

bool IsImageUpdate(CallCapture &call)
{}

bool IsVertexArrayUpdate(CallCapture &call)
{}

bool IsSharedObjectResource(ResourceIDType type)
{}

enum class DefaultUniformType
{};

DefaultUniformType GetDefaultUniformType(const CallCapture &call)
{}

void CaptureFramebufferAttachment(std::vector<CallCapture> *setupCalls,
                                  const gl::State &replayState,
                                  const FramebufferCaptureFuncs &framebufferFuncs,
                                  const gl::FramebufferAttachment &attachment,
                                  std::vector<CallCapture> *shareGroupSetupCalls,
                                  ResourceIDToSetupCallsMap *resourceIDToSetupCalls)
{}

void CaptureUpdateUniformValues(const gl::State &replayState,
                                const gl::Context *context,
                                gl::Program *program,
                                ResourceTracker *resourceTracker,
                                std::vector<CallCapture> *callsOut)
{}

void CaptureVertexPointerES1(std::vector<CallCapture> *setupCalls,
                             gl::State *replayState,
                             GLuint attribIndex,
                             const gl::VertexAttribute &attrib,
                             const gl::VertexBinding &binding)
{}

void CaptureTextureEnvironmentState(std::vector<CallCapture> *setupCalls,
                                    gl::State *replayState,
                                    const gl::State *apiState,
                                    unsigned int unit)
{}

bool VertexBindingMatchesAttribStride(const gl::VertexAttribute &attrib,
                                      const gl::VertexBinding &binding)
{}

void CaptureVertexArrayState(std::vector<CallCapture> *setupCalls,
                             const gl::Context *context,
                             const gl::VertexArray *vertexArray,
                             gl::State *replayState)
{}

void CaptureTextureStorage(std::vector<CallCapture> *setupCalls,
                           gl::State *replayState,
                           const gl::Texture *texture)
{}

void CaptureTextureContents(std::vector<CallCapture> *setupCalls,
                            gl::State *replayState,
                            const gl::Texture *texture,
                            const gl::ImageIndex &index,
                            const gl::ImageDesc &desc,
                            GLuint size,
                            const void *data)
{}

void CaptureCustomUniformBlockBinding(const CallCapture &callIn, std::vector<CallCapture> &callsOut)
{}

void CaptureCustomMapBuffer(const char *entryPointName,
                            CallCapture &call,
                            std::vector<CallCapture> &callsOut,
                            gl::BufferID mappedBufferID)
{}

void CaptureCustomShaderProgram(const char *name,
                                CallCapture &call,
                                std::vector<CallCapture> &callsOut)
{}

void CaptureCustomFenceSync(CallCapture &call, std::vector<CallCapture> &callsOut)
{}

const egl::Image *GetImageFromParam(const gl::Context *context, const ParamCapture &param)
{}

void CaptureCustomCreateEGLImage(const gl::Context *context,
                                 const char *name,
                                 size_t width,
                                 size_t height,
                                 CallCapture &call,
                                 std::vector<CallCapture> &callsOut)
{}

void CaptureCustomDestroyEGLImage(const char *name,
                                  CallCapture &call,
                                  std::vector<CallCapture> &callsOut)
{}

void CaptureCustomCreateEGLSync(const char *name,
                                CallCapture &call,
                                std::vector<CallCapture> &callsOut)
{}

void CaptureCustomCreatePbufferSurface(CallCapture &call, std::vector<CallCapture> &callsOut)
{}

void CaptureCustomCreateNativeClientbuffer(CallCapture &call, std::vector<CallCapture> &callsOut)
{}

void GenerateLinkedProgram(const gl::Context *context,
                           const gl::State &replayState,
                           ResourceTracker *resourceTracker,
                           std::vector<CallCapture> *setupCalls,
                           gl::Program *program,
                           gl::ShaderProgramID id,
                           gl::ShaderProgramID tempIDStart,
                           const ProgramSources &linkedSources)
{}

// TODO(http://anglebug.com/42263204): Improve reset/restore call generation
// There are multiple ways to track reset calls for individual resources. For now, we are tracking
// separate lists of instructions that mirror the calls created during mid-execution setup. Other
// methods could involve passing the original CallCaptures to this function, or tracking the
// indices of original setup calls.
void CaptureBufferResetCalls(const gl::Context *context,
                             const gl::State &replayState,
                             ResourceTracker *resourceTracker,
                             gl::BufferID *id,
                             const gl::Buffer *buffer)
{}

void CaptureFenceSyncResetCalls(const gl::Context *context,
                                const gl::State &replayState,
                                ResourceTracker *resourceTracker,
                                gl::SyncID syncID,
                                GLsync syncObject,
                                const gl::Sync *sync)
{}

void CaptureEGLSyncResetCalls(const gl::Context *context,
                              const gl::State &replayState,
                              ResourceTracker *resourceTracker,
                              egl::SyncID eglSyncID,
                              EGLSync eglSyncObject,
                              const egl::Sync *eglSync)
{}

void CaptureBufferBindingResetCalls(const gl::State &replayState,
                                    ResourceTracker *resourceTracker,
                                    gl::BufferBinding binding,
                                    gl::BufferID id)
{}

void CaptureIndexedBuffers(const gl::State &glState,
                           const gl::BufferVector &indexedBuffers,
                           gl::BufferBinding binding,
                           std::vector<CallCapture> *setupCalls)
{}

void CaptureDefaultVertexAttribs(const gl::State &replayState,
                                 const gl::State &apiState,
                                 std::vector<CallCapture> *setupCalls)
{}

void CompressPalettedTexture(angle::MemoryBuffer &data,
                             angle::MemoryBuffer &tmp,
                             const gl::InternalFormat &compressedFormat,
                             const gl::Extents &extents)
{}

// Capture the setup of the state that's shared by all of the contexts in the share group
// See IsSharedObjectResource for the list of objects covered here.
void CaptureShareGroupMidExecutionSetup(
    gl::Context *context,
    std::vector<CallCapture> *setupCalls,
    ResourceTracker *resourceTracker,
    gl::State &replayState,
    const PackedEnumMap<ResourceIDType, uint32_t> &maxAccessedResourceIDs)
{}

void CaptureMidExecutionSetup(const gl::Context *context,
                              std::vector<CallCapture> *setupCalls,
                              StateResetHelper &resetHelper,
                              std::vector<CallCapture> *shareGroupSetupCalls,
                              ResourceIDToSetupCallsMap *resourceIDToSetupCalls,
                              ResourceTracker *resourceTracker,
                              gl::State &replayState,
                              bool validationEnabled)
{}

bool SkipCall(EntryPoint entryPoint)
{}

std::string GetBaseName(const std::string &nameWithPath)
{}
}  // namespace

FrameCapture::FrameCapture()  = default;
FrameCapture::~FrameCapture() = default;

void FrameCapture::reset()
{}

FrameCaptureShared::FrameCaptureShared()
    :{}

FrameCaptureShared::~FrameCaptureShared() = default;

PageRange::PageRange(size_t start, size_t end) :{}
PageRange::~PageRange() = default;

AddressRange::AddressRange() {}
AddressRange::AddressRange(uintptr_t start, size_t size) :{}
AddressRange::~AddressRange() = default;

uintptr_t AddressRange::end()
{}

CoherentBuffer::CoherentBuffer(uintptr_t start,
                               size_t size,
                               size_t pageSize,
                               bool isShadowMemoryEnabled)
    :{}

std::vector<PageRange> CoherentBuffer::getDirtyPageRanges()
{}

AddressRange CoherentBuffer::getRange()
{}

AddressRange CoherentBuffer::getDirtyAddressRange(const PageRange &dirtyPageRange)
{}

CoherentBuffer::~CoherentBuffer()
{}

bool CoherentBuffer::isDirty()
{}

bool CoherentBuffer::contains(size_t page, size_t *relativePage)
{}

void CoherentBuffer::protectPageRange(const PageRange &pageRange)
{}

void CoherentBuffer::protectAll()
{}

void CoherentBuffer::updateBufferMemory()
{}

void CoherentBuffer::updateShadowMemory()
{}

void CoherentBuffer::setDirty(size_t relativePage, bool dirty)
{}

void CoherentBuffer::removeProtection(PageSharingType sharingType)
{}

bool CoherentBufferTracker::canProtectDirectly(gl::Context *context)
{}

CoherentBufferTracker::CoherentBufferTracker() :{}

CoherentBufferTracker::~CoherentBufferTracker()
{}

PageFaultHandlerRangeType CoherentBufferTracker::handleWrite(uintptr_t address)
{}

HashMap<std::shared_ptr<CoherentBuffer>, size_t> CoherentBufferTracker::getBufferPagesForAddress(
    uintptr_t address)
{}

bool CoherentBufferTracker::isDirty(gl::BufferID id)
{}

void CoherentBufferTracker::enable()
{}

bool CoherentBufferTracker::haveBuffer(gl::BufferID id)
{}

void CoherentBufferTracker::onEndFrame()
{}

void CoherentBufferTracker::disable()
{}

uintptr_t CoherentBufferTracker::addBuffer(gl::BufferID id, uintptr_t start, size_t size)
{}

void CoherentBufferTracker::maybeUpdateShadowMemory()
{}

void CoherentBufferTracker::markAllShadowDirty()
{}

PageSharingType CoherentBufferTracker::doesBufferSharePage(gl::BufferID id)
{}

void CoherentBufferTracker::removeBuffer(gl::BufferID id)
{}

void *FrameCaptureShared::maybeGetShadowMemoryPointer(gl::Buffer *buffer,
                                                      GLsizeiptr length,
                                                      GLbitfield access)
{}

void FrameCaptureShared::determineMemoryProtectionSupport(gl::Context *context)
{}

void FrameCaptureShared::trackBufferMapping(const gl::Context *context,
                                            CallCapture *call,
                                            gl::BufferID id,
                                            gl::Buffer *buffer,
                                            GLintptr offset,
                                            GLsizeiptr length,
                                            bool writable,
                                            bool coherent)
{}

void FrameCaptureShared::trackTextureUpdate(const gl::Context *context, const CallCapture &call)
{}

// Identify and mark writeable shader image textures as modified
void FrameCaptureShared::trackImageUpdate(const gl::Context *context, const CallCapture &call)
{}

void FrameCaptureShared::trackDefaultUniformUpdate(const gl::Context *context,
                                                   const CallCapture &call)
{}

void FrameCaptureShared::trackVertexArrayUpdate(const gl::Context *context, const CallCapture &call)
{}

void FrameCaptureShared::updateCopyImageSubData(CallCapture &call)
{}

void FrameCaptureShared::overrideProgramBinary(const gl::Context *context,
                                               CallCapture &inCall,
                                               std::vector<CallCapture> &outCalls)
{}

void FrameCaptureShared::captureCustomMapBufferFromContext(const gl::Context *context,
                                                           const char *entryPointName,
                                                           CallCapture &call,
                                                           std::vector<CallCapture> &callsOut)
{}

void FrameCaptureShared::maybeOverrideEntryPoint(const gl::Context *context,
                                                 CallCapture &inCall,
                                                 std::vector<CallCapture> &outCalls)
{}

void FrameCaptureShared::maybeCaptureCoherentBuffers(const gl::Context *context)
{}

void FrameCaptureShared::maybeCaptureDrawArraysClientData(const gl::Context *context,
                                                          CallCapture &call,
                                                          size_t instanceCount)
{}

void FrameCaptureShared::maybeCaptureDrawElementsClientData(const gl::Context *context,
                                                            CallCapture &call,
                                                            size_t instanceCount)
{}

template <typename AttribT, typename FactoryT>
void CreateEGLImagePreCallUpdate(const CallCapture &call,
                                 ResourceTracker &resourceTracker,
                                 ParamType paramType,
                                 FactoryT factory)
{}

void FrameCaptureShared::maybeCapturePreCallUpdates(
    const gl::Context *context,
    CallCapture &call,
    std::vector<CallCapture> *shareGroupSetupCalls,
    ResourceIDToSetupCallsMap *resourceIDToSetupCalls)
{}

template <typename ParamValueType>
void FrameCaptureShared::maybeGenResourceOnBind(const gl::Context *context, CallCapture &call)
{}

void FrameCaptureShared::updateResourceCountsFromParamCapture(const ParamCapture &param,
                                                              ResourceIDType idType)
{}

void FrameCaptureShared::updateResourceCountsFromCallCapture(const CallCapture &call)
{}

void FrameCaptureShared::captureCall(gl::Context *context, CallCapture &&inCall, bool isCallValid)
{}

void FrameCaptureShared::maybeCapturePostCallUpdates(const gl::Context *context)
{}

void FrameCaptureShared::captureClientArraySnapshot(const gl::Context *context,
                                                    size_t vertexCount,
                                                    size_t instanceCount)
{}

void FrameCaptureShared::captureCoherentBufferSnapshot(const gl::Context *context, gl::BufferID id)
{}

void FrameCaptureShared::captureMappedBufferSnapshot(const gl::Context *context,
                                                     const CallCapture &call)
{}

void FrameCaptureShared::checkForCaptureTrigger()
{}

void FrameCaptureShared::scanSetupCalls(std::vector<CallCapture> &setupCalls)
{}

void FrameCaptureShared::runMidExecutionCapture(gl::Context *mainContext)
{}

void FrameCaptureShared::onEndFrame(gl::Context *context)
{}

void FrameCaptureShared::onDestroyContext(const gl::Context *context)
{}

void FrameCaptureShared::onMakeCurrent(const gl::Context *context, const egl::Surface *drawSurface)
{}

DataCounters::DataCounters() = default;

DataCounters::~DataCounters() = default;

int DataCounters::getAndIncrement(EntryPoint entryPoint, const std::string &paramName)
{}

DataTracker::DataTracker() = default;

DataTracker::~DataTracker() = default;

StringCounters::StringCounters() = default;

StringCounters::~StringCounters() = default;

int StringCounters::getStringCounter(const std::vector<std::string> &strings)
{}

void StringCounters::setStringCounter(const std::vector<std::string> &strings, int &counter)
{}

TrackedResource::TrackedResource() = default;

TrackedResource::~TrackedResource() = default;

ResourceTracker::ResourceTracker() = default;

ResourceTracker::~ResourceTracker() = default;

StateResetHelper::StateResetHelper() = default;

StateResetHelper::~StateResetHelper() = default;

void StateResetHelper::setDefaultResetCalls(const gl::Context *context,
                                            angle::EntryPoint entryPoint)
{}

void ResourceTracker::setDeletedFenceSync(gl::SyncID sync)
{}

void ResourceTracker::setModifiedDefaultUniform(gl::ShaderProgramID programID,
                                                gl::UniformLocation location)
{}

void ResourceTracker::setDefaultUniformBaseLocation(gl::ShaderProgramID programID,
                                                    gl::UniformLocation location,
                                                    gl::UniformLocation baseLocation)
{}

TrackedResource &ResourceTracker::getTrackedResource(gl::ContextID contextID, ResourceIDType type)
{}

void ResourceTracker::getContextIDs(std::set<gl::ContextID> &idsOut)
{}

void TrackedResource::setGennedResource(GLuint id)
{}

bool TrackedResource::resourceIsGenerated(GLuint id)
{}

void TrackedResource::setDeletedResource(GLuint id)
{}

void TrackedResource::setModifiedResource(GLuint id)
{}

void ResourceTracker::setBufferMapped(gl::ContextID contextID, GLuint id)
{}

void ResourceTracker::setBufferUnmapped(gl::ContextID contextID, GLuint id)
{}

bool ResourceTracker::getStartingBuffersMappedCurrent(GLuint id) const
{}

bool ResourceTracker::getStartingBuffersMappedInitial(GLuint id) const
{}

void ResourceTracker::onShaderProgramAccess(gl::ShaderProgramID shaderProgramID)
{}

bool FrameCaptureShared::isCapturing() const
{}

uint32_t FrameCaptureShared::getFrameCount() const
{}

uint32_t FrameCaptureShared::getReplayFrameIndex() const
{}

// Serialize trace metadata into a JSON file. The JSON file will be named "trace_prefix.json".
//
// As of writing, it will have the format like so:
// {
//     "TraceMetadata":
//     {
//         "AreClientArraysEnabled" : 1, "CaptureRevision" : 16631, "ConfigAlphaBits" : 8,
//             "ConfigBlueBits" : 8, "ConfigDepthBits" : 24, "ConfigGreenBits" : 8,
// ... etc ...
void FrameCaptureShared::writeJSON(const gl::Context *context)
{}

void FrameCaptureShared::writeCppReplayIndexFiles(const gl::Context *context,
                                                  bool writeResetContextCall)
{}

void FrameCaptureShared::writeMainContextCppReplay(const gl::Context *context,
                                                   const std::vector<CallCapture> &setupCalls,
                                                   StateResetHelper &stateResetHelper)
{}

void FrameCaptureShared::reset()
{}

const std::string &FrameCaptureShared::getShaderSource(gl::ShaderProgramID id) const
{}

void FrameCaptureShared::setShaderSource(gl::ShaderProgramID id, std::string source)
{}

const ProgramSources &FrameCaptureShared::getProgramSources(gl::ShaderProgramID id) const
{}

void FrameCaptureShared::setProgramSources(gl::ShaderProgramID id, ProgramSources sources)
{}

void FrameCaptureShared::markResourceSetupCallsInactive(std::vector<CallCapture> *setupCalls,
                                                        ResourceIDType type,
                                                        GLuint id,
                                                        gl::Range<size_t> range)
{}

void CaptureMemory(const void *source, size_t size, ParamCapture *paramCapture)
{}

void CaptureString(const GLchar *str, ParamCapture *paramCapture)
{}

void CaptureStringLimit(const GLchar *str, uint32_t limit, ParamCapture *paramCapture)
{}

void CaptureVertexPointerGLES1(const gl::State &glState,
                               gl::ClientVertexArrayType type,
                               const void *pointer,
                               ParamCapture *paramCapture)
{}

gl::Program *GetProgramForCapture(const gl::State &glState, gl::ShaderProgramID handle)
{}

void CaptureGetActiveUniformBlockivParameters(const gl::State &glState,
                                              gl::ShaderProgramID handle,
                                              gl::UniformBlockIndex uniformBlockIndex,
                                              GLenum pname,
                                              ParamCapture *paramCapture)
{}

void CaptureGetParameter(const gl::State &glState,
                         GLenum pname,
                         size_t typeSize,
                         ParamCapture *paramCapture)
{}

void CaptureGenHandlesImpl(GLsizei n, GLuint *handles, ParamCapture *paramCapture)
{}

void CaptureShaderStrings(GLsizei count,
                          const GLchar *const *strings,
                          const GLint *length,
                          ParamCapture *paramCapture)
{}

// ReplayWriter implementation.
ReplayWriter::ReplayWriter()
    :{}

ReplayWriter::~ReplayWriter()
{}

void ReplayWriter::setSourceFileExtension(const char *ext)
{}

void ReplayWriter::setSourceFileSizeThreshold(size_t sourceFileSizeThreshold)
{}

void ReplayWriter::setFilenamePattern(const std::string &pattern)
{}

void ReplayWriter::setCaptureLabel(const std::string &label)
{}

void ReplayWriter::setSourcePrologue(const std::string &prologue)
{}

void ReplayWriter::setHeaderPrologue(const std::string &prologue)
{}

void ReplayWriter::addPublicFunction(const std::string &functionProto,
                                     const std::stringstream &headerStream,
                                     const std::stringstream &bodyStream)
{}

void ReplayWriter::addPrivateFunction(const std::string &functionProto,
                                      const std::stringstream &headerStream,
                                      const std::stringstream &bodyStream)
{}

std::string ReplayWriter::getInlineVariableName(EntryPoint entryPoint, const std::string &paramName)
{}

std::string ReplayWriter::getInlineStringSetVariableName(EntryPoint entryPoint,
                                                         const std::string &paramName,
                                                         const std::vector<std::string> &strings,
                                                         bool *isNewEntryOut)
{}

size_t ReplayWriter::getStoredReplaySourceSize() const
{}

// static
std::string ReplayWriter::GetVarName(EntryPoint entryPoint,
                                     const std::string &paramName,
                                     int counter)
{}

void ReplayWriter::saveFrame()
{}

void ReplayWriter::saveFrameIfFull()
{}

void ReplayWriter::saveHeader()
{}

void ReplayWriter::saveIndexFilesAndHeader()
{}

void ReplayWriter::saveSetupFile()
{}

void ReplayWriter::writeReplaySource(const std::string &filename)
{}

void ReplayWriter::addWrittenFile(const std::string &filename)
{}

std::vector<std::string> ReplayWriter::getAndResetWrittenFiles()
{}
}  // namespace angle

namespace egl
{
angle::ParamCapture CaptureAttributeMap(const egl::AttributeMap &attribMap)
{}
}  // namespace egl