Commit 5671c2bd by Cody Northrop Committed by Commit Bot

Capture/Replay: Fix vertex array objects for MEC

While debugging NBA2K20 MEC, fixed the following issues: * Don't bind built-in attributes locations. * Don't emit glGenBuffers for the default VAO. * Include element array buffer in MEC. Test: NBA2K20 MEC Bug: b/160014453 Change-Id: I1b809946d67b6748b0670814be8dd090278dc38f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2307276Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarManh Nguyen <nguyenmh@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com>
parent 55e85549
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "sys/stat.h" #include "sys/stat.h"
#include "common/mathutil.h" #include "common/mathutil.h"
#include "common/string_utils.h"
#include "common/system_utils.h" #include "common/system_utils.h"
#include "libANGLE/Config.h" #include "libANGLE/Config.h"
#include "libANGLE/Context.h" #include "libANGLE/Context.h"
...@@ -1835,15 +1836,17 @@ void CaptureVertexArrayData(std::vector<CallCapture> *setupCalls, ...@@ -1835,15 +1836,17 @@ void CaptureVertexArrayData(std::vector<CallCapture> *setupCalls,
binding.getStride() != defaultBinding.getStride() || binding.getStride() != defaultBinding.getStride() ||
binding.getBuffer().get() != nullptr) binding.getBuffer().get() != nullptr)
{ {
// Each attribute can pull from a separate buffer, so check the binding
gl::Buffer *buffer = binding.getBuffer().get(); gl::Buffer *buffer = binding.getBuffer().get();
if (buffer != replayState->getArrayBuffer()) if (buffer != replayState->getArrayBuffer())
{ {
replayState->setBufferBinding(context, gl::BufferBinding::Array, buffer); replayState->setBufferBinding(context, gl::BufferBinding::Array, buffer);
Capture(setupCalls, CaptureBindBuffer(*replayState, true, gl::BufferBinding::Array, Capture(setupCalls, CaptureBindBuffer(*replayState, true, gl::BufferBinding::Array,
buffer->id())); buffer->id()));
} }
// Establish the relationship between currently bound buffer and the VAO
Capture(setupCalls, CaptureVertexAttribPointer( Capture(setupCalls, CaptureVertexAttribPointer(
*replayState, true, attribIndex, attrib.format->channelCount, *replayState, true, attribIndex, attrib.format->channelCount,
attrib.format->vertexAttribType, attrib.format->isNorm(), attrib.format->vertexAttribType, attrib.format->isNorm(),
...@@ -1856,6 +1859,14 @@ void CaptureVertexArrayData(std::vector<CallCapture> *setupCalls, ...@@ -1856,6 +1859,14 @@ void CaptureVertexArrayData(std::vector<CallCapture> *setupCalls,
binding.getDivisor())); binding.getDivisor()));
} }
} }
// The element array buffer is not per attribute, but per VAO
gl::Buffer *elementArrayBuffer = vertexArray->getElementArrayBuffer();
if (elementArrayBuffer)
{
Capture(setupCalls, CaptureBindBuffer(*replayState, true, gl::BufferBinding::ElementArray,
elementArrayBuffer->id()));
}
} }
void CaptureTextureStorage(std::vector<CallCapture> *setupCalls, void CaptureTextureStorage(std::vector<CallCapture> *setupCalls,
...@@ -2162,8 +2173,11 @@ void CaptureMidExecutionSetup(const gl::Context *context, ...@@ -2162,8 +2173,11 @@ void CaptureMidExecutionSetup(const gl::Context *context,
for (const auto &vertexArrayIter : vertexArrayMap) for (const auto &vertexArrayIter : vertexArrayMap)
{ {
gl::VertexArrayID vertexArrayID = {vertexArrayIter.first}; gl::VertexArrayID vertexArrayID = {vertexArrayIter.first};
cap(CaptureGenVertexArrays(replayState, true, 1, &vertexArrayID)); if (vertexArrayID.value != 0)
MaybeCaptureUpdateResourceIDs(setupCalls); {
cap(CaptureGenVertexArrays(replayState, true, 1, &vertexArrayID));
MaybeCaptureUpdateResourceIDs(setupCalls);
}
if (vertexArrayIter.second) if (vertexArrayIter.second)
{ {
...@@ -2633,6 +2647,13 @@ void CaptureMidExecutionSetup(const gl::Context *context, ...@@ -2633,6 +2647,13 @@ void CaptureMidExecutionSetup(const gl::Context *context,
for (const sh::ShaderVariable &attrib : program->getState().getProgramInputs()) for (const sh::ShaderVariable &attrib : program->getState().getProgramInputs())
{ {
ASSERT(attrib.location != -1); ASSERT(attrib.location != -1);
if (angle::BeginsWith(attrib.name, "gl_"))
{
// Don't try to bind built-in attributes
continue;
}
cap(CaptureBindAttribLocation( cap(CaptureBindAttribLocation(
replayState, true, id, static_cast<GLuint>(attrib.location), attrib.name.c_str())); replayState, true, id, static_cast<GLuint>(attrib.location), attrib.name.c_str()));
} }
......
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