Commit f8ecac29 by Cody Northrop Committed by Commit Bot

Capture/Replay: Add TransformFeedback Object support to mid-execution capture

Test: Manhattan mid-execution capture working Bug: angleproject:3662 Bug: angleproject:4091 Change-Id: Ibaa708085c5707a4ece637186daeafe6c681068f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2070901Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com>
parent 605ab763
......@@ -326,7 +326,8 @@ class StateCache final : angle::NonCopyable
mCachedIntegerVertexAttribTypesValidation;
};
using QueryMap = ResourceMap<Query, QueryID>;
using QueryMap = ResourceMap<Query, QueryID>;
using TransformFeedbackMap = ResourceMap<TransformFeedback, TransformFeedbackID>;
class Context final : public egl::LabeledObject, angle::NonCopyable, public angle::ObserverInterface
{
......@@ -592,6 +593,10 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
angle::FrameCapture *getFrameCapture() { return mFrameCapture.get(); }
const QueryMap &getQueriesForCapture() const { return mQueryMap; }
const TransformFeedbackMap &getTransformFeedbacksForCapture() const
{
return mTransformFeedbackMap;
}
void onPostSwap() const;
......@@ -684,7 +689,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
ResourceMap<VertexArray, VertexArrayID> mVertexArrayMap;
HandleAllocator mVertexArrayHandleAllocator;
ResourceMap<TransformFeedback, TransformFeedbackID> mTransformFeedbackMap;
TransformFeedbackMap mTransformFeedbackMap;
HandleAllocator mTransformFeedbackHandleAllocator;
const char *mVersionString;
......
......@@ -1769,6 +1769,28 @@ void CaptureMidExecutionSetup(const gl::Context *context,
cap(CaptureDeleteShader(replayState, true, tempShaderID));
}
// Gather XFB varyings
std::vector<std::string> xfbVaryings;
for (const gl::TransformFeedbackVarying &xfbVarying :
program->getState().getLinkedTransformFeedbackVaryings())
{
xfbVaryings.push_back(xfbVarying.nameWithArrayIndex());
}
if (!xfbVaryings.empty())
{
std::vector<const char *> varyingsStrings;
for (const std::string &varyingString : xfbVaryings)
{
varyingsStrings.push_back(varyingString.data());
}
GLenum xfbMode = program->getState().getTransformFeedbackBufferMode();
cap(CaptureTransformFeedbackVaryings(replayState, true, id,
static_cast<GLint>(xfbVaryings.size()),
varyingsStrings.data(), xfbMode));
}
cap(CaptureLinkProgram(replayState, true, id));
CaptureUpdateUniformLocations(program, setupCalls);
}
......@@ -1843,6 +1865,45 @@ void CaptureMidExecutionSetup(const gl::Context *context,
}
}
// Transform Feedback
const gl::TransformFeedbackMap &xfbMap = context->getTransformFeedbacksForCapture();
for (const auto &xfbIter : xfbMap)
{
gl::TransformFeedbackID xfbID = {xfbIter.first};
cap(CaptureGenTransformFeedbacks(replayState, true, 1, &xfbID));
MaybeCaptureUpdateResourceIDs(setupCalls);
gl::TransformFeedback *xfb = xfbIter.second;
if (!xfb)
{
// The object was never created
continue;
}
// Bind XFB to create the object
cap(CaptureBindTransformFeedback(replayState, true, GL_TRANSFORM_FEEDBACK, xfbID));
// Bind the buffers associated with this XFB object
for (size_t i = 0; i < xfb->getIndexedBufferCount(); ++i)
{
const gl::OffsetBindingPointer<gl::Buffer> &xfbBuffer = xfb->getIndexedBuffer(i);
// Note: Buffers bound with BindBufferBase can be used with BindBuffer
cap(CaptureBindBufferRange(replayState, true, gl::BufferBinding::TransformFeedback, 0,
xfbBuffer.id(), xfbBuffer.getOffset(), xfbBuffer.getSize()));
}
if (xfb->isActive() || xfb->isPaused())
{
// We don't support active XFB in MEC yet
UNIMPLEMENTED();
}
}
// Bind the current XFB buffer after populating XFB objects
gl::TransformFeedback *currentXFB = apiState.getCurrentTransformFeedback();
cap(CaptureBindTransformFeedback(replayState, true, GL_TRANSFORM_FEEDBACK, currentXFB->id()));
// Capture GL Context states.
// TODO(http://anglebug.com/3662): Complete state capture.
auto capCap = [cap, &replayState](GLenum capEnum, bool capValue) {
......
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