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, ...@@ -652,6 +652,8 @@ egl::Error Context::makeCurrent(egl::Display *display,
mHasBeenCurrent = true; mHasBeenCurrent = true;
} }
mFrameCapture->onMakeCurrent(drawSurface);
// TODO(jmadill): Rework this when we support ContextImpl // TODO(jmadill): Rework this when we support ContextImpl
mState.setAllDirtyBits(); mState.setAllDirtyBits();
mState.setAllDirtyObjects(); mState.setAllDirtyObjects();
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "libANGLE/Query.h" #include "libANGLE/Query.h"
#include "libANGLE/ResourceMap.h" #include "libANGLE/ResourceMap.h"
#include "libANGLE/Shader.h" #include "libANGLE/Shader.h"
#include "libANGLE/Surface.h"
#include "libANGLE/VertexArray.h" #include "libANGLE/VertexArray.h"
#include "libANGLE/capture_gles_2_0_autogen.h" #include "libANGLE/capture_gles_2_0_autogen.h"
#include "libANGLE/capture_gles_3_0_autogen.h" #include "libANGLE/capture_gles_3_0_autogen.h"
...@@ -913,6 +914,8 @@ void WriteCppReplayIndexFiles(bool compression, ...@@ -913,6 +914,8 @@ void WriteCppReplayIndexFiles(bool compression,
const std::string &captureLabel, const std::string &captureLabel,
uint32_t frameStart, uint32_t frameStart,
uint32_t frameEnd, uint32_t frameEnd,
EGLint drawSurfaceWidth,
EGLint drawSurfaceHeight,
size_t readBufferSize, size_t readBufferSize,
const gl::AttribArray<size_t> &clientArraySizes, const gl::AttribArray<size_t> &clientArraySizes,
const HasResourceTypeMap &hasResourceType) const HasResourceTypeMap &hasResourceType)
...@@ -956,6 +959,8 @@ void WriteCppReplayIndexFiles(bool compression, ...@@ -956,6 +959,8 @@ void WriteCppReplayIndexFiles(bool compression,
header << "\n"; header << "\n";
header << "constexpr uint32_t kReplayFrameStart = " << frameStart << ";\n"; header << "constexpr uint32_t kReplayFrameStart = " << frameStart << ";\n";
header << "constexpr uint32_t kReplayFrameEnd = " << frameEnd << ";\n"; header << "constexpr uint32_t kReplayFrameEnd = " << frameEnd << ";\n";
header << "constexpr EGLint kReplayDrawSurfaceWidth = " << drawSurfaceWidth << ";\n";
header << "constexpr EGLint kReplayDrawSurfaceHeight = " << drawSurfaceHeight << ";\n";
header << "\n"; header << "\n";
header << "void SetupContext" << static_cast<int>(contextId) << "Replay();\n"; header << "void SetupContext" << static_cast<int>(contextId) << "Replay();\n";
header << "void ReplayContext" << static_cast<int>(contextId) header << "void ReplayContext" << static_cast<int>(contextId)
...@@ -3858,8 +3863,8 @@ void FrameCapture::onEndFrame(const gl::Context *context) ...@@ -3858,8 +3863,8 @@ void FrameCapture::onEndFrame(const gl::Context *context)
if (mFrameIndex == mFrameEnd) if (mFrameIndex == mFrameEnd)
{ {
WriteCppReplayIndexFiles(mCompression, mOutDirectory, context->id(), mCaptureLabel, WriteCppReplayIndexFiles(mCompression, mOutDirectory, context->id(), mCaptureLabel,
mFrameStart, mFrameEnd, mReadBufferSize, mClientArraySizes, mFrameStart, mFrameEnd, mDrawSurfaceWidth, mDrawSurfaceHeight,
mHasResourceType); mReadBufferSize, mClientArraySizes, mHasResourceType);
if (!mBinaryData.empty()) if (!mBinaryData.empty())
{ {
...@@ -3895,6 +3900,14 @@ void FrameCapture::onEndFrame(const gl::Context *context) ...@@ -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;
DataCounters::~DataCounters() = default; DataCounters::~DataCounters() = default;
......
...@@ -273,6 +273,7 @@ class FrameCapture final : angle::NonCopyable ...@@ -273,6 +273,7 @@ class FrameCapture final : angle::NonCopyable
void captureCall(const gl::Context *context, CallCapture &&call); void captureCall(const gl::Context *context, CallCapture &&call);
void onEndFrame(const gl::Context *context); void onEndFrame(const gl::Context *context);
void onMakeCurrent(const egl::Surface *drawSurface);
bool enabled() const { return mEnabled; } bool enabled() const { return mEnabled; }
bool isCapturing() const; bool isCapturing() const;
...@@ -317,6 +318,8 @@ class FrameCapture final : angle::NonCopyable ...@@ -317,6 +318,8 @@ class FrameCapture final : angle::NonCopyable
uint32_t mFrameIndex; uint32_t mFrameIndex;
uint32_t mFrameStart; uint32_t mFrameStart;
uint32_t mFrameEnd; uint32_t mFrameEnd;
EGLint mDrawSurfaceWidth = 0;
EGLint mDrawSurfaceHeight = 0;
gl::AttribArray<size_t> mClientArraySizes; gl::AttribArray<size_t> mClientArraySizes;
size_t mReadBufferSize; size_t mReadBufferSize;
HasResourceTypeMap mHasResourceType; HasResourceTypeMap mHasResourceType;
......
...@@ -24,5 +24,6 @@ ResourceTracker::~ResourceTracker() {} ...@@ -24,5 +24,6 @@ ResourceTracker::~ResourceTracker() {}
FrameCapture::FrameCapture() {} FrameCapture::FrameCapture() {}
FrameCapture::~FrameCapture() {} FrameCapture::~FrameCapture() {}
void FrameCapture::onEndFrame(const gl::Context *context) {} void FrameCapture::onEndFrame(const gl::Context *context) {}
void FrameCapture::onMakeCurrent(const egl::Surface *drawSurface) {}
void FrameCapture::replay(gl::Context *context) {} void FrameCapture::replay(gl::Context *context) {}
} // namespace angle } // 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