Commit 612b7417 by Jamie Madill Committed by Commit Bot

Capture/Replay: Add frame capture to cpp files.

Capture is implemented mostly via code auto-generation. The capture requires a bit of custom logic for each captured pointer parameter. We handle this by using auto-generation to lay out the base template for each GL call and then custom logic that uses ANGLE's internals to know how much data to capture at which point. Client array pointers are captured before each draw call. Currently only GLES capture is supported. We write out cpp files and an optional data file accompanying each cpp. For small data chunks we inline them in the cpp files. For bigger chunks like texture data we pack them into the data file. Mid-execution capture is not yet supported. Configuring the capture is currently only available by modifying the cpp sources. Both of these features will be implemented in the future. Bug: angleproject:3611 Change-Id: If6d5dac2f7bf363129d42ea9198162aef0d3a4ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1671904 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 9e438eeb
......@@ -566,7 +566,7 @@ if (angle_enable_vulkan) {
}
}
angle_static_library("libANGLE") {
angle_source_set("libANGLE") {
sources = libangle_sources
include_dirs = []
......@@ -710,6 +710,13 @@ angle_static_library("libANGLE") {
}
}
angle_source_set("libANGLE_with_capture") {
public_deps = [
":libANGLE",
]
sources = libangle_capture_sources
}
config("shared_library_public_config") {
if (is_mac && !is_component_build) {
# Executable targets that depend on the shared libraries below need to have
......@@ -739,30 +746,42 @@ config("angle_static") {
]
}
angle_shared_library("libGLESv2") {
sources = libglesv2_sources
output_name = "libGLESv2${angle_libs_suffix}"
template("angle_libGLESv2") {
angle_shared_library(target_name) {
sources = libglesv2_sources
output_name = "${target_name}${angle_libs_suffix}"
if (is_win) {
sources += [ "src/libGLESv2/libGLESv2_autogen.def" ]
}
if (is_win) {
sources += [ "src/libGLESv2/${target_name}_autogen.def" ]
}
configs += [
":angle_gl_visibility_config",
":debug_annotations_config",
":gl_prototypes",
]
configs += [
":angle_gl_visibility_config",
":debug_annotations_config",
":gl_prototypes",
]
defines = [ "LIBGLESV2_IMPLEMENTATION" ]
defines = [ "LIBGLESV2_IMPLEMENTATION" ] + invoker.defines
deps = [
":includes",
":libANGLE",
]
deps = [
":includes",
invoker.libANGLE,
]
public_deps = [
":angle_version",
]
public_deps = [
":angle_version",
]
}
}
angle_libGLESv2("libGLESv2") {
libANGLE = ":libANGLE"
defines = [ "ANGLE_CAPTURE_ENABLED=0" ]
}
angle_libGLESv2("libGLESv2_with_capture") {
libANGLE = ":libANGLE_with_capture"
defines = [ "ANGLE_CAPTURE_ENABLED=1" ]
}
if (is_win) {
......@@ -776,7 +795,10 @@ if (is_win) {
":gl_prototypes",
]
defines = [ "OPENGL32_IMPLEMENTATION" ]
defines = [
"ANGLE_CAPTURE_ENABLED=0",
"OPENGL32_IMPLEMENTATION",
]
deps = [
":includes",
......
......@@ -94,7 +94,7 @@
"GL/EGL entry points:scripts/entry_point_packed_gl_enums.json":
"08665ca9ebf22fa759c1ce0e965a200d",
"GL/EGL entry points:scripts/generate_entry_points.py":
"d4b4c2c5a2a0ad11eda1f7516076e4aa",
"adf3e5de933ae0c8e29e4da6cc0ba4b8",
"GL/EGL entry points:scripts/gl.xml":
"b470cb06b06cbbe7adb2c8129ec85708",
"GL/EGL entry points:scripts/gl_angle_ext.xml":
......@@ -133,6 +133,30 @@
"5ccae982f020320b1e29cf8eecd8c303",
"GL/EGL entry points:src/libANGLE/Context_gles_ext_autogen.h":
"a4159480e94e629b7ad5820464eab6ff",
"GL/EGL entry points:src/libANGLE/capture_gles_1_0_autogen.cpp":
"3336b58e58205e1e7451c1ade26583a2",
"GL/EGL entry points:src/libANGLE/capture_gles_1_0_autogen.h":
"7674cdeb5b841475cce5b1bb9682f2d6",
"GL/EGL entry points:src/libANGLE/capture_gles_2_0_autogen.cpp":
"6338dd75f0a93981a6e31cf5f6f1231b",
"GL/EGL entry points:src/libANGLE/capture_gles_2_0_autogen.h":
"5a85f0995ed7f4e047fbe2327cbba88a",
"GL/EGL entry points:src/libANGLE/capture_gles_3_0_autogen.cpp":
"c7a886ac7236032b7ef99646cc1786cd",
"GL/EGL entry points:src/libANGLE/capture_gles_3_0_autogen.h":
"803899fe6b16225760b137ce207ba249",
"GL/EGL entry points:src/libANGLE/capture_gles_3_1_autogen.cpp":
"abf5a08db8db0e6014405ad1827a074c",
"GL/EGL entry points:src/libANGLE/capture_gles_3_1_autogen.h":
"3a64c9682c3642fc281dc7a9680d4bcc",
"GL/EGL entry points:src/libANGLE/capture_gles_ext_autogen.cpp":
"455bc4147c1ef7defd93385fe9433f7e",
"GL/EGL entry points:src/libANGLE/capture_gles_ext_autogen.h":
"ff0d811bf4a8a78521077126538cb9c4",
"GL/EGL entry points:src/libANGLE/frame_capture_utils_autogen.cpp":
"05f98f9b62ec70a24341b772cd87c584",
"GL/EGL entry points:src/libANGLE/frame_capture_utils_autogen.h":
"08df1391bcb6e95af913481f1b8fd5fb",
"GL/EGL entry points:src/libANGLE/validationES1_autogen.h":
"8d3131d2bf2e6f521f46b44e64a6bff9",
"GL/EGL entry points:src/libANGLE/validationES2_autogen.h":
......@@ -166,69 +190,71 @@
"GL/EGL entry points:src/libGLESv2/entry_points_enum_autogen.h":
"f8340d0bfde6bc581a508a47a54a6678",
"GL/EGL entry points:src/libGLESv2/entry_points_gles_1_0_autogen.cpp":
"153739031e8ae415fe42ecc9c132ffb2",
"fd5b3940f9e097dea0fbe53834cb4164",
"GL/EGL entry points:src/libGLESv2/entry_points_gles_1_0_autogen.h":
"77fa8d307ebf839838f8812786cddc1a",
"GL/EGL entry points:src/libGLESv2/entry_points_gles_2_0_autogen.cpp":
"835cbe8088a7670776a82ee4099fdc54",
"cccce8d33cfe88ae087b3deafc8aa38a",
"GL/EGL entry points:src/libGLESv2/entry_points_gles_2_0_autogen.h":
"3bbaf1cf42fba5d675e5b54cd1d14df7",
"GL/EGL entry points:src/libGLESv2/entry_points_gles_3_0_autogen.cpp":
"f460f746355e979a10529124efa43c4c",
"331fd52877db18178b9e8ca37767930a",
"GL/EGL entry points:src/libGLESv2/entry_points_gles_3_0_autogen.h":
"395f6978219abd5182bbe80cc367e40c",
"GL/EGL entry points:src/libGLESv2/entry_points_gles_3_1_autogen.cpp":
"f4cc6820dc6c734cfd4b919d61ed4322",
"7153c4a2199546d2c86cb03beddd9c13",
"GL/EGL entry points:src/libGLESv2/entry_points_gles_3_1_autogen.h":
"043d09a964c740067bf4279e0b544aed",
"GL/EGL entry points:src/libGLESv2/entry_points_gles_ext_autogen.cpp":
"ea96fd970bb4f814199706c3663c44ab",
"b52e3c042b2d617961d3d597ec2cdf97",
"GL/EGL entry points:src/libGLESv2/entry_points_gles_ext_autogen.h":
"294cc52579b3439e99914c11bb7cd9f6",
"GL/EGL entry points:src/libGLESv2/libGLESv2_autogen.cpp":
"229577015686414a6d094533c2210cea",
"GL/EGL entry points:src/libGLESv2/libGLESv2_autogen.def":
"5973958936850835cc48a57bba9bd33a",
"GL/EGL entry points:src/libGLESv2/libGLESv2_with_capture_autogen.def":
"a2973e5317d62329e5aa761058afd2ad",
"GL/EGL entry points:src/openGL32/entry_points_enum_autogen.h":
"15fd8df38c1d074ae576d30cfd6ebad9",
"GL/EGL entry points:src/openGL32/entry_points_gl_1_0_autogen.cpp":
"784766d4bc99e9a05af00b75fc0d4a73",
"0ea99b570ebdd1625b1f41ade47d7e97",
"GL/EGL entry points:src/openGL32/entry_points_gl_1_0_autogen.h":
"8e91307664a1049e2db42d651fd42be7",
"GL/EGL entry points:src/openGL32/entry_points_gl_1_1_autogen.cpp":
"39b84189e7dea4ba6a2c9fc11722e143",
"b380559d1af7e3035eb9613b270b1153",
"GL/EGL entry points:src/openGL32/entry_points_gl_1_1_autogen.h":
"0f011b953435f9e83e61b6826209753b",
"GL/EGL entry points:src/openGL32/entry_points_gl_1_2_autogen.cpp":
"5c199abe61ddbd6427911107c2106452",
"96041a290e8f44382a0ceddcbfca974d",
"GL/EGL entry points:src/openGL32/entry_points_gl_1_2_autogen.h":
"1a6a2956bc3dbb4703378b3142778ff2",
"GL/EGL entry points:src/openGL32/entry_points_gl_1_3_autogen.cpp":
"db6ffa9498a01913b626b49d0ca312c5",
"aa855309b625d579aaa460d42efe346f",
"GL/EGL entry points:src/openGL32/entry_points_gl_1_3_autogen.h":
"1e0fd2fdb8e46c635432c4f558f1bdf3",
"GL/EGL entry points:src/openGL32/entry_points_gl_1_4_autogen.cpp":
"4a1803fbcc9392201a88be8db3f5da1d",
"e64a7509818302bece7654af5ccc7091",
"GL/EGL entry points:src/openGL32/entry_points_gl_1_4_autogen.h":
"54fef88d63c0c0e99489120d2d16109a",
"GL/EGL entry points:src/openGL32/entry_points_gl_1_5_autogen.cpp":
"98a022b0258510b9d11408082145f1be",
"05189b369bff39ef46ac55de52c76424",
"GL/EGL entry points:src/openGL32/entry_points_gl_1_5_autogen.h":
"13f8c37ceaea5fd4bda59ddc8a0fe7b2",
"GL/EGL entry points:src/openGL32/entry_points_gl_2_0_autogen.cpp":
"19e975c1a97da842eb32aebba77b33d5",
"3e6d308348d705d1bd5e99686debab91",
"GL/EGL entry points:src/openGL32/entry_points_gl_2_0_autogen.h":
"127e74bf62c027d9e45b5639bef75901",
"GL/EGL entry points:src/openGL32/entry_points_gl_2_1_autogen.cpp":
"e7417d5857f32edb3e35cb877cd6035d",
"018725f2003e9fd8a9283ca146641db8",
"GL/EGL entry points:src/openGL32/entry_points_gl_2_1_autogen.h":
"11b3e2a032ad44b6cdd977e3d2c81232",
"GL/EGL entry points:src/openGL32/entry_points_gl_3_0_autogen.cpp":
"9107d4128d3d21dde0d18bd7e5a00857",
"cc454703dc4ee4ca6fe9af0fc0eca336",
"GL/EGL entry points:src/openGL32/entry_points_gl_3_0_autogen.h":
"e57885db7752cfa8304975e487f652cf",
"GL/EGL entry points:src/openGL32/entry_points_gl_3_1_autogen.cpp":
"ebcbb6d7833672e3ec2244190483ae1d",
"adfba96d816f0a9d458fecbf50d8c4ce",
"GL/EGL entry points:src/openGL32/entry_points_gl_3_1_autogen.h":
"7e52688552b82d6aaff263a63de9018d",
"GL/EGL entry points:src/openGL32/openGL32_autogen.cpp":
......
......@@ -8373,6 +8373,11 @@ egl::Error Context::unsetDefaultFramebuffer()
return egl::NoError();
}
angle::FrameCapture *Context::getFrameCapture()
{
return mDisplay->getFrameCapture();
}
// ErrorSet implementation.
ErrorSet::ErrorSet(Context *context) : mContext(context) {}
......
......@@ -46,6 +46,7 @@
namespace angle
{
class FrameCapture;
struct FrontendFeatures;
} // namespace angle
......@@ -529,6 +530,8 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
const angle::FrontendFeatures &getFrontendFeatures() const;
angle::FrameCapture *getFrameCapture();
private:
void initialize();
......
......@@ -39,6 +39,10 @@
#include "libANGLE/renderer/ImageImpl.h"
#include "libANGLE/trace.h"
#if ANGLE_CAPTURE_ENABLED
# include "libANGLE/FrameCapture.h"
#endif // ANGLE_CAPTURE_ENABLED
#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
# include "libANGLE/renderer/d3d/DisplayD3D.h"
#endif
......@@ -447,8 +451,12 @@ Display::Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDe
mBlobCache(gl::kDefaultMaxProgramCacheMemoryBytes),
mMemoryProgramCache(mBlobCache),
mGlobalTextureShareGroupUsers(0),
mFeatures()
{}
mFrameCapture(nullptr)
{
#if ANGLE_CAPTURE_ENABLED
mFrameCapture = new FrameCapture;
#endif // ANGLE_CAPTURE_ENABLED
}
Display::~Display()
{
......@@ -480,6 +488,10 @@ Display::~Display()
SafeDelete(mDevice);
SafeDelete(mImplementation);
#if ANGLE_CAPTURE_ENABLED
SafeDelete(mFrameCapture);
#endif // ANGLE_CAPTURE_ENABLED
}
void Display::setLabel(EGLLabelKHR label)
......@@ -1349,7 +1361,7 @@ void Display::initVendorString()
void Display::initializeFrontendFeatures()
{
// Enable on all Impls
mFrontendFeatures.loseContextOnOutOfMemory.enabled = true;
mFrontendFeatures.loseContextOnOutOfMemory.enabled = true;
mFrontendFeatures.scalarizeVecAndMatConstructorArgs.enabled = true;
mImplementation->initializeFrontendFeatures(&mFrontendFeatures);
......@@ -1524,4 +1536,11 @@ EGLAttrib Display::queryAttrib(const EGLint attribute)
return value;
}
void Display::onPostSwap() const
{
#if ANGLE_CAPTURE_ENABLED
// Dump frame capture if enabled.
mFrameCapture->onEndFrame();
#endif // ANGLE_CAPTURE_ENABLED
}
} // namespace egl
......@@ -26,6 +26,11 @@
#include "platform/Feature.h"
#include "platform/FrontendFeatures.h"
namespace angle
{
class FrameCapture;
} // namespace angle
namespace gl
{
class Context;
......@@ -202,6 +207,9 @@ class Display final : public LabeledObject, angle::NonCopyable
EGLAttrib queryAttrib(const EGLint attribute);
angle::FrameCapture *getFrameCapture() { return mFrameCapture; }
void onPostSwap() const;
private:
Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDevice);
......@@ -254,6 +262,11 @@ class Display final : public LabeledObject, angle::NonCopyable
angle::FrontendFeatures mFrontendFeatures;
angle::FeatureList mFeatures;
// Might want to revisit who owns this and has access in the future. Threaded use would mean
// it might make sense to use different captures for EGL and GLES contexts.
// Note: we use a raw pointer here so we can exclude frame capture sources from the build.
angle::FrameCapture *mFrameCapture;
};
} // namespace egl
......
//
// 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 inteface.
//
#ifndef LIBANGLE_FRAME_CAPTURE_H_
#define LIBANGLE_FRAME_CAPTURE_H_
#include "common/PackedEnums.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/frame_capture_utils_autogen.h"
#include <tuple>
namespace gl
{
class Context;
} // namespace gl
namespace angle
{
struct ParamCapture : angle::NonCopyable
{
ParamCapture();
ParamCapture(const char *nameIn, ParamType typeIn);
~ParamCapture();
ParamCapture(ParamCapture &&other);
ParamCapture &operator=(ParamCapture &&other);
std::string name;
ParamType type;
ParamValue value;
std::vector<std::vector<uint8_t>> data;
int arrayClientPointerIndex = -1;
size_t readBufferSize = 0;
};
class ParamBuffer final : angle::NonCopyable
{
public:
ParamBuffer();
~ParamBuffer();
ParamBuffer(ParamBuffer &&other);
ParamBuffer &operator=(ParamBuffer &&other);
template <typename T>
void addValueParam(const char *paramName, ParamType paramType, T paramValue);
ParamCapture &getParam(const char *paramName, ParamType paramType, int index);
void addParam(ParamCapture &&param);
bool hasClientArrayData() const { return mClientArrayDataParam != -1; }
ParamCapture &getClientArrayPointerParameter();
size_t getReadBufferSize() const { return mReadBufferSize; }
const std::vector<ParamCapture> &getParamCaptures() const { return mParamCaptures; }
private:
std::vector<ParamCapture> mParamCaptures;
int mClientArrayDataParam = -1;
size_t mReadBufferSize = 0;
};
struct CallCapture
{
CallCapture(const char *nameIn, ParamBuffer &&paramsIn);
~CallCapture();
CallCapture(CallCapture &&other);
CallCapture &operator=(CallCapture &&other);
std::string name;
ParamBuffer params;
};
class FrameCapture final : angle::NonCopyable
{
public:
FrameCapture();
~FrameCapture();
void captureCall(const gl::Context *context,
const char *callName,
ParamBuffer &&paramBuffer,
bool isCallValid);
void onEndFrame();
bool enabled() const;
private:
// <CallName, ParamName>
using Counter = std::tuple<std::string, std::string>;
void captureClientArraySnapshot(const gl::Context *context,
size_t vertexCount,
size_t instanceCount);
void writeCallReplay(const CallCapture &call,
std::ostream &out,
std::ostream &header,
std::vector<uint8_t> *binaryData);
void reset();
int getAndIncrementCounter(const std::string &callName, const std::string &paramName);
bool anyClientArray() const;
void saveCapturedFrameAsCpp();
std::vector<CallCapture> mCalls;
gl::AttribArray<int> mClientVertexArrayMap;
size_t mFrameIndex;
gl::AttribArray<size_t> mClientArraySizes;
std::map<Counter, int> mDataCounters;
size_t mReadBufferSize;
};
template <typename T>
void ParamBuffer::addValueParam(const char *paramName, ParamType paramType, T paramValue)
{
ParamCapture capture(paramName, paramType);
InitParamValue(paramType, paramValue, &capture.value);
mParamCaptures.emplace_back(std::move(capture));
}
std::ostream &operator<<(std::ostream &os, const ParamCapture &capture);
// Pointer capture helpers.
void CaptureMemory(const void *source, size_t size, ParamCapture *paramCapture);
void CaptureString(const GLchar *str, ParamCapture *paramCapture);
template <ParamType ParamT, typename T>
void WriteParamValueToStream(std::ostream &os, T value);
template <>
void WriteParamValueToStream<ParamType::TGLboolean>(std::ostream &os, GLboolean value);
template <>
void WriteParamValueToStream<ParamType::TvoidConstPointer>(std::ostream &os, const void *value);
template <>
void WriteParamValueToStream<ParamType::TGLDEBUGPROCKHR>(std::ostream &os, GLDEBUGPROCKHR value);
// General fallback for any unspecific type.
template <ParamType ParamT, typename T>
void WriteParamValueToStream(std::ostream &os, T value)
{
os << value;
}
} // namespace angle
#endif // LIBANGLE_FRAME_CAPTURE_H_
......@@ -131,13 +131,15 @@ Error Surface::destroyImpl(const Display *display)
return NoError();
}
void Surface::postSwap()
void Surface::postSwap(const Display *display)
{
if (mRobustResourceInitialization && mSwapBehavior != EGL_BUFFER_PRESERVED)
{
mInitState = gl::InitState::MayNeedInit;
onStateChange(angle::SubjectMessage::SubjectChanged);
}
display->onPostSwap();
}
Error Surface::initialize(const Display *display)
......@@ -234,14 +236,14 @@ Error Surface::swap(const gl::Context *context)
ANGLE_TRACE_EVENT0("gpu.angle", "egl::Surface::swap");
ANGLE_TRY(mImplementation->swap(context));
postSwap();
postSwap(context->getDisplay());
return NoError();
}
Error Surface::swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects)
{
ANGLE_TRY(mImplementation->swapWithDamage(context, rects, n_rects));
postSwap();
postSwap(context->getDisplay());
return NoError();
}
......
......@@ -227,7 +227,7 @@ class Surface : public LabeledObject, public gl::FramebufferAttachmentObject
private:
Error destroyImpl(const Display *display);
void postSwap();
void postSwap(const Display *display);
Error releaseRef(const Display *display);
gl::InitState mInitState;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -878,6 +878,32 @@ libangle_vulkan_sources = [
"src/libANGLE/renderer/vulkan/vk_wrapper.h",
]
# The frame capture headers are always visible to libANGLE.
libangle_sources += [
"src/libANGLE/FrameCapture.h",
"src/libANGLE/capture_gles_1_0_autogen.h",
"src/libANGLE/capture_gles_2_0_autogen.h",
"src/libANGLE/capture_gles_3_0_autogen.h",
"src/libANGLE/capture_gles_3_1_autogen.h",
"src/libANGLE/capture_gles_ext_autogen.h",
"src/libANGLE/frame_capture_utils_autogen.h",
]
libangle_capture_sources = [
"src/libANGLE/FrameCapture.cpp",
"src/libANGLE/capture_gles_1_0_autogen.cpp",
"src/libANGLE/capture_gles_1_0_params.cpp",
"src/libANGLE/capture_gles_2_0_autogen.cpp",
"src/libANGLE/capture_gles_2_0_params.cpp",
"src/libANGLE/capture_gles_3_0_autogen.cpp",
"src/libANGLE/capture_gles_3_0_params.cpp",
"src/libANGLE/capture_gles_3_1_autogen.cpp",
"src/libANGLE/capture_gles_3_1_params.cpp",
"src/libANGLE/capture_gles_ext_autogen.cpp",
"src/libANGLE/capture_gles_ext_params.cpp",
"src/libANGLE/frame_capture_utils_autogen.cpp",
]
libangle_vulkan_android_sources = [
"src/libANGLE/renderer/vulkan/android/DisplayVkAndroid.cpp",
"src/libANGLE/renderer/vulkan/android/DisplayVkAndroid.h",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -81,6 +81,13 @@ constexpr ANGLE_INLINE ReturnType GetDefaultReturnValue()
{
return DefaultReturnValue<EP, ReturnType>::kValue;
}
#if ANGLE_CAPTURE_ENABLED
# define ANGLE_CAPTURE(Func, ...) Capture##Func(__VA_ARGS__)
#else
# define ANGLE_CAPTURE(...)
#endif // ANGLE_CAPTURE_ENABLED
} // namespace gl
#endif // LIBGLESV2_ENTRY_POINT_UTILS_H_
......@@ -44,6 +44,8 @@ void GL_APIENTRY CopyTexSubImage3D(GLenum target,
if (context)
{
TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
ANGLE_CAPTURE(CopyTexSubImage3D, context, targetPacked, level, xoffset, yoffset, zoffset, x,
y, width, height);
if (context->skipValidation() ||
ValidateCopyTexSubImage3D(context, targetPacked, level, xoffset, yoffset, zoffset, x, y,
width, height))
......@@ -71,6 +73,8 @@ void GL_APIENTRY DrawRangeElements(GLenum mode,
{
PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
ANGLE_CAPTURE(DrawRangeElements, context, modePacked, start, end, count, typePacked,
indices);
if (context->skipValidation() ||
ValidateDrawRangeElements(context, modePacked, start, end, count, typePacked, indices))
{
......@@ -101,6 +105,8 @@ void GL_APIENTRY TexImage3D(GLenum target,
if (context)
{
TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
ANGLE_CAPTURE(TexImage3D, context, targetPacked, level, internalformat, width, height,
depth, border, format, type, pixels);
if (context->skipValidation() ||
ValidateTexImage3D(context, targetPacked, level, internalformat, width, height, depth,
border, format, type, pixels))
......@@ -134,6 +140,8 @@ void GL_APIENTRY TexSubImage3D(GLenum target,
if (context)
{
TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
ANGLE_CAPTURE(TexSubImage3D, context, targetPacked, level, xoffset, yoffset, zoffset, width,
height, depth, format, type, pixels);
if (context->skipValidation() ||
ValidateTexSubImage3D(context, targetPacked, level, xoffset, yoffset, zoffset, width,
height, depth, format, type, pixels))
......
......@@ -33,6 +33,7 @@ void GL_APIENTRY BeginQuery(GLenum target, GLuint id)
if (context)
{
QueryType targetPacked = FromGLenum<QueryType>(target);
ANGLE_CAPTURE(BeginQuery, context, targetPacked, id);
if (context->skipValidation() || ValidateBeginQuery(context, targetPacked, id))
{
context->beginQuery(targetPacked, id);
......@@ -48,6 +49,7 @@ void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer)
if (context)
{
BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
ANGLE_CAPTURE(BindBuffer, context, targetPacked, buffer);
if (context->skipValidation() || ValidateBindBuffer(context, targetPacked, buffer))
{
context->bindBuffer(targetPacked, buffer);
......@@ -66,6 +68,7 @@ void GL_APIENTRY BufferData(GLenum target, GLsizeiptr size, const void *data, GL
{
BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
BufferUsage usagePacked = FromGLenum<BufferUsage>(usage);
ANGLE_CAPTURE(BufferData, context, targetPacked, size, data, usagePacked);
if (context->skipValidation() ||
ValidateBufferData(context, targetPacked, size, data, usagePacked))
{
......@@ -86,6 +89,7 @@ void GL_APIENTRY BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size,
if (context)
{
BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
ANGLE_CAPTURE(BufferSubData, context, targetPacked, offset, size, data);
if (context->skipValidation() ||
ValidateBufferSubData(context, targetPacked, offset, size, data))
{
......@@ -101,6 +105,7 @@ void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint *buffers)
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(DeleteBuffers, context, n, buffers);
if (context->skipValidation() || ValidateDeleteBuffers(context, n, buffers))
{
context->deleteBuffers(n, buffers);
......@@ -115,6 +120,7 @@ void GL_APIENTRY DeleteQueries(GLsizei n, const GLuint *ids)
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(DeleteQueries, context, n, ids);
if (context->skipValidation() || ValidateDeleteQueries(context, n, ids))
{
context->deleteQueries(n, ids);
......@@ -130,6 +136,7 @@ void GL_APIENTRY EndQuery(GLenum target)
if (context)
{
QueryType targetPacked = FromGLenum<QueryType>(target);
ANGLE_CAPTURE(EndQuery, context, targetPacked);
if (context->skipValidation() || ValidateEndQuery(context, targetPacked))
{
context->endQuery(targetPacked);
......@@ -144,6 +151,7 @@ void GL_APIENTRY GenBuffers(GLsizei n, GLuint *buffers)
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(GenBuffers, context, n, buffers);
if (context->skipValidation() || ValidateGenBuffers(context, n, buffers))
{
context->genBuffers(n, buffers);
......@@ -158,6 +166,7 @@ void GL_APIENTRY GenQueries(GLsizei n, GLuint *ids)
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(GenQueries, context, n, ids);
if (context->skipValidation() || ValidateGenQueries(context, n, ids))
{
context->genQueries(n, ids);
......@@ -174,6 +183,7 @@ void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint *params
if (context)
{
BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
ANGLE_CAPTURE(GetBufferParameteriv, context, targetPacked, pname, params);
if (context->skipValidation() ||
ValidateGetBufferParameteriv(context, targetPacked, pname, params))
{
......@@ -191,6 +201,7 @@ void GL_APIENTRY GetBufferPointerv(GLenum target, GLenum pname, void **params)
if (context)
{
BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
ANGLE_CAPTURE(GetBufferPointerv, context, targetPacked, pname, params);
if (context->skipValidation() ||
ValidateGetBufferPointerv(context, targetPacked, pname, params))
{
......@@ -210,6 +221,7 @@ void GL_APIENTRY GetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr siz
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(GetBufferSubData, context, target, offset, size, data);
if (context->skipValidation() ||
ValidateGetBufferSubData(context, target, offset, size, data))
{
......@@ -226,6 +238,7 @@ void GL_APIENTRY GetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
Context *context = GetGlobalContext();
if (context)
{
ANGLE_CAPTURE(GetQueryObjectiv, context, id, pname, params);
if (context->skipValidation() || ValidateGetQueryObjectiv(context, id, pname, params))
{
context->getQueryObjectiv(id, pname, params);
......@@ -241,6 +254,7 @@ void GL_APIENTRY GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(GetQueryObjectuiv, context, id, pname, params);
if (context->skipValidation() || ValidateGetQueryObjectuiv(context, id, pname, params))
{
context->getQueryObjectuiv(id, pname, params);
......@@ -257,6 +271,7 @@ void GL_APIENTRY GetQueryiv(GLenum target, GLenum pname, GLint *params)
if (context)
{
QueryType targetPacked = FromGLenum<QueryType>(target);
ANGLE_CAPTURE(GetQueryiv, context, targetPacked, pname, params);
if (context->skipValidation() || ValidateGetQueryiv(context, targetPacked, pname, params))
{
context->getQueryiv(targetPacked, pname, params);
......@@ -271,6 +286,7 @@ GLboolean GL_APIENTRY IsBuffer(GLuint buffer)
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(IsBuffer, context, buffer);
if (context->skipValidation() || ValidateIsBuffer(context, buffer))
{
return context->isBuffer(buffer);
......@@ -287,6 +303,7 @@ GLboolean GL_APIENTRY IsQuery(GLuint id)
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(IsQuery, context, id);
if (context->skipValidation() || ValidateIsQuery(context, id))
{
return context->isQuery(id);
......@@ -304,6 +321,7 @@ void *GL_APIENTRY MapBuffer(GLenum target, GLenum access)
if (context)
{
BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
ANGLE_CAPTURE(MapBuffer, context, targetPacked, access);
if (context->skipValidation() || ValidateMapBuffer(context, targetPacked, access))
{
return context->mapBuffer(targetPacked, access);
......@@ -321,6 +339,7 @@ GLboolean GL_APIENTRY UnmapBuffer(GLenum target)
if (context)
{
BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
ANGLE_CAPTURE(UnmapBuffer, context, targetPacked);
if (context->skipValidation() || ValidateUnmapBuffer(context, targetPacked))
{
return context->unmapBuffer(targetPacked);
......
......@@ -38,6 +38,7 @@ void GL_APIENTRY UniformMatrix2x3fv(GLint location,
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(UniformMatrix2x3fv, context, location, count, transpose, value);
if (context->skipValidation() ||
ValidateUniformMatrix2x3fv(context, location, count, transpose, value))
{
......@@ -59,6 +60,7 @@ void GL_APIENTRY UniformMatrix2x4fv(GLint location,
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(UniformMatrix2x4fv, context, location, count, transpose, value);
if (context->skipValidation() ||
ValidateUniformMatrix2x4fv(context, location, count, transpose, value))
{
......@@ -80,6 +82,7 @@ void GL_APIENTRY UniformMatrix3x2fv(GLint location,
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(UniformMatrix3x2fv, context, location, count, transpose, value);
if (context->skipValidation() ||
ValidateUniformMatrix3x2fv(context, location, count, transpose, value))
{
......@@ -101,6 +104,7 @@ void GL_APIENTRY UniformMatrix3x4fv(GLint location,
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(UniformMatrix3x4fv, context, location, count, transpose, value);
if (context->skipValidation() ||
ValidateUniformMatrix3x4fv(context, location, count, transpose, value))
{
......@@ -122,6 +126,7 @@ void GL_APIENTRY UniformMatrix4x2fv(GLint location,
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(UniformMatrix4x2fv, context, location, count, transpose, value);
if (context->skipValidation() ||
ValidateUniformMatrix4x2fv(context, location, count, transpose, value))
{
......@@ -143,6 +148,7 @@ void GL_APIENTRY UniformMatrix4x3fv(GLint location,
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(UniformMatrix4x3fv, context, location, count, transpose, value);
if (context->skipValidation() ||
ValidateUniformMatrix4x3fv(context, location, count, transpose, value))
{
......
......@@ -42,6 +42,8 @@ void GL_APIENTRY CopyBufferSubData(GLenum readTarget,
{
BufferBinding readTargetPacked = FromGLenum<BufferBinding>(readTarget);
BufferBinding writeTargetPacked = FromGLenum<BufferBinding>(writeTarget);
ANGLE_CAPTURE(CopyBufferSubData, context, readTargetPacked, writeTargetPacked, readOffset,
writeOffset, size);
if (context->skipValidation() ||
ValidateCopyBufferSubData(context, readTargetPacked, writeTargetPacked, readOffset,
writeOffset, size))
......@@ -61,6 +63,7 @@ void GL_APIENTRY DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GL
if (context)
{
PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
ANGLE_CAPTURE(DrawArraysInstanced, context, modePacked, first, count, instancecount);
if (context->skipValidation() ||
ValidateDrawArraysInstanced(context, modePacked, first, count, instancecount))
{
......@@ -85,6 +88,8 @@ void GL_APIENTRY DrawElementsInstanced(GLenum mode,
{
PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
ANGLE_CAPTURE(DrawElementsInstanced, context, modePacked, count, typePacked, indices,
instancecount);
if (context->skipValidation() ||
ValidateDrawElementsInstanced(context, modePacked, count, typePacked, indices,
instancecount))
......@@ -108,6 +113,8 @@ void GL_APIENTRY GetActiveUniformBlockName(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(GetActiveUniformBlockName, context, program, uniformBlockIndex, bufSize,
length, uniformBlockName);
if (context->skipValidation() ||
ValidateGetActiveUniformBlockName(context, program, uniformBlockIndex, bufSize, length,
uniformBlockName))
......@@ -131,6 +138,7 @@ void GL_APIENTRY GetActiveUniformBlockiv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(GetActiveUniformBlockiv, context, program, uniformBlockIndex, pname, params);
if (context->skipValidation() ||
ValidateGetActiveUniformBlockiv(context, program, uniformBlockIndex, pname, params))
{
......@@ -153,6 +161,8 @@ void GL_APIENTRY GetActiveUniformName(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(GetActiveUniformName, context, program, uniformIndex, bufSize, length,
uniformName);
if (context->skipValidation() ||
ValidateGetActiveUniformName(context, program, uniformIndex, bufSize, length,
uniformName))
......@@ -176,6 +186,8 @@ void GL_APIENTRY GetActiveUniformsiv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(GetActiveUniformsiv, context, program, uniformCount, uniformIndices, pname,
params);
if (context->skipValidation() || ValidateGetActiveUniformsiv(context, program, uniformCount,
uniformIndices, pname, params))
{
......@@ -192,6 +204,7 @@ GLuint GL_APIENTRY GetUniformBlockIndex(GLuint program, const GLchar *uniformBlo
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(GetUniformBlockIndex, context, program, uniformBlockName);
if (context->skipValidation() ||
ValidateGetUniformBlockIndex(context, program, uniformBlockName))
{
......@@ -215,6 +228,8 @@ void GL_APIENTRY GetUniformIndices(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(GetUniformIndices, context, program, uniformCount, uniformNames,
uniformIndices);
if (context->skipValidation() ||
ValidateGetUniformIndices(context, program, uniformCount, uniformNames, uniformIndices))
{
......@@ -230,6 +245,7 @@ void GL_APIENTRY PrimitiveRestartIndex(GLuint index)
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(PrimitiveRestartIndex, context, index);
if (context->skipValidation() || ValidatePrimitiveRestartIndex(context, index))
{
context->primitiveRestartIndex(index);
......@@ -245,6 +261,7 @@ void GL_APIENTRY TexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(TexBuffer, context, target, internalformat, buffer);
if (context->skipValidation() || ValidateTexBuffer(context, target, internalformat, buffer))
{
context->texBuffer(target, internalformat, buffer);
......@@ -262,6 +279,8 @@ void GL_APIENTRY UniformBlockBinding(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
ANGLE_CAPTURE(UniformBlockBinding, context, program, uniformBlockIndex,
uniformBlockBinding);
if (context->skipValidation() ||
ValidateUniformBlockBinding(context, program, uniformBlockIndex, uniformBlockBinding))
{
......
......@@ -67,6 +67,12 @@ constexpr ANGLE_INLINE ReturnType GetDefaultReturnValue()
{
return DefaultReturnValue<EP, ReturnType>::kValue;
}
#if ANGLE_CAPTURE_ENABLED
# define ANGLE_CAPTURE(Func, ...) Capture##Func(__VA_ARGS__)
#else
# define ANGLE_CAPTURE(...)
#endif // ANGLE_CAPTURE_ENABLED
} // namespace gl
#endif // OPENGL32_ENTRY_POINT_UTILS_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment