Add capture support for FenceSync

This allows us to capture Angry Birds 2 traces.

Bug: b/153652100
Change-Id: I99a47f9e41a84218b3bb3d9740df4bb7fc2a01fa
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2144763
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
This commit is contained in:
Courtney Goeltzenleuchter 2020-04-21 07:58:47 -06:00 коммит произвёл Commit Bot
Родитель 183c555734
Коммит b5992a55c3
8 изменённых файлов: 75 добавлений и 7 удалений

Просмотреть файл

@ -1,6 +1,6 @@
{
"scripts/gen_gl_enum_utils.py":
"f25cdc74b57d10a1cbc4194a72e971af",
"af9ec09ac89a73c9fe0dd510a1db4b38",
"scripts/gl.xml":
"e74a595068cbdd6064300be1e71b7cc9",
"scripts/gl_angle_ext.xml":
@ -8,7 +8,7 @@
"scripts/registry_xml.py":
"d48b9fcf30e2f98210f0b98824e7bd49",
"src/libANGLE/gl_enum_utils_autogen.cpp":
"591432182a8cb304b7a3747ee6cc7b60",
"48627c0865d15bf4014327de5858d3c5",
"src/libANGLE/gl_enum_utils_autogen.h":
"dd54f34be733affcb994fc315c3b972d"
}

Просмотреть файл

@ -73,6 +73,11 @@ std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value)
{{
std::stringstream st;
if (value == 0)
{{
return "0";
}}
const angle::BitSet<32> bitSet(value);
bool first = true;
for (const auto index : bitSet)

Просмотреть файл

@ -469,6 +469,11 @@ void WriteBinaryParamReplay(DataCounters *counters,
}
}
uintptr_t SyncIndexValue(GLsync sync)
{
return reinterpret_cast<uintptr_t>(sync);
}
void WriteCppReplayForCall(const CallCapture &call,
DataCounters *counters,
std::ostream &out,
@ -484,6 +489,12 @@ void WriteCppReplayForCall(const CallCapture &call,
callOut << "gShaderProgramMap[" << id << "] = ";
}
if (call.entryPoint == gl::EntryPoint::FenceSync)
{
GLsync sync = call.params.getReturnValue().value.GLsyncVal;
callOut << "gSyncMap[" << SyncIndexValue(sync) << "] = ";
}
if (call.entryPoint == gl::EntryPoint::MapBufferRange ||
call.entryPoint == gl::EntryPoint::MapBufferRangeEXT)
{
@ -532,6 +543,21 @@ void WriteCppReplayForCall(const CallCapture &call,
{
WriteGLFloatValue(callOut, param.value.GLfloatVal);
}
else if (param.type == ParamType::TGLsync)
{
callOut << "gSyncMap[" << SyncIndexValue(param.value.GLsyncVal) << "]";
}
else if (param.type == ParamType::TGLuint64 && param.name == "timeout")
{
if (param.value.GLuint64Val == GL_TIMEOUT_IGNORED)
{
callOut << "GL_TIMEOUT_IGNORED";
}
else
{
WriteParamCaptureReplay(callOut, call, param);
}
}
else
{
WriteParamCaptureReplay(callOut, call, param);
@ -933,6 +959,10 @@ void WriteCppReplayIndexFiles(bool compression,
source << "ResourceMap g" << name << "Map;\n";
}
header << "using SyncResourceMap = std::unordered_map<uintptr_t, GLsync>;\n";
header << "extern SyncResourceMap gSyncMap;\n";
source << "SyncResourceMap gSyncMap;\n";
header << "\n";
source << "\n";
@ -3809,6 +3839,14 @@ void WriteParamValueReplay<ParamType::TShaderProgramID>(std::ostream &os,
os << "gShaderProgramMap[" << value.value << "]";
}
template <>
void WriteParamValueReplay<ParamType::TGLsync>(std::ostream &os,
const CallCapture &call,
GLsync value)
{
os << "gSyncMap[" << SyncIndexValue(value) << "]";
}
template <>
void WriteParamValueReplay<ParamType::TTextureID>(std::ostream &os,
const CallCapture &call,

Просмотреть файл

@ -403,6 +403,11 @@ void WriteParamValueReplay<ParamType::TUniformLocation>(std::ostream &os,
const CallCapture &call,
gl::UniformLocation value);
template <>
void WriteParamValueReplay<ParamType::TGLsync>(std::ostream &os,
const CallCapture &call,
GLsync value);
// General fallback for any unspecific type.
template <ParamType ParamT, typename T>
void WriteParamValueReplay(std::ostream &os, const CallCapture &call, T value)

Просмотреть файл

@ -455,7 +455,10 @@ void CaptureGetSynciv_length(const State &glState,
GLint *values,
ParamCapture *paramCapture)
{
UNIMPLEMENTED();
if (length)
{
paramCapture->readBufferSizeBytes = sizeof(GLsizei);
}
}
void CaptureGetSynciv_values(const State &glState,
@ -467,7 +470,16 @@ void CaptureGetSynciv_values(const State &glState,
GLint *values,
ParamCapture *paramCapture)
{
UNIMPLEMENTED();
// Spec: On success, GetSynciv replaces up to bufSize integers in values with the corresponding
// property values of the object being queried. The actual number of integers replaced is
// returned in *length.If length is NULL, no length is returned.
if (bufSize == 0)
return;
if (values)
{
paramCapture->readBufferSizeBytes = sizeof(GLint) * bufSize;
}
}
void CaptureGetTransformFeedbackVarying_length(const State &glState,
@ -594,7 +606,8 @@ void CaptureInvalidateFramebuffer_attachments(const State &glState,
const GLenum *attachments,
ParamCapture *paramCapture)
{
UNIMPLEMENTED();
CaptureMemory(attachments, sizeof(GLenum) * numAttachments, paramCapture);
paramCapture->value.voidConstPointerVal = paramCapture->data[0].data();
}
void CaptureInvalidateSubFramebuffer_attachments(const State &glState,

Просмотреть файл

@ -8,6 +8,7 @@
#include "libANGLE/capture_gles_ext_autogen.h"
#include "libANGLE/capture_gles_2_0_autogen.h"
#include "libANGLE/capture_gles_3_0_autogen.h"
using namespace angle;
@ -262,7 +263,8 @@ void CaptureDrawElementsBaseVertexOES_indices(const State &glState,
GLint basevertex,
ParamCapture *indicesParam)
{
UNIMPLEMENTED();
CaptureDrawElements_indices(glState, isCallValid, modePacked, count, typePacked, indices,
indicesParam);
}
void CaptureDrawElementsInstancedBaseVertexOES_indices(const State &glState,

Просмотреть файл

@ -4038,6 +4038,11 @@ std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value)
{
std::stringstream st;
if (value == 0)
{
return "0";
}
const angle::BitSet<32> bitSet(value);
bool first = true;
for (const auto index : bitSet)

Просмотреть файл

@ -195,7 +195,7 @@ TEST_P(FenceSyncTest, Errors)
EXPECT_EQ(20, length);
EXPECT_EQ(30, value);
// glGetSynciv generates GL_INVALID_VALUE if the sync object tis not valid, results should be
// glGetSynciv generates GL_INVALID_VALUE if the sync object is not valid, results should be
// untouched
glGetSynciv(reinterpret_cast<GLsync>(30), GL_OBJECT_TYPE, 1, &length, &value);
EXPECT_GL_ERROR(GL_INVALID_VALUE);