chromium/third_party/angle/src/libANGLE/capture/FrameCapture.h

//
// 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.h:
//   ANGLE Frame capture interface.
//

#ifndef LIBANGLE_FRAME_CAPTURE_H_
#define LIBANGLE_FRAME_CAPTURE_H_

#include "common/PackedEnums.h"
#include "common/SimpleMutex.h"
#include "common/frame_capture_utils.h"
#include "common/system_utils.h"
#include "libANGLE/Context.h"
#include "libANGLE/ShareGroup.h"
#include "libANGLE/Thread.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/entry_points_utils.h"

namespace gl
{
enum class BigGLEnum;
enum class GLESEnum;
}  // namespace gl

namespace angle
{
// Helper to use unique IDs for each local data variable.
class DataCounters final : angle::NonCopyable
{};

constexpr int kStringsNotFound =;
class StringCounters final : angle::NonCopyable
{};

class DataTracker final : angle::NonCopyable
{};

class ReplayWriter final : angle::NonCopyable
{};

BufferCalls;

// true means mapped, false means unmapped
BufferMapStatusMap;

FenceSyncSet;
FenceSyncCalls;

// For default uniforms, we need to track which ones are dirty, and the series of calls to reset.
// Each program has unique default uniforms, and each uniform has one or more locations in the
// default buffer. For reset efficiency, we track only the uniforms dirty by location, per program.

// A set of all default uniforms (per program) that were modified during the run
DefaultUniformLocationsSet;
DefaultUniformLocationsPerProgramMap;

// A map of programs which maps to locations and their reset calls
DefaultUniformCallsPerLocationMap;
DefaultUniformCallsPerProgramMap;

DefaultUniformBaseLocationMap;

ResourceSet;
ResourceCalls;

class TrackedResource final : angle::NonCopyable
{};

TrackedResourceArray;

enum class ShaderProgramType
{};

// Helper to track resource changes during the capture
class ResourceTracker final : angle::NonCopyable
{};

// Used by the CPP replay to filter out unnecessary code.
HasResourceTypeMap;

// Map of ResourceType to IDs and range of setup calls
ResourceIDToSetupCallsMap;

// Map of buffer ID to offset and size used when mapped
BufferDataMap;

// A dictionary of sources indexed by shader type.
ProgramSources;

// Maps from IDs to sources.
ShaderSourceMap;
ProgramSourceMap;

// Map from textureID to level and data
TextureLevels;
TextureLevelDataMap;

struct SurfaceParams
{};

// Map from ContextID to SurfaceParams
SurfaceParamsMap;

CallVector;

// A map from API entry point to calls
CallResetMap;

TextureBinding;
TextureResetMap;

BufferBindingPair;

// StateResetHelper provides a simple way to track whether an entry point has been called during the
// trace, along with the reset calls to get it back to starting state.  This is useful for things
// that are one dimensional, like context bindings or context state.
class StateResetHelper final : angle::NonCopyable
{};

class FrameCapture final : angle::NonCopyable
{};

// Page range inside a coherent buffer
struct PageRange
{};

// Memory address range defined by start and size
struct AddressRange
{};

// Used to handle protection of buffers that overlap in pages.
enum class PageSharingType
{};

class CoherentBuffer
{};

class CoherentBufferTracker final : angle::NonCopyable
{};

// Shared class for any items that need to be tracked by FrameCapture across shared contexts
class FrameCaptureShared final : angle::NonCopyable
{};

template <typename CaptureFuncT, typename... ArgsT>
void CaptureGLCallToFrameCapture(CaptureFuncT captureFunc,
                                 bool isCallValid,
                                 gl::Context *context,
                                 ArgsT... captureParams)
{}

template <typename FirstT, typename... OthersT>
egl::Display *GetEGLDisplayArg(FirstT display, OthersT... others)
{}

template <typename CaptureFuncT, typename... ArgsT>
void CaptureEGLCallToFrameCapture(CaptureFuncT captureFunc,
                                  bool isCallValid,
                                  egl::Thread *thread,
                                  ArgsT... captureParams)
{}

// Pointer capture helpers.
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);

// For GetIntegerv, GetFloatv, etc.
void CaptureGetParameter(const gl::State &glState,
                         GLenum pname,
                         size_t typeSize,
                         ParamCapture *paramCapture);

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

template <typename T>
void CaptureClearBufferValue(GLenum buffer, const T *value, ParamCapture *paramCapture)
{}

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

template <typename T>
void CaptureGenHandles(GLsizei n, T *handles, ParamCapture *paramCapture)
{}

template <typename T>
void CaptureArray(T *elements, GLsizei n, ParamCapture *paramCapture)
{}

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

}  // namespace angle

template <typename T>
void CaptureTextureAndSamplerParameter_params(GLenum pname,
                                              const T *param,
                                              angle::ParamCapture *paramCapture)
{}

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

#endif  // LIBANGLE_FRAME_CAPTURE_H_