Commit 1c484343 by Cody Northrop Committed by Commit Bot

Capture/Replay: Track the draw surface width/height

In order for captures to replay correctly, track the original width and height of the draw surface, as provided by eglMakeCurrent. Bug: b/159238311 Test: angle_perftests Change-Id: Ic8697abaca7dbdb94dabf34b872f69faf17b0b4d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2250861 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarManh Nguyen <nguyenmh@google.com>
parent 6cb8345f
......@@ -652,6 +652,8 @@ egl::Error Context::makeCurrent(egl::Display *display,
mHasBeenCurrent = true;
}
mFrameCapture->onMakeCurrent(drawSurface);
// TODO(jmadill): Rework this when we support ContextImpl
mState.setAllDirtyBits();
mState.setAllDirtyObjects();
......
......@@ -24,6 +24,7 @@
#include "libANGLE/Query.h"
#include "libANGLE/ResourceMap.h"
#include "libANGLE/Shader.h"
#include "libANGLE/Surface.h"
#include "libANGLE/VertexArray.h"
#include "libANGLE/capture_gles_2_0_autogen.h"
#include "libANGLE/capture_gles_3_0_autogen.h"
......@@ -913,6 +914,8 @@ void WriteCppReplayIndexFiles(bool compression,
const std::string &captureLabel,
uint32_t frameStart,
uint32_t frameEnd,
EGLint drawSurfaceWidth,
EGLint drawSurfaceHeight,
size_t readBufferSize,
const gl::AttribArray<size_t> &clientArraySizes,
const HasResourceTypeMap &hasResourceType)
......@@ -956,6 +959,8 @@ void WriteCppReplayIndexFiles(bool compression,
header << "\n";
header << "constexpr uint32_t kReplayFrameStart = " << frameStart << ";\n";
header << "constexpr uint32_t kReplayFrameEnd = " << frameEnd << ";\n";
header << "constexpr EGLint kReplayDrawSurfaceWidth = " << drawSurfaceWidth << ";\n";
header << "constexpr EGLint kReplayDrawSurfaceHeight = " << drawSurfaceHeight << ";\n";
header << "\n";
header << "void SetupContext" << static_cast<int>(contextId) << "Replay();\n";
header << "void ReplayContext" << static_cast<int>(contextId)
......@@ -3858,8 +3863,8 @@ void FrameCapture::onEndFrame(const gl::Context *context)
if (mFrameIndex == mFrameEnd)
{
WriteCppReplayIndexFiles(mCompression, mOutDirectory, context->id(), mCaptureLabel,
mFrameStart, mFrameEnd, mReadBufferSize, mClientArraySizes,
mHasResourceType);
mFrameStart, mFrameEnd, mDrawSurfaceWidth, mDrawSurfaceHeight,
mReadBufferSize, mClientArraySizes, mHasResourceType);
if (!mBinaryData.empty())
{
......@@ -3895,6 +3900,14 @@ void FrameCapture::onEndFrame(const gl::Context *context)
}
}
void FrameCapture::onMakeCurrent(const egl::Surface *drawSurface)
{
// Track the width and height of the draw surface as provided to makeCurrent
// TODO (b/159238311): Track this per context. Right now last one wins.
mDrawSurfaceWidth = drawSurface->getWidth();
mDrawSurfaceHeight = drawSurface->getHeight();
}
DataCounters::DataCounters() = default;
DataCounters::~DataCounters() = default;
......
......@@ -273,6 +273,7 @@ class FrameCapture final : angle::NonCopyable
void captureCall(const gl::Context *context, CallCapture &&call);
void onEndFrame(const gl::Context *context);
void onMakeCurrent(const egl::Surface *drawSurface);
bool enabled() const { return mEnabled; }
bool isCapturing() const;
......@@ -317,6 +318,8 @@ class FrameCapture final : angle::NonCopyable
uint32_t mFrameIndex;
uint32_t mFrameStart;
uint32_t mFrameEnd;
EGLint mDrawSurfaceWidth = 0;
EGLint mDrawSurfaceHeight = 0;
gl::AttribArray<size_t> mClientArraySizes;
size_t mReadBufferSize;
HasResourceTypeMap mHasResourceType;
......
......@@ -24,5 +24,6 @@ ResourceTracker::~ResourceTracker() {}
FrameCapture::FrameCapture() {}
FrameCapture::~FrameCapture() {}
void FrameCapture::onEndFrame(const gl::Context *context) {}
void FrameCapture::onMakeCurrent(const egl::Surface *drawSurface) {}
void FrameCapture::replay(gl::Context *context) {}
} // namespace angle
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