Commit 263232ef by Jamie Madill Committed by Commit Bot

Trace/Replay: Pass CallCapture to parameter replay writer.

This will allow more advanced processing when writing the cpp replay for a specific parmeter. For the uniform locations map it'll allow us to look up the specified program from the call parameters. Bug: angleproject:4411 Change-Id: I4e91b3e4c6775c42140d00b2d155344b553a7404 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2067629Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent e3aee0b4
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"scripts/entry_point_packed_gl_enums.json": "scripts/entry_point_packed_gl_enums.json":
"63f508a08611e75810daedb297dca0e9", "63f508a08611e75810daedb297dca0e9",
"scripts/generate_entry_points.py": "scripts/generate_entry_points.py":
"2e6615919533b8ca9042093287589165", "e12540094b7f57778de97b05c16d2e28",
"scripts/gl.xml": "scripts/gl.xml":
"2af7b077ec347349b3a92683e8fb8b03", "2af7b077ec347349b3a92683e8fb8b03",
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
...@@ -96,9 +96,9 @@ ...@@ -96,9 +96,9 @@
"src/libANGLE/frame_capture_replay_autogen.cpp": "src/libANGLE/frame_capture_replay_autogen.cpp":
"c0d57704c21e0032a486a6195ddb87e4", "c0d57704c21e0032a486a6195ddb87e4",
"src/libANGLE/frame_capture_utils_autogen.cpp": "src/libANGLE/frame_capture_utils_autogen.cpp":
"ef0545342e0458e55e17abf46a8cde60", "cf2257638fb6df56061721775efda084",
"src/libANGLE/frame_capture_utils_autogen.h": "src/libANGLE/frame_capture_utils_autogen.h":
"637125f7c18f05c17800e5da2516fd6b", "1cd48ca4faeba4379456943d002ea412",
"src/libANGLE/validationES1_autogen.h": "src/libANGLE/validationES1_autogen.h":
"c8edb0a5b26303bf7c4692b9d0b05c1f", "c8edb0a5b26303bf7c4692b9d0b05c1f",
"src/libANGLE/validationES2_autogen.h": "src/libANGLE/validationES2_autogen.h":
......
...@@ -563,7 +563,10 @@ void InitParamValue(ParamType paramType, T valueIn, ParamValue *valueOut) ...@@ -563,7 +563,10 @@ void InitParamValue(ParamType paramType, T valueIn, ParamValue *valueOut)
}} }}
}} }}
void WriteParamTypeToStream(std::ostream &os, ParamType paramType, const ParamValue& paramValue); struct CallCapture;
struct ParamCapture;
void WriteParamCaptureReplay(std::ostream &os, const CallCapture &call, const ParamCapture &param);
const char *ParamTypeToString(ParamType paramType); const char *ParamTypeToString(ParamType paramType);
enum class ResourceIDType enum class ResourceIDType
...@@ -594,9 +597,9 @@ template_frame_capture_utils_source = """// GENERATED FILE - DO NOT EDIT. ...@@ -594,9 +597,9 @@ template_frame_capture_utils_source = """// GENERATED FILE - DO NOT EDIT.
namespace angle namespace angle
{{ {{
void WriteParamTypeToStream(std::ostream &os, ParamType paramType, const ParamValue& paramValue) void WriteParamCaptureReplay(std::ostream &os, const CallCapture &call, const ParamCapture &param)
{{ {{
switch (paramType) switch (param.type)
{{ {{
{write_param_type_to_stream_cases} {write_param_type_to_stream_cases}
default: default:
...@@ -659,7 +662,7 @@ template_init_param_value_case = """ case ParamType::T{enum}: ...@@ -659,7 +662,7 @@ template_init_param_value_case = """ case ParamType::T{enum}:
break;""" break;"""
template_write_param_type_to_stream_case = """ case ParamType::T{enum}: template_write_param_type_to_stream_case = """ case ParamType::T{enum}:
WriteParamValueToStream<ParamType::T{enum}>(os, paramValue.{union_name}); WriteParamValueReplay<ParamType::T{enum}>(os, call, param.value.{union_name});
break;""" break;"""
template_param_type_to_string_case = """ case ParamType::T{enum}: template_param_type_to_string_case = """ case ParamType::T{enum}:
......
...@@ -487,7 +487,7 @@ void WriteCppReplayForCall(const CallCapture &call, ...@@ -487,7 +487,7 @@ void WriteCppReplayForCall(const CallCapture &call,
} }
else else
{ {
callOut << param; WriteParamCaptureReplay(callOut, call, param);
} }
} }
else else
...@@ -2584,12 +2584,6 @@ void FrameCapture::reset() ...@@ -2584,12 +2584,6 @@ void FrameCapture::reset()
// necessary. // necessary.
} }
std::ostream &operator<<(std::ostream &os, const ParamCapture &capture)
{
WriteParamTypeToStream(os, capture.type, capture.value);
return os;
}
void CaptureMemory(const void *source, size_t size, ParamCapture *paramCapture) void CaptureMemory(const void *source, size_t size, ParamCapture *paramCapture)
{ {
std::vector<uint8_t> data(size); std::vector<uint8_t> data(size);
...@@ -2632,7 +2626,9 @@ void CaptureGenHandlesImpl(GLsizei n, GLuint *handles, ParamCapture *paramCaptur ...@@ -2632,7 +2626,9 @@ void CaptureGenHandlesImpl(GLsizei n, GLuint *handles, ParamCapture *paramCaptur
} }
template <> template <>
void WriteParamValueToStream<ParamType::TGLboolean>(std::ostream &os, GLboolean value) void WriteParamValueReplay<ParamType::TGLboolean>(std::ostream &os,
const CallCapture &call,
GLboolean value)
{ {
switch (value) switch (value)
{ {
...@@ -2648,7 +2644,9 @@ void WriteParamValueToStream<ParamType::TGLboolean>(std::ostream &os, GLboolean ...@@ -2648,7 +2644,9 @@ void WriteParamValueToStream<ParamType::TGLboolean>(std::ostream &os, GLboolean
} }
template <> template <>
void WriteParamValueToStream<ParamType::TvoidConstPointer>(std::ostream &os, const void *value) void WriteParamValueReplay<ParamType::TvoidConstPointer>(std::ostream &os,
const CallCapture &call,
const void *value)
{ {
if (value == 0) if (value == 0)
{ {
...@@ -2662,103 +2660,133 @@ void WriteParamValueToStream<ParamType::TvoidConstPointer>(std::ostream &os, con ...@@ -2662,103 +2660,133 @@ void WriteParamValueToStream<ParamType::TvoidConstPointer>(std::ostream &os, con
} }
template <> template <>
void WriteParamValueToStream<ParamType::TGLDEBUGPROCKHR>(std::ostream &os, GLDEBUGPROCKHR value) void WriteParamValueReplay<ParamType::TGLDEBUGPROCKHR>(std::ostream &os,
const CallCapture &call,
GLDEBUGPROCKHR value)
{} {}
template <> template <>
void WriteParamValueToStream<ParamType::TGLDEBUGPROC>(std::ostream &os, GLDEBUGPROC value) void WriteParamValueReplay<ParamType::TGLDEBUGPROC>(std::ostream &os,
const CallCapture &call,
GLDEBUGPROC value)
{} {}
template <> template <>
void WriteParamValueToStream<ParamType::TBufferID>(std::ostream &os, gl::BufferID value) void WriteParamValueReplay<ParamType::TBufferID>(std::ostream &os,
const CallCapture &call,
gl::BufferID value)
{ {
os << "gBufferMap[" << value.value << "]"; os << "gBufferMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TFenceNVID>(std::ostream &os, gl::FenceNVID value) void WriteParamValueReplay<ParamType::TFenceNVID>(std::ostream &os,
const CallCapture &call,
gl::FenceNVID value)
{ {
os << "gFenceMap[" << value.value << "]"; os << "gFenceMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TFramebufferID>(std::ostream &os, gl::FramebufferID value) void WriteParamValueReplay<ParamType::TFramebufferID>(std::ostream &os,
const CallCapture &call,
gl::FramebufferID value)
{ {
os << "gFramebufferMap[" << value.value << "]"; os << "gFramebufferMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TMemoryObjectID>(std::ostream &os, gl::MemoryObjectID value) void WriteParamValueReplay<ParamType::TMemoryObjectID>(std::ostream &os,
const CallCapture &call,
gl::MemoryObjectID value)
{ {
os << "gMemoryObjectMap[" << value.value << "]"; os << "gMemoryObjectMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TPathID>(std::ostream &os, gl::PathID value) void WriteParamValueReplay<ParamType::TPathID>(std::ostream &os,
const CallCapture &call,
gl::PathID value)
{ {
os << "gPathMap[" << value.value << "]"; os << "gPathMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TProgramPipelineID>(std::ostream &os, void WriteParamValueReplay<ParamType::TProgramPipelineID>(std::ostream &os,
gl::ProgramPipelineID value) const CallCapture &call,
gl::ProgramPipelineID value)
{ {
os << "gProgramPipelineMap[" << value.value << "]"; os << "gProgramPipelineMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TQueryID>(std::ostream &os, gl::QueryID value) void WriteParamValueReplay<ParamType::TQueryID>(std::ostream &os,
const CallCapture &call,
gl::QueryID value)
{ {
os << "gQueryMap[" << value.value << "]"; os << "gQueryMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TRenderbufferID>(std::ostream &os, gl::RenderbufferID value) void WriteParamValueReplay<ParamType::TRenderbufferID>(std::ostream &os,
const CallCapture &call,
gl::RenderbufferID value)
{ {
os << "gRenderbufferMap[" << value.value << "]"; os << "gRenderbufferMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TSamplerID>(std::ostream &os, gl::SamplerID value) void WriteParamValueReplay<ParamType::TSamplerID>(std::ostream &os,
const CallCapture &call,
gl::SamplerID value)
{ {
os << "gSamplerMap[" << value.value << "]"; os << "gSamplerMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TSemaphoreID>(std::ostream &os, gl::SemaphoreID value) void WriteParamValueReplay<ParamType::TSemaphoreID>(std::ostream &os,
const CallCapture &call,
gl::SemaphoreID value)
{ {
os << "gSempahoreMap[" << value.value << "]"; os << "gSempahoreMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TShaderProgramID>(std::ostream &os, void WriteParamValueReplay<ParamType::TShaderProgramID>(std::ostream &os,
gl::ShaderProgramID value) const CallCapture &call,
gl::ShaderProgramID value)
{ {
os << "gShaderProgramMap[" << value.value << "]"; os << "gShaderProgramMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TTextureID>(std::ostream &os, gl::TextureID value) void WriteParamValueReplay<ParamType::TTextureID>(std::ostream &os,
const CallCapture &call,
gl::TextureID value)
{ {
os << "gTextureMap[" << value.value << "]"; os << "gTextureMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TTransformFeedbackID>(std::ostream &os, void WriteParamValueReplay<ParamType::TTransformFeedbackID>(std::ostream &os,
gl::TransformFeedbackID value) const CallCapture &call,
gl::TransformFeedbackID value)
{ {
os << "gTransformFeedbackMap[" << value.value << "]"; os << "gTransformFeedbackMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TVertexArrayID>(std::ostream &os, gl::VertexArrayID value) void WriteParamValueReplay<ParamType::TVertexArrayID>(std::ostream &os,
const CallCapture &call,
gl::VertexArrayID value)
{ {
os << "gVertexArrayMap[" << value.value << "]"; os << "gVertexArrayMap[" << value.value << "]";
} }
template <> template <>
void WriteParamValueToStream<ParamType::TUniformLocation>(std::ostream &os, void WriteParamValueReplay<ParamType::TUniformLocation>(std::ostream &os,
gl::UniformLocation value) const CallCapture &call,
gl::UniformLocation value)
{ {
// TODO(jmadill): Uniform locations map. http://anglebug.com/4411 // TODO(jmadill): Uniform locations map. http://anglebug.com/4411
os << value.value; os << value.value;
......
...@@ -295,74 +295,106 @@ void CaptureGenHandles(GLsizei n, T *handles, ParamCapture *paramCapture) ...@@ -295,74 +295,106 @@ void CaptureGenHandles(GLsizei n, T *handles, ParamCapture *paramCapture)
} }
template <ParamType ParamT, typename T> template <ParamType ParamT, typename T>
void WriteParamValueToStream(std::ostream &os, T value); void WriteParamValueReplay(std::ostream &os, const CallCapture &call, T value);
template <> template <>
void WriteParamValueToStream<ParamType::TGLboolean>(std::ostream &os, GLboolean value); void WriteParamValueReplay<ParamType::TGLboolean>(std::ostream &os,
const CallCapture &call,
GLboolean value);
template <> template <>
void WriteParamValueToStream<ParamType::TvoidConstPointer>(std::ostream &os, const void *value); void WriteParamValueReplay<ParamType::TvoidConstPointer>(std::ostream &os,
const CallCapture &call,
const void *value);
template <> template <>
void WriteParamValueToStream<ParamType::TGLDEBUGPROCKHR>(std::ostream &os, GLDEBUGPROCKHR value); void WriteParamValueReplay<ParamType::TGLDEBUGPROCKHR>(std::ostream &os,
const CallCapture &call,
GLDEBUGPROCKHR value);
template <> template <>
void WriteParamValueToStream<ParamType::TGLDEBUGPROC>(std::ostream &os, GLDEBUGPROC value); void WriteParamValueReplay<ParamType::TGLDEBUGPROC>(std::ostream &os,
const CallCapture &call,
GLDEBUGPROC value);
template <> template <>
void WriteParamValueToStream<ParamType::TBufferID>(std::ostream &os, gl::BufferID value); void WriteParamValueReplay<ParamType::TBufferID>(std::ostream &os,
const CallCapture &call,
gl::BufferID value);
template <> template <>
void WriteParamValueToStream<ParamType::TFenceNVID>(std::ostream &os, gl::FenceNVID value); void WriteParamValueReplay<ParamType::TFenceNVID>(std::ostream &os,
const CallCapture &call,
gl::FenceNVID value);
template <> template <>
void WriteParamValueToStream<ParamType::TFramebufferID>(std::ostream &os, gl::FramebufferID value); void WriteParamValueReplay<ParamType::TFramebufferID>(std::ostream &os,
const CallCapture &call,
gl::FramebufferID value);
template <> template <>
void WriteParamValueToStream<ParamType::TMemoryObjectID>(std::ostream &os, void WriteParamValueReplay<ParamType::TMemoryObjectID>(std::ostream &os,
gl::MemoryObjectID value); const CallCapture &call,
gl::MemoryObjectID value);
template <> template <>
void WriteParamValueToStream<ParamType::TPathID>(std::ostream &os, gl::PathID value); void WriteParamValueReplay<ParamType::TPathID>(std::ostream &os,
const CallCapture &call,
gl::PathID value);
template <> template <>
void WriteParamValueToStream<ParamType::TProgramPipelineID>(std::ostream &os, void WriteParamValueReplay<ParamType::TProgramPipelineID>(std::ostream &os,
gl::ProgramPipelineID value); const CallCapture &call,
gl::ProgramPipelineID value);
template <> template <>
void WriteParamValueToStream<ParamType::TQueryID>(std::ostream &os, gl::QueryID value); void WriteParamValueReplay<ParamType::TQueryID>(std::ostream &os,
const CallCapture &call,
gl::QueryID value);
template <> template <>
void WriteParamValueToStream<ParamType::TRenderbufferID>(std::ostream &os, void WriteParamValueReplay<ParamType::TRenderbufferID>(std::ostream &os,
gl::RenderbufferID value); const CallCapture &call,
gl::RenderbufferID value);
template <> template <>
void WriteParamValueToStream<ParamType::TSamplerID>(std::ostream &os, gl::SamplerID value); void WriteParamValueReplay<ParamType::TSamplerID>(std::ostream &os,
const CallCapture &call,
gl::SamplerID value);
template <> template <>
void WriteParamValueToStream<ParamType::TSemaphoreID>(std::ostream &os, gl::SemaphoreID value); void WriteParamValueReplay<ParamType::TSemaphoreID>(std::ostream &os,
const CallCapture &call,
gl::SemaphoreID value);
template <> template <>
void WriteParamValueToStream<ParamType::TShaderProgramID>(std::ostream &os, void WriteParamValueReplay<ParamType::TShaderProgramID>(std::ostream &os,
gl::ShaderProgramID value); const CallCapture &call,
gl::ShaderProgramID value);
template <> template <>
void WriteParamValueToStream<ParamType::TTextureID>(std::ostream &os, gl::TextureID value); void WriteParamValueReplay<ParamType::TTextureID>(std::ostream &os,
const CallCapture &call,
gl::TextureID value);
template <> template <>
void WriteParamValueToStream<ParamType::TTransformFeedbackID>(std::ostream &os, void WriteParamValueReplay<ParamType::TTransformFeedbackID>(std::ostream &os,
gl::TransformFeedbackID value); const CallCapture &call,
gl::TransformFeedbackID value);
template <> template <>
void WriteParamValueToStream<ParamType::TVertexArrayID>(std::ostream &os, gl::VertexArrayID value); void WriteParamValueReplay<ParamType::TVertexArrayID>(std::ostream &os,
const CallCapture &call,
gl::VertexArrayID value);
template <> template <>
void WriteParamValueToStream<ParamType::TUniformLocation>(std::ostream &os, void WriteParamValueReplay<ParamType::TUniformLocation>(std::ostream &os,
gl::UniformLocation value); const CallCapture &call,
gl::UniformLocation value);
// General fallback for any unspecific type. // General fallback for any unspecific type.
template <ParamType ParamT, typename T> template <ParamType ParamT, typename T>
void WriteParamValueToStream(std::ostream &os, T value) void WriteParamValueReplay(std::ostream &os, const CallCapture &call, T value)
{ {
os << value; os << value;
} }
......
...@@ -2491,7 +2491,10 @@ void InitParamValue(ParamType paramType, T valueIn, ParamValue *valueOut) ...@@ -2491,7 +2491,10 @@ void InitParamValue(ParamType paramType, T valueIn, ParamValue *valueOut)
} }
} }
void WriteParamTypeToStream(std::ostream &os, ParamType paramType, const ParamValue &paramValue); struct CallCapture;
struct ParamCapture;
void WriteParamCaptureReplay(std::ostream &os, const CallCapture &call, const ParamCapture &param);
const char *ParamTypeToString(ParamType paramType); const char *ParamTypeToString(ParamType paramType);
enum class ResourceIDType enum class ResourceIDType
......
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