Commit b5992a55 by Courtney Goeltzenleuchter Committed by Commit Bot

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/+/2144763Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
parent 183c5557
{ {
"scripts/gen_gl_enum_utils.py": "scripts/gen_gl_enum_utils.py":
"f25cdc74b57d10a1cbc4194a72e971af", "af9ec09ac89a73c9fe0dd510a1db4b38",
"scripts/gl.xml": "scripts/gl.xml":
"e74a595068cbdd6064300be1e71b7cc9", "e74a595068cbdd6064300be1e71b7cc9",
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"scripts/registry_xml.py": "scripts/registry_xml.py":
"d48b9fcf30e2f98210f0b98824e7bd49", "d48b9fcf30e2f98210f0b98824e7bd49",
"src/libANGLE/gl_enum_utils_autogen.cpp": "src/libANGLE/gl_enum_utils_autogen.cpp":
"591432182a8cb304b7a3747ee6cc7b60", "48627c0865d15bf4014327de5858d3c5",
"src/libANGLE/gl_enum_utils_autogen.h": "src/libANGLE/gl_enum_utils_autogen.h":
"dd54f34be733affcb994fc315c3b972d" "dd54f34be733affcb994fc315c3b972d"
} }
\ No newline at end of file
...@@ -73,6 +73,11 @@ std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value) ...@@ -73,6 +73,11 @@ std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value)
{{ {{
std::stringstream st; std::stringstream st;
if (value == 0)
{{
return "0";
}}
const angle::BitSet<32> bitSet(value); const angle::BitSet<32> bitSet(value);
bool first = true; bool first = true;
for (const auto index : bitSet) for (const auto index : bitSet)
......
...@@ -469,6 +469,11 @@ void WriteBinaryParamReplay(DataCounters *counters, ...@@ -469,6 +469,11 @@ void WriteBinaryParamReplay(DataCounters *counters,
} }
} }
uintptr_t SyncIndexValue(GLsync sync)
{
return reinterpret_cast<uintptr_t>(sync);
}
void WriteCppReplayForCall(const CallCapture &call, void WriteCppReplayForCall(const CallCapture &call,
DataCounters *counters, DataCounters *counters,
std::ostream &out, std::ostream &out,
...@@ -484,6 +489,12 @@ void WriteCppReplayForCall(const CallCapture &call, ...@@ -484,6 +489,12 @@ void WriteCppReplayForCall(const CallCapture &call,
callOut << "gShaderProgramMap[" << id << "] = "; 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 || if (call.entryPoint == gl::EntryPoint::MapBufferRange ||
call.entryPoint == gl::EntryPoint::MapBufferRangeEXT) call.entryPoint == gl::EntryPoint::MapBufferRangeEXT)
{ {
...@@ -532,6 +543,21 @@ void WriteCppReplayForCall(const CallCapture &call, ...@@ -532,6 +543,21 @@ void WriteCppReplayForCall(const CallCapture &call,
{ {
WriteGLFloatValue(callOut, param.value.GLfloatVal); 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 else
{ {
WriteParamCaptureReplay(callOut, call, param); WriteParamCaptureReplay(callOut, call, param);
...@@ -933,6 +959,10 @@ void WriteCppReplayIndexFiles(bool compression, ...@@ -933,6 +959,10 @@ void WriteCppReplayIndexFiles(bool compression,
source << "ResourceMap g" << name << "Map;\n"; 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"; header << "\n";
source << "\n"; source << "\n";
...@@ -3810,6 +3840,14 @@ void WriteParamValueReplay<ParamType::TShaderProgramID>(std::ostream &os, ...@@ -3810,6 +3840,14 @@ void WriteParamValueReplay<ParamType::TShaderProgramID>(std::ostream &os,
} }
template <> 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, void WriteParamValueReplay<ParamType::TTextureID>(std::ostream &os,
const CallCapture &call, const CallCapture &call,
gl::TextureID value) gl::TextureID value)
......
...@@ -403,6 +403,11 @@ void WriteParamValueReplay<ParamType::TUniformLocation>(std::ostream &os, ...@@ -403,6 +403,11 @@ void WriteParamValueReplay<ParamType::TUniformLocation>(std::ostream &os,
const CallCapture &call, const CallCapture &call,
gl::UniformLocation value); gl::UniformLocation value);
template <>
void WriteParamValueReplay<ParamType::TGLsync>(std::ostream &os,
const CallCapture &call,
GLsync value);
// General fallback for any unspecific type. // General fallback for any unspecific type.
template <ParamType ParamT, typename T> template <ParamType ParamT, typename T>
void WriteParamValueReplay(std::ostream &os, const CallCapture &call, T value) void WriteParamValueReplay(std::ostream &os, const CallCapture &call, T value)
......
...@@ -455,7 +455,10 @@ void CaptureGetSynciv_length(const State &glState, ...@@ -455,7 +455,10 @@ void CaptureGetSynciv_length(const State &glState,
GLint *values, GLint *values,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); if (length)
{
paramCapture->readBufferSizeBytes = sizeof(GLsizei);
}
} }
void CaptureGetSynciv_values(const State &glState, void CaptureGetSynciv_values(const State &glState,
...@@ -467,7 +470,16 @@ void CaptureGetSynciv_values(const State &glState, ...@@ -467,7 +470,16 @@ void CaptureGetSynciv_values(const State &glState,
GLint *values, GLint *values,
ParamCapture *paramCapture) 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, void CaptureGetTransformFeedbackVarying_length(const State &glState,
...@@ -594,7 +606,8 @@ void CaptureInvalidateFramebuffer_attachments(const State &glState, ...@@ -594,7 +606,8 @@ void CaptureInvalidateFramebuffer_attachments(const State &glState,
const GLenum *attachments, const GLenum *attachments,
ParamCapture *paramCapture) ParamCapture *paramCapture)
{ {
UNIMPLEMENTED(); CaptureMemory(attachments, sizeof(GLenum) * numAttachments, paramCapture);
paramCapture->value.voidConstPointerVal = paramCapture->data[0].data();
} }
void CaptureInvalidateSubFramebuffer_attachments(const State &glState, void CaptureInvalidateSubFramebuffer_attachments(const State &glState,
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "libANGLE/capture_gles_ext_autogen.h" #include "libANGLE/capture_gles_ext_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"
using namespace angle; using namespace angle;
...@@ -262,7 +263,8 @@ void CaptureDrawElementsBaseVertexOES_indices(const State &glState, ...@@ -262,7 +263,8 @@ void CaptureDrawElementsBaseVertexOES_indices(const State &glState,
GLint basevertex, GLint basevertex,
ParamCapture *indicesParam) ParamCapture *indicesParam)
{ {
UNIMPLEMENTED(); CaptureDrawElements_indices(glState, isCallValid, modePacked, count, typePacked, indices,
indicesParam);
} }
void CaptureDrawElementsInstancedBaseVertexOES_indices(const State &glState, void CaptureDrawElementsInstancedBaseVertexOES_indices(const State &glState,
......
...@@ -4038,6 +4038,11 @@ std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value) ...@@ -4038,6 +4038,11 @@ std::string GLbitfieldToString(GLenumGroup enumGroup, unsigned int value)
{ {
std::stringstream st; std::stringstream st;
if (value == 0)
{
return "0";
}
const angle::BitSet<32> bitSet(value); const angle::BitSet<32> bitSet(value);
bool first = true; bool first = true;
for (const auto index : bitSet) for (const auto index : bitSet)
......
...@@ -195,7 +195,7 @@ TEST_P(FenceSyncTest, Errors) ...@@ -195,7 +195,7 @@ TEST_P(FenceSyncTest, Errors)
EXPECT_EQ(20, length); EXPECT_EQ(20, length);
EXPECT_EQ(30, value); 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 // untouched
glGetSynciv(reinterpret_cast<GLsync>(30), GL_OBJECT_TYPE, 1, &length, &value); glGetSynciv(reinterpret_cast<GLsync>(30), GL_OBJECT_TYPE, 1, &length, &value);
EXPECT_GL_ERROR(GL_INVALID_VALUE); EXPECT_GL_ERROR(GL_INVALID_VALUE);
......
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