Commit eb1b1646 by Jamie Madill Committed by Commit Bot

Capture/Replay: Fix capture-enabled libs build.

Adds a build option to use the capture libraries in the default output location for libGLESv2. With |angle_with_capture_by_default| enabled, libGLESv2 will have capture enabled and the non-capture libGLESv2 is built as libGLESv2_no_capture. Also moves the FrameCapture to be owned by gl::Context. Rearranges the code a bit so that we don't require a separate version of libANGLE for capture. Also implements a read pixels entry point parameter. Bug: angleproject:3611 Change-Id: Ic528e43e4779f794c8b6d0bf35410166dacc81b1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1719064Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 3e493c48
...@@ -21,6 +21,10 @@ declare_args() { ...@@ -21,6 +21,10 @@ declare_args() {
# Link in system libGL, to work with apitrace. See doc/DebuggingTips.md. # Link in system libGL, to work with apitrace. See doc/DebuggingTips.md.
angle_link_glx = false angle_link_glx = false
# Defaults to capture building to $root_out_dir/angle_libs/with_capture.
# Switch on to build capture to $root_out_dir.
angle_with_capture_by_default = false
} }
if (!build_with_chromium) { if (!build_with_chromium) {
...@@ -564,7 +568,7 @@ if (angle_enable_vulkan) { ...@@ -564,7 +568,7 @@ if (angle_enable_vulkan) {
} }
} }
angle_source_set("libANGLE") { angle_source_set("libANGLE_base") {
sources = libangle_sources sources = libangle_sources
include_dirs = [] include_dirs = []
...@@ -712,10 +716,29 @@ angle_source_set("libANGLE") { ...@@ -712,10 +716,29 @@ angle_source_set("libANGLE") {
} }
} }
config("angle_frame_capture_disabled") {
defines = [ "ANGLE_CAPTURE_ENABLED=0" ]
}
config("angle_frame_capture_enabled") {
defines = [ "ANGLE_CAPTURE_ENABLED=1" ]
}
angle_source_set("libANGLE") {
public_deps = [
":libANGLE_base",
]
public_configs = [ ":angle_frame_capture_disabled" ]
sources = [
"src/libANGLE/FrameCapture.cpp",
]
}
angle_source_set("libANGLE_with_capture") { angle_source_set("libANGLE_with_capture") {
public_deps = [ public_deps = [
":libANGLE", ":libANGLE_base",
] ]
public_configs = [ ":angle_frame_capture_enabled" ]
sources = libangle_capture_sources sources = libangle_capture_sources
} }
...@@ -748,27 +771,30 @@ config("angle_static") { ...@@ -748,27 +771,30 @@ config("angle_static") {
] ]
} }
set_defaults("angle_libGLESv2") {
sources = []
output_name = "libGLESv2"
}
template("angle_libGLESv2") { template("angle_libGLESv2") {
angle_shared_library(target_name) { angle_shared_library(target_name) {
sources = libglesv2_sources sources = libglesv2_sources + invoker.sources
output_name = "${target_name}${angle_libs_suffix}"
if (is_win) { if (is_win) {
sources += [ "src/libGLESv2/${target_name}_autogen.def" ] sources += [ "src/libGLESv2/${invoker.output_name}_autogen.def" ]
} }
output_name = "${invoker.output_name}${angle_libs_suffix}"
configs += [ configs += [
":angle_gl_visibility_config", ":angle_gl_visibility_config",
":debug_annotations_config", ":debug_annotations_config",
":gl_prototypes", ":gl_prototypes",
] ]
defines = [ "LIBGLESV2_IMPLEMENTATION" ] + invoker.defines defines = [ "LIBGLESV2_IMPLEMENTATION" ]
deps = [ deps = invoker.deps + [ ":includes" ]
":includes",
invoker.libANGLE,
]
public_deps = [ public_deps = [
":angle_version", ":angle_version",
...@@ -777,13 +803,23 @@ template("angle_libGLESv2") { ...@@ -777,13 +803,23 @@ template("angle_libGLESv2") {
} }
angle_libGLESv2("libGLESv2") { angle_libGLESv2("libGLESv2") {
libANGLE = ":libANGLE" deps = [
defines = [ "ANGLE_CAPTURE_ENABLED=0" ] ":libANGLE",
]
if (angle_with_capture_by_default) {
output_name = "libGLESv2_no_capture"
}
} }
angle_libGLESv2("libGLESv2_with_capture") { angle_libGLESv2("libGLESv2_with_capture") {
libANGLE = ":libANGLE_with_capture" deps = [
defines = [ "ANGLE_CAPTURE_ENABLED=1" ] ":libANGLE_with_capture",
]
if (!angle_with_capture_by_default) {
output_name = "libGLESv2_with_capture"
}
} }
if (is_win) { if (is_win) {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"scripts/entry_point_packed_gl_enums.json": "scripts/entry_point_packed_gl_enums.json":
"e5282bdef690f0ec652fed0e0723d1e8", "e5282bdef690f0ec652fed0e0723d1e8",
"scripts/generate_entry_points.py": "scripts/generate_entry_points.py":
"52114608e1af3d5d12d2985b62168464", "0fe74a6996604cbcd0d1031930fbb4e5",
"scripts/gl.xml": "scripts/gl.xml":
"b470cb06b06cbbe7adb2c8129ec85708", "b470cb06b06cbbe7adb2c8129ec85708",
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
...@@ -241,6 +241,8 @@ ...@@ -241,6 +241,8 @@
"229577015686414a6d094533c2210cea", "229577015686414a6d094533c2210cea",
"src/libGLESv2/libGLESv2_autogen.def": "src/libGLESv2/libGLESv2_autogen.def":
"52ef9529c516e83d6a0d9e1a9ec0a493", "52ef9529c516e83d6a0d9e1a9ec0a493",
"src/libGLESv2/libGLESv2_no_capture_autogen.def":
"7ca05c04f1c59b2b9265745370a57188",
"src/libGLESv2/libGLESv2_with_capture_autogen.def": "src/libGLESv2/libGLESv2_with_capture_autogen.def":
"25b108d7f235173041f7c92ffab9fb44" "25b108d7f235173041f7c92ffab9fb44"
} }
\ No newline at end of file
...@@ -1239,6 +1239,7 @@ def main(): ...@@ -1239,6 +1239,7 @@ def main():
'../src/libGLESv2/entry_points_gles_ext_autogen.h', '../src/libGLESv2/entry_points_gles_ext_autogen.h',
'../src/libGLESv2/libGLESv2_autogen.cpp', '../src/libGLESv2/libGLESv2_autogen.cpp',
'../src/libGLESv2/libGLESv2_autogen.def', '../src/libGLESv2/libGLESv2_autogen.def',
'../src/libGLESv2/libGLESv2_no_capture_autogen.def',
'../src/libGLESv2/libGLESv2_with_capture_autogen.def', '../src/libGLESv2/libGLESv2_with_capture_autogen.def',
'../src/libGL/entry_points_gl_1_0_autogen.cpp', '../src/libGL/entry_points_gl_1_0_autogen.cpp',
'../src/libGL/entry_points_gl_1_0_autogen.h', '../src/libGL/entry_points_gl_1_0_autogen.h',
...@@ -1681,9 +1682,8 @@ def main(): ...@@ -1681,9 +1682,8 @@ def main():
everything = "Khronos and ANGLE XML files" everything = "Khronos and ANGLE XML files"
write_windows_def_file(everything, "libGLESv2", "libGLESv2", "libGLESv2", libgles_ep_exports) for lib in ["libGLESv2" + suffix for suffix in ["", "_no_capture", "_with_capture"]]:
write_windows_def_file(everything, "libGLESv2_with_capture", "libGLESv2_with_capture", write_windows_def_file(everything, lib, lib, "libGLESv2", libgles_ep_exports)
"libGLESv2", libgles_ep_exports)
write_windows_def_file(everything, "libGL", "openGL32", "libGL", libgl_ep_exports) write_windows_def_file(everything, "libGL", "openGL32", "libGL", libgl_ep_exports)
all_gles_param_types = sorted(all_gles_param_types) all_gles_param_types = sorted(all_gles_param_types)
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "libANGLE/Compiler.h" #include "libANGLE/Compiler.h"
#include "libANGLE/Display.h" #include "libANGLE/Display.h"
#include "libANGLE/Fence.h" #include "libANGLE/Fence.h"
#include "libANGLE/FrameCapture.h"
#include "libANGLE/Framebuffer.h" #include "libANGLE/Framebuffer.h"
#include "libANGLE/FramebufferAttachment.h" #include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/MemoryObject.h" #include "libANGLE/MemoryObject.h"
...@@ -348,7 +349,8 @@ Context::Context(egl::Display *display, ...@@ -348,7 +349,8 @@ Context::Context(egl::Display *display,
mReadFramebufferObserverBinding(this, kReadFramebufferSubjectIndex), mReadFramebufferObserverBinding(this, kReadFramebufferSubjectIndex),
mScratchBuffer(1000u), mScratchBuffer(1000u),
mZeroFilledBuffer(1000u), mZeroFilledBuffer(1000u),
mThreadPool(nullptr) mThreadPool(nullptr),
mFrameCapture(new angle::FrameCapture)
{ {
for (angle::SubjectIndex uboIndex = kUniformBuffer0SubjectIndex; for (angle::SubjectIndex uboIndex = kUniformBuffer0SubjectIndex;
uboIndex < kUniformBufferMaxSubjectIndex; ++uboIndex) uboIndex < kUniformBufferMaxSubjectIndex; ++uboIndex)
...@@ -8525,9 +8527,10 @@ egl::Error Context::unsetDefaultFramebuffer() ...@@ -8525,9 +8527,10 @@ egl::Error Context::unsetDefaultFramebuffer()
return egl::NoError(); return egl::NoError();
} }
angle::FrameCapture *Context::getFrameCapture() void Context::onPostSwap() const
{ {
return mDisplay->getFrameCapture(); // Dump frame capture if enabled.
mFrameCapture->onEndFrame();
} }
// ErrorSet implementation. // ErrorSet implementation.
......
...@@ -559,7 +559,9 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -559,7 +559,9 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
const angle::FrontendFeatures &getFrontendFeatures() const; const angle::FrontendFeatures &getFrontendFeatures() const;
angle::FrameCapture *getFrameCapture(); angle::FrameCapture *getFrameCapture() { return mFrameCapture.get(); }
void onPostSwap() const;
private: private:
void initialize(); void initialize();
...@@ -707,6 +709,9 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -707,6 +709,9 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
mutable angle::ScratchBuffer mZeroFilledBuffer; mutable angle::ScratchBuffer mZeroFilledBuffer;
std::shared_ptr<angle::WorkerThreadPool> mThreadPool; std::shared_ptr<angle::WorkerThreadPool> mThreadPool;
// Note: we use a raw pointer here so we can exclude frame capture sources from the build.
std::unique_ptr<angle::FrameCapture> mFrameCapture;
}; };
} // namespace gl } // namespace gl
......
...@@ -40,10 +40,6 @@ ...@@ -40,10 +40,6 @@
#include "libANGLE/renderer/ImageImpl.h" #include "libANGLE/renderer/ImageImpl.h"
#include "libANGLE/trace.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) #if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
# include "libANGLE/renderer/d3d/DisplayD3D.h" # include "libANGLE/renderer/d3d/DisplayD3D.h"
#endif #endif
...@@ -467,13 +463,8 @@ Display::Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDe ...@@ -467,13 +463,8 @@ Display::Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDe
mTextureManager(nullptr), mTextureManager(nullptr),
mBlobCache(gl::kDefaultMaxProgramCacheMemoryBytes), mBlobCache(gl::kDefaultMaxProgramCacheMemoryBytes),
mMemoryProgramCache(mBlobCache), mMemoryProgramCache(mBlobCache),
mGlobalTextureShareGroupUsers(0), mGlobalTextureShareGroupUsers(0)
mFrameCapture(nullptr) {}
{
#if ANGLE_CAPTURE_ENABLED
mFrameCapture = new FrameCapture;
#endif // ANGLE_CAPTURE_ENABLED
}
Display::~Display() Display::~Display()
{ {
...@@ -505,10 +496,6 @@ Display::~Display() ...@@ -505,10 +496,6 @@ Display::~Display()
SafeDelete(mDevice); SafeDelete(mDevice);
SafeDelete(mImplementation); SafeDelete(mImplementation);
#if ANGLE_CAPTURE_ENABLED
SafeDelete(mFrameCapture);
#endif // ANGLE_CAPTURE_ENABLED
} }
void Display::setLabel(EGLLabelKHR label) void Display::setLabel(EGLLabelKHR label)
...@@ -1569,12 +1556,4 @@ EGLAttrib Display::queryAttrib(const EGLint attribute) ...@@ -1569,12 +1556,4 @@ EGLAttrib Display::queryAttrib(const EGLint attribute)
} }
return value; return value;
} }
void Display::onPostSwap() const
{
#if ANGLE_CAPTURE_ENABLED
// Dump frame capture if enabled.
mFrameCapture->onEndFrame();
#endif // ANGLE_CAPTURE_ENABLED
}
} // namespace egl } // namespace egl
...@@ -26,11 +26,6 @@ ...@@ -26,11 +26,6 @@
#include "platform/Feature.h" #include "platform/Feature.h"
#include "platform/FrontendFeatures.h" #include "platform/FrontendFeatures.h"
namespace angle
{
class FrameCapture;
} // namespace angle
namespace gl namespace gl
{ {
class Context; class Context;
...@@ -212,9 +207,6 @@ class Display final : public LabeledObject, angle::NonCopyable ...@@ -212,9 +207,6 @@ class Display final : public LabeledObject, angle::NonCopyable
EGLAttrib queryAttrib(const EGLint attribute); EGLAttrib queryAttrib(const EGLint attribute);
angle::FrameCapture *getFrameCapture() { return mFrameCapture; }
void onPostSwap() const;
private: private:
Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDevice); Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDevice);
...@@ -268,11 +260,6 @@ class Display final : public LabeledObject, angle::NonCopyable ...@@ -268,11 +260,6 @@ class Display final : public LabeledObject, angle::NonCopyable
angle::FrontendFeatures mFrontendFeatures; angle::FrontendFeatures mFrontendFeatures;
angle::FeatureList mFeatures; 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 } // namespace egl
......
...@@ -16,6 +16,15 @@ ...@@ -16,6 +16,15 @@
namespace angle namespace angle
{ {
#if !ANGLE_CAPTURE_ENABLED
CallCapture::~CallCapture() {}
ParamBuffer::~ParamBuffer() {}
ParamCapture::~ParamCapture() {}
FrameCapture::FrameCapture() {}
FrameCapture::~FrameCapture() {}
void FrameCapture::onEndFrame() {}
#else
namespace namespace
{ {
std::string GetCaptureFileName(size_t frameIndex, const char *suffix) std::string GetCaptureFileName(size_t frameIndex, const char *suffix)
...@@ -69,7 +78,7 @@ ParamCapture &ParamCapture::operator=(ParamCapture &&other) ...@@ -69,7 +78,7 @@ ParamCapture &ParamCapture::operator=(ParamCapture &&other)
std::swap(value, other.value); std::swap(value, other.value);
std::swap(data, other.data); std::swap(data, other.data);
std::swap(arrayClientPointerIndex, other.arrayClientPointerIndex); std::swap(arrayClientPointerIndex, other.arrayClientPointerIndex);
std::swap(readBufferSize, other.readBufferSize); std::swap(readBufferSizeBytes, other.readBufferSizeBytes);
return *this; return *this;
} }
...@@ -106,7 +115,7 @@ void ParamBuffer::addParam(ParamCapture &&param) ...@@ -106,7 +115,7 @@ void ParamBuffer::addParam(ParamCapture &&param)
mClientArrayDataParam = static_cast<int>(mParamCaptures.size()); mClientArrayDataParam = static_cast<int>(mParamCaptures.size());
} }
mReadBufferSize = std::max(param.readBufferSize, mReadBufferSize); mReadBufferSize = std::max(param.readBufferSizeBytes, mReadBufferSize);
mParamCaptures.emplace_back(std::move(param)); mParamCaptures.emplace_back(std::move(param));
} }
...@@ -389,7 +398,7 @@ void FrameCapture::writeCallReplay(const CallCapture &call, ...@@ -389,7 +398,7 @@ void FrameCapture::writeCallReplay(const CallCapture &call,
{ {
out << "gClientArrays[" << param.arrayClientPointerIndex << "].data()"; out << "gClientArrays[" << param.arrayClientPointerIndex << "].data()";
} }
else if (param.readBufferSize > 0) else if (param.readBufferSizeBytes > 0)
{ {
out << "reinterpret_cast<" << ParamTypeToString(param.type) << ">(gReadBuffer.data())"; out << "reinterpret_cast<" << ParamTypeToString(param.type) << ">(gReadBuffer.data())";
} }
...@@ -557,4 +566,5 @@ void WriteParamValueToStream<ParamType::TGLDEBUGPROCKHR>(std::ostream &os, GLDEB ...@@ -557,4 +566,5 @@ void WriteParamValueToStream<ParamType::TGLDEBUGPROCKHR>(std::ostream &os, GLDEB
template <> template <>
void WriteParamValueToStream<ParamType::TGLDEBUGPROC>(std::ostream &os, GLDEBUGPROC value) void WriteParamValueToStream<ParamType::TGLDEBUGPROC>(std::ostream &os, GLDEBUGPROC value)
{} {}
#endif // ANGLE_CAPTURE_ENABLED
} // namespace angle } // namespace angle
...@@ -33,7 +33,7 @@ struct ParamCapture : angle::NonCopyable ...@@ -33,7 +33,7 @@ struct ParamCapture : angle::NonCopyable
ParamValue value; ParamValue value;
std::vector<std::vector<uint8_t>> data; std::vector<std::vector<uint8_t>> data;
int arrayClientPointerIndex = -1; int arrayClientPointerIndex = -1;
size_t readBufferSize = 0; size_t readBufferSizeBytes = 0;
}; };
class ParamBuffer final : angle::NonCopyable class ParamBuffer final : angle::NonCopyable
......
...@@ -131,7 +131,7 @@ Error Surface::destroyImpl(const Display *display) ...@@ -131,7 +131,7 @@ Error Surface::destroyImpl(const Display *display)
return NoError(); return NoError();
} }
void Surface::postSwap(const Display *display) void Surface::postSwap(const gl::Context *context)
{ {
if (mRobustResourceInitialization && mSwapBehavior != EGL_BUFFER_PRESERVED) if (mRobustResourceInitialization && mSwapBehavior != EGL_BUFFER_PRESERVED)
{ {
...@@ -139,7 +139,7 @@ void Surface::postSwap(const Display *display) ...@@ -139,7 +139,7 @@ void Surface::postSwap(const Display *display)
onStateChange(angle::SubjectMessage::SubjectChanged); onStateChange(angle::SubjectMessage::SubjectChanged);
} }
display->onPostSwap(); context->onPostSwap();
} }
Error Surface::initialize(const Display *display) Error Surface::initialize(const Display *display)
...@@ -236,14 +236,14 @@ Error Surface::swap(const gl::Context *context) ...@@ -236,14 +236,14 @@ Error Surface::swap(const gl::Context *context)
ANGLE_TRACE_EVENT0("gpu.angle", "egl::Surface::swap"); ANGLE_TRACE_EVENT0("gpu.angle", "egl::Surface::swap");
ANGLE_TRY(mImplementation->swap(context)); ANGLE_TRY(mImplementation->swap(context));
postSwap(context->getDisplay()); postSwap(context);
return NoError(); return NoError();
} }
Error Surface::swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects) Error Surface::swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects)
{ {
ANGLE_TRY(mImplementation->swapWithDamage(context, rects, n_rects)); ANGLE_TRY(mImplementation->swapWithDamage(context, rects, n_rects));
postSwap(context->getDisplay()); postSwap(context);
return NoError(); return NoError();
} }
......
...@@ -227,7 +227,7 @@ class Surface : public LabeledObject, public gl::FramebufferAttachmentObject ...@@ -227,7 +227,7 @@ class Surface : public LabeledObject, public gl::FramebufferAttachmentObject
private: private:
Error destroyImpl(const Display *display); Error destroyImpl(const Display *display);
void postSwap(const Display *display); void postSwap(const gl::Context *context);
Error releaseRef(const Display *display); Error releaseRef(const Display *display);
gl::InitState mInitState; gl::InitState mInitState;
......
...@@ -156,7 +156,7 @@ void CaptureGenBuffers_buffers(const Context *context, ...@@ -156,7 +156,7 @@ void CaptureGenBuffers_buffers(const Context *context,
GLuint *buffers, GLuint *buffers,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
paramCapture->readBufferSize = sizeof(GLuint) * n; paramCapture->readBufferSizeBytes = sizeof(GLuint) * n;
} }
void CaptureGenFramebuffers_framebuffers(const Context *context, void CaptureGenFramebuffers_framebuffers(const Context *context,
...@@ -165,7 +165,7 @@ void CaptureGenFramebuffers_framebuffers(const Context *context, ...@@ -165,7 +165,7 @@ void CaptureGenFramebuffers_framebuffers(const Context *context,
GLuint *framebuffers, GLuint *framebuffers,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
paramCapture->readBufferSize = sizeof(GLuint) * n; paramCapture->readBufferSizeBytes = sizeof(GLuint) * n;
} }
void CaptureGenRenderbuffers_renderbuffers(const Context *context, void CaptureGenRenderbuffers_renderbuffers(const Context *context,
...@@ -174,7 +174,7 @@ void CaptureGenRenderbuffers_renderbuffers(const Context *context, ...@@ -174,7 +174,7 @@ void CaptureGenRenderbuffers_renderbuffers(const Context *context,
GLuint *renderbuffers, GLuint *renderbuffers,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
paramCapture->readBufferSize = sizeof(GLuint) * n; paramCapture->readBufferSizeBytes = sizeof(GLuint) * n;
} }
void CaptureGenTextures_textures(const Context *context, void CaptureGenTextures_textures(const Context *context,
...@@ -183,7 +183,7 @@ void CaptureGenTextures_textures(const Context *context, ...@@ -183,7 +183,7 @@ void CaptureGenTextures_textures(const Context *context,
GLuint *textures, GLuint *textures,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
paramCapture->readBufferSize = sizeof(GLuint) * n; paramCapture->readBufferSizeBytes = sizeof(GLuint) * n;
} }
void CaptureGetActiveAttrib_length(const Context *context, void CaptureGetActiveAttrib_length(const Context *context,
...@@ -338,7 +338,7 @@ void CaptureGetBooleanv_data(const Context *context, ...@@ -338,7 +338,7 @@ void CaptureGetBooleanv_data(const Context *context,
GLenum type; GLenum type;
unsigned int numParams; unsigned int numParams;
context->getQueryParameterInfo(pname, &type, &numParams); context->getQueryParameterInfo(pname, &type, &numParams);
paramCapture->readBufferSize = sizeof(GLboolean) * numParams; paramCapture->readBufferSizeBytes = sizeof(GLboolean) * numParams;
} }
void CaptureGetBufferParameteriv_params(const Context *context, void CaptureGetBufferParameteriv_params(const Context *context,
...@@ -380,7 +380,7 @@ void CaptureGetIntegerv_data(const Context *context, ...@@ -380,7 +380,7 @@ void CaptureGetIntegerv_data(const Context *context,
GLenum type; GLenum type;
unsigned int numParams; unsigned int numParams;
context->getQueryParameterInfo(pname, &type, &numParams); context->getQueryParameterInfo(pname, &type, &numParams);
paramCapture->readBufferSize = sizeof(GLint) * numParams; paramCapture->readBufferSizeBytes = sizeof(GLint) * numParams;
} }
void CaptureGetProgramInfoLog_length(const Context *context, void CaptureGetProgramInfoLog_length(const Context *context,
...@@ -391,7 +391,7 @@ void CaptureGetProgramInfoLog_length(const Context *context, ...@@ -391,7 +391,7 @@ void CaptureGetProgramInfoLog_length(const Context *context,
GLchar *infoLog, GLchar *infoLog,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
paramCapture->readBufferSize = sizeof(GLsizei); paramCapture->readBufferSizeBytes = sizeof(GLsizei);
} }
void CaptureGetProgramInfoLog_infoLog(const Context *context, void CaptureGetProgramInfoLog_infoLog(const Context *context,
...@@ -404,7 +404,7 @@ void CaptureGetProgramInfoLog_infoLog(const Context *context, ...@@ -404,7 +404,7 @@ void CaptureGetProgramInfoLog_infoLog(const Context *context,
{ {
gl::Program *programObj = context->getProgramResolveLink(program); gl::Program *programObj = context->getProgramResolveLink(program);
ASSERT(programObj); ASSERT(programObj);
paramCapture->readBufferSize = programObj->getInfoLogLength() + 1; paramCapture->readBufferSizeBytes = programObj->getInfoLogLength() + 1;
} }
void CaptureGetProgramiv_params(const Context *context, void CaptureGetProgramiv_params(const Context *context,
...@@ -416,7 +416,7 @@ void CaptureGetProgramiv_params(const Context *context, ...@@ -416,7 +416,7 @@ void CaptureGetProgramiv_params(const Context *context,
{ {
if (params) if (params)
{ {
paramCapture->readBufferSize = sizeof(GLint); paramCapture->readBufferSizeBytes = sizeof(GLint);
} }
} }
...@@ -438,7 +438,7 @@ void CaptureGetShaderInfoLog_length(const Context *context, ...@@ -438,7 +438,7 @@ void CaptureGetShaderInfoLog_length(const Context *context,
GLchar *infoLog, GLchar *infoLog,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
paramCapture->readBufferSize = sizeof(GLsizei); paramCapture->readBufferSizeBytes = sizeof(GLsizei);
} }
void CaptureGetShaderInfoLog_infoLog(const Context *context, void CaptureGetShaderInfoLog_infoLog(const Context *context,
...@@ -451,7 +451,7 @@ void CaptureGetShaderInfoLog_infoLog(const Context *context, ...@@ -451,7 +451,7 @@ void CaptureGetShaderInfoLog_infoLog(const Context *context,
{ {
gl::Shader *shaderObj = context->getShader(shader); gl::Shader *shaderObj = context->getShader(shader);
ASSERT(shaderObj); ASSERT(shaderObj);
paramCapture->readBufferSize = shaderObj->getInfoLogLength() + 1; paramCapture->readBufferSizeBytes = shaderObj->getInfoLogLength() + 1;
} }
void CaptureGetShaderPrecisionFormat_range(const Context *context, void CaptureGetShaderPrecisionFormat_range(const Context *context,
...@@ -507,7 +507,7 @@ void CaptureGetShaderiv_params(const Context *context, ...@@ -507,7 +507,7 @@ void CaptureGetShaderiv_params(const Context *context,
{ {
if (params) if (params)
{ {
paramCapture->readBufferSize = sizeof(GLint); paramCapture->readBufferSizeBytes = sizeof(GLint);
} }
} }
...@@ -567,7 +567,7 @@ void CaptureGetVertexAttribPointerv_pointer(const Context *context, ...@@ -567,7 +567,7 @@ void CaptureGetVertexAttribPointerv_pointer(const Context *context,
void **pointer, void **pointer,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
paramCapture->readBufferSize = sizeof(void *); paramCapture->readBufferSizeBytes = sizeof(void *);
} }
void CaptureGetVertexAttribfv_params(const Context *context, void CaptureGetVertexAttribfv_params(const Context *context,
...@@ -578,7 +578,7 @@ void CaptureGetVertexAttribfv_params(const Context *context, ...@@ -578,7 +578,7 @@ void CaptureGetVertexAttribfv_params(const Context *context,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
// Can be up to 4 current state values. // Can be up to 4 current state values.
paramCapture->readBufferSize = sizeof(GLfloat) * 4; paramCapture->readBufferSizeBytes = sizeof(GLfloat) * 4;
} }
void CaptureGetVertexAttribiv_params(const Context *context, void CaptureGetVertexAttribiv_params(const Context *context,
...@@ -589,7 +589,7 @@ void CaptureGetVertexAttribiv_params(const Context *context, ...@@ -589,7 +589,7 @@ void CaptureGetVertexAttribiv_params(const Context *context,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
// Can be up to 4 current state values. // Can be up to 4 current state values.
paramCapture->readBufferSize = sizeof(GLint) * 4; paramCapture->readBufferSizeBytes = sizeof(GLint) * 4;
} }
void CaptureReadPixels_pixels(const Context *context, void CaptureReadPixels_pixels(const Context *context,
...@@ -603,7 +603,9 @@ void CaptureReadPixels_pixels(const Context *context, ...@@ -603,7 +603,9 @@ void CaptureReadPixels_pixels(const Context *context,
void *pixels, void *pixels,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); // Use a conservative upper bound instead of an exact size to be simple.
static constexpr GLsizei kMaxPixelSize = 32;
paramCapture->readBufferSizeBytes = kMaxPixelSize * width * height;
} }
void CaptureShaderBinary_shaders(const Context *context, void CaptureShaderBinary_shaders(const Context *context,
......
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