Commit f8d2c429 by Gert Wollny Committed by Angle LUCI CQ

Capture/Replay: Add test to capture an uninitialized buffer

Handle the serialization in case the buffer is not yet set up. Bug: angleproject:6093 Change-Id: I06a8e15d181c4ec514a334f952ce29a4026970a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2982549 Commit-Queue: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com>
parent e72bdb4f
......@@ -762,12 +762,19 @@ Result SerializeBuffer(const gl::Context *context,
{
GroupScope group(json, "Buffer");
SerializeBufferState(json, buffer->getState());
MemoryBuffer *dataPtr = nullptr;
ANGLE_CHECK_GL_ALLOC(
const_cast<gl::Context *>(context),
scratchBuffer->getInitialized(static_cast<size_t>(buffer->getSize()), &dataPtr, 0));
ANGLE_TRY(buffer->getSubData(context, 0, dataPtr->size(), dataPtr->data()));
json->addBlob("data", dataPtr->data(), dataPtr->size());
if (buffer->getSize())
{
MemoryBuffer *dataPtr = nullptr;
ANGLE_CHECK_GL_ALLOC(
const_cast<gl::Context *>(context),
scratchBuffer->getInitialized(static_cast<size_t>(buffer->getSize()), &dataPtr, 0));
ANGLE_TRY(buffer->getSubData(context, 0, dataPtr->size(), dataPtr->data()));
json->addBlob("data", dataPtr->data(), dataPtr->size());
}
else
{
json->addCString("data", "null");
}
return Result::Continue;
}
void SerializeColorGeneric(JsonSerializer *json,
......
......@@ -108,6 +108,16 @@ TEST_P(BufferDataTest, MAYBE_NULLData)
}
}
// If glBufferData was not called yet the capturing must not try to
// read the data. http://anglebug.com/6093
TEST_P(BufferDataTest, Uninitialized)
{
// Trigger frame capture to try capturing the
// generated but uninitialized buffer
glBindBuffer(GL_ARRAY_BUFFER, mBuffer);
swapBuffers();
}
TEST_P(BufferDataTest, ZeroNonNULLData)
{
glBindBuffer(GL_ARRAY_BUFFER, mBuffer);
......
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