Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 263232e

Browse files
null77Commit Bot
authored andcommitted
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/+/2067629 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
1 parent e3aee0b commit 263232e

File tree

6 files changed

+339
-246
lines changed

6 files changed

+339
-246
lines changed

scripts/code_generation_hashes/GL_EGL_entry_points.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts/entry_point_packed_gl_enums.json":
77
"63f508a08611e75810daedb297dca0e9",
88
"scripts/generate_entry_points.py":
9-
"2e6615919533b8ca9042093287589165",
9+
"e12540094b7f57778de97b05c16d2e28",
1010
"scripts/gl.xml":
1111
"2af7b077ec347349b3a92683e8fb8b03",
1212
"scripts/gl_angle_ext.xml":
@@ -96,9 +96,9 @@
9696
"src/libANGLE/frame_capture_replay_autogen.cpp":
9797
"c0d57704c21e0032a486a6195ddb87e4",
9898
"src/libANGLE/frame_capture_utils_autogen.cpp":
99-
"ef0545342e0458e55e17abf46a8cde60",
99+
"cf2257638fb6df56061721775efda084",
100100
"src/libANGLE/frame_capture_utils_autogen.h":
101-
"637125f7c18f05c17800e5da2516fd6b",
101+
"1cd48ca4faeba4379456943d002ea412",
102102
"src/libANGLE/validationES1_autogen.h":
103103
"c8edb0a5b26303bf7c4692b9d0b05c1f",
104104
"src/libANGLE/validationES2_autogen.h":

scripts/generate_entry_points.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,10 @@ class Context;
563563
}}
564564
}}
565565
566-
void WriteParamTypeToStream(std::ostream &os, ParamType paramType, const ParamValue& paramValue);
566+
struct CallCapture;
567+
struct ParamCapture;
568+
569+
void WriteParamCaptureReplay(std::ostream &os, const CallCapture &call, const ParamCapture &param);
567570
const char *ParamTypeToString(ParamType paramType);
568571
569572
enum class ResourceIDType
@@ -594,9 +597,9 @@ class Context;
594597
595598
namespace angle
596599
{{
597-
void WriteParamTypeToStream(std::ostream &os, ParamType paramType, const ParamValue& paramValue)
600+
void WriteParamCaptureReplay(std::ostream &os, const CallCapture &call, const ParamCapture &param)
598601
{{
599-
switch (paramType)
602+
switch (param.type)
600603
{{
601604
{write_param_type_to_stream_cases}
602605
default:
@@ -659,7 +662,7 @@ class Context;
659662
break;"""
660663

661664
template_write_param_type_to_stream_case = """ case ParamType::T{enum}:
662-
WriteParamValueToStream<ParamType::T{enum}>(os, paramValue.{union_name});
665+
WriteParamValueReplay<ParamType::T{enum}>(os, call, param.value.{union_name});
663666
break;"""
664667

665668
template_param_type_to_string_case = """ case ParamType::T{enum}:

src/libANGLE/FrameCapture.cpp

Lines changed: 58 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ void WriteCppReplayForCall(const CallCapture &call,
487487
}
488488
else
489489
{
490-
callOut << param;
490+
WriteParamCaptureReplay(callOut, call, param);
491491
}
492492
}
493493
else
@@ -2584,12 +2584,6 @@ void FrameCapture::reset()
25842584
// necessary.
25852585
}
25862586

2587-
std::ostream &operator<<(std::ostream &os, const ParamCapture &capture)
2588-
{
2589-
WriteParamTypeToStream(os, capture.type, capture.value);
2590-
return os;
2591-
}
2592-
25932587
void CaptureMemory(const void *source, size_t size, ParamCapture *paramCapture)
25942588
{
25952589
std::vector<uint8_t> data(size);
@@ -2632,7 +2626,9 @@ void CaptureGenHandlesImpl(GLsizei n, GLuint *handles, ParamCapture *paramCaptur
26322626
}
26332627

26342628
template <>
2635-
void WriteParamValueToStream<ParamType::TGLboolean>(std::ostream &os, GLboolean value)
2629+
void WriteParamValueReplay<ParamType::TGLboolean>(std::ostream &os,
2630+
const CallCapture &call,
2631+
GLboolean value)
26362632
{
26372633
switch (value)
26382634
{
@@ -2648,7 +2644,9 @@ void WriteParamValueToStream<ParamType::TGLboolean>(std::ostream &os, GLboolean
26482644
}
26492645

26502646
template <>
2651-
void WriteParamValueToStream<ParamType::TvoidConstPointer>(std::ostream &os, const void *value)
2647+
void WriteParamValueReplay<ParamType::TvoidConstPointer>(std::ostream &os,
2648+
const CallCapture &call,
2649+
const void *value)
26522650
{
26532651
if (value == 0)
26542652
{
@@ -2662,103 +2660,133 @@ void WriteParamValueToStream<ParamType::TvoidConstPointer>(std::ostream &os, con
26622660
}
26632661

26642662
template <>
2665-
void WriteParamValueToStream<ParamType::TGLDEBUGPROCKHR>(std::ostream &os, GLDEBUGPROCKHR value)
2663+
void WriteParamValueReplay<ParamType::TGLDEBUGPROCKHR>(std::ostream &os,
2664+
const CallCapture &call,
2665+
GLDEBUGPROCKHR value)
26662666
{}
26672667

26682668
template <>
2669-
void WriteParamValueToStream<ParamType::TGLDEBUGPROC>(std::ostream &os, GLDEBUGPROC value)
2669+
void WriteParamValueReplay<ParamType::TGLDEBUGPROC>(std::ostream &os,
2670+
const CallCapture &call,
2671+
GLDEBUGPROC value)
26702672
{}
26712673

26722674
template <>
2673-
void WriteParamValueToStream<ParamType::TBufferID>(std::ostream &os, gl::BufferID value)
2675+
void WriteParamValueReplay<ParamType::TBufferID>(std::ostream &os,
2676+
const CallCapture &call,
2677+
gl::BufferID value)
26742678
{
26752679
os << "gBufferMap[" << value.value << "]";
26762680
}
26772681

26782682
template <>
2679-
void WriteParamValueToStream<ParamType::TFenceNVID>(std::ostream &os, gl::FenceNVID value)
2683+
void WriteParamValueReplay<ParamType::TFenceNVID>(std::ostream &os,
2684+
const CallCapture &call,
2685+
gl::FenceNVID value)
26802686
{
26812687
os << "gFenceMap[" << value.value << "]";
26822688
}
26832689

26842690
template <>
2685-
void WriteParamValueToStream<ParamType::TFramebufferID>(std::ostream &os, gl::FramebufferID value)
2691+
void WriteParamValueReplay<ParamType::TFramebufferID>(std::ostream &os,
2692+
const CallCapture &call,
2693+
gl::FramebufferID value)
26862694
{
26872695
os << "gFramebufferMap[" << value.value << "]";
26882696
}
26892697

26902698
template <>
2691-
void WriteParamValueToStream<ParamType::TMemoryObjectID>(std::ostream &os, gl::MemoryObjectID value)
2699+
void WriteParamValueReplay<ParamType::TMemoryObjectID>(std::ostream &os,
2700+
const CallCapture &call,
2701+
gl::MemoryObjectID value)
26922702
{
26932703
os << "gMemoryObjectMap[" << value.value << "]";
26942704
}
26952705

26962706
template <>
2697-
void WriteParamValueToStream<ParamType::TPathID>(std::ostream &os, gl::PathID value)
2707+
void WriteParamValueReplay<ParamType::TPathID>(std::ostream &os,
2708+
const CallCapture &call,
2709+
gl::PathID value)
26982710
{
26992711
os << "gPathMap[" << value.value << "]";
27002712
}
27012713

27022714
template <>
2703-
void WriteParamValueToStream<ParamType::TProgramPipelineID>(std::ostream &os,
2704-
gl::ProgramPipelineID value)
2715+
void WriteParamValueReplay<ParamType::TProgramPipelineID>(std::ostream &os,
2716+
const CallCapture &call,
2717+
gl::ProgramPipelineID value)
27052718
{
27062719
os << "gProgramPipelineMap[" << value.value << "]";
27072720
}
27082721

27092722
template <>
2710-
void WriteParamValueToStream<ParamType::TQueryID>(std::ostream &os, gl::QueryID value)
2723+
void WriteParamValueReplay<ParamType::TQueryID>(std::ostream &os,
2724+
const CallCapture &call,
2725+
gl::QueryID value)
27112726
{
27122727
os << "gQueryMap[" << value.value << "]";
27132728
}
27142729

27152730
template <>
2716-
void WriteParamValueToStream<ParamType::TRenderbufferID>(std::ostream &os, gl::RenderbufferID value)
2731+
void WriteParamValueReplay<ParamType::TRenderbufferID>(std::ostream &os,
2732+
const CallCapture &call,
2733+
gl::RenderbufferID value)
27172734
{
27182735
os << "gRenderbufferMap[" << value.value << "]";
27192736
}
27202737

27212738
template <>
2722-
void WriteParamValueToStream<ParamType::TSamplerID>(std::ostream &os, gl::SamplerID value)
2739+
void WriteParamValueReplay<ParamType::TSamplerID>(std::ostream &os,
2740+
const CallCapture &call,
2741+
gl::SamplerID value)
27232742
{
27242743
os << "gSamplerMap[" << value.value << "]";
27252744
}
27262745

27272746
template <>
2728-
void WriteParamValueToStream<ParamType::TSemaphoreID>(std::ostream &os, gl::SemaphoreID value)
2747+
void WriteParamValueReplay<ParamType::TSemaphoreID>(std::ostream &os,
2748+
const CallCapture &call,
2749+
gl::SemaphoreID value)
27292750
{
27302751
os << "gSempahoreMap[" << value.value << "]";
27312752
}
27322753

27332754
template <>
2734-
void WriteParamValueToStream<ParamType::TShaderProgramID>(std::ostream &os,
2735-
gl::ShaderProgramID value)
2755+
void WriteParamValueReplay<ParamType::TShaderProgramID>(std::ostream &os,
2756+
const CallCapture &call,
2757+
gl::ShaderProgramID value)
27362758
{
27372759
os << "gShaderProgramMap[" << value.value << "]";
27382760
}
27392761

27402762
template <>
2741-
void WriteParamValueToStream<ParamType::TTextureID>(std::ostream &os, gl::TextureID value)
2763+
void WriteParamValueReplay<ParamType::TTextureID>(std::ostream &os,
2764+
const CallCapture &call,
2765+
gl::TextureID value)
27422766
{
27432767
os << "gTextureMap[" << value.value << "]";
27442768
}
27452769

27462770
template <>
2747-
void WriteParamValueToStream<ParamType::TTransformFeedbackID>(std::ostream &os,
2748-
gl::TransformFeedbackID value)
2771+
void WriteParamValueReplay<ParamType::TTransformFeedbackID>(std::ostream &os,
2772+
const CallCapture &call,
2773+
gl::TransformFeedbackID value)
27492774
{
27502775
os << "gTransformFeedbackMap[" << value.value << "]";
27512776
}
27522777

27532778
template <>
2754-
void WriteParamValueToStream<ParamType::TVertexArrayID>(std::ostream &os, gl::VertexArrayID value)
2779+
void WriteParamValueReplay<ParamType::TVertexArrayID>(std::ostream &os,
2780+
const CallCapture &call,
2781+
gl::VertexArrayID value)
27552782
{
27562783
os << "gVertexArrayMap[" << value.value << "]";
27572784
}
27582785

27592786
template <>
2760-
void WriteParamValueToStream<ParamType::TUniformLocation>(std::ostream &os,
2761-
gl::UniformLocation value)
2787+
void WriteParamValueReplay<ParamType::TUniformLocation>(std::ostream &os,
2788+
const CallCapture &call,
2789+
gl::UniformLocation value)
27622790
{
27632791
// TODO(jmadill): Uniform locations map. http://anglebug.com/4411
27642792
os << value.value;

src/libANGLE/FrameCapture.h

Lines changed: 59 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -295,74 +295,106 @@ void CaptureGenHandles(GLsizei n, T *handles, ParamCapture *paramCapture)
295295
}
296296

297297
template <ParamType ParamT, typename T>
298-
void WriteParamValueToStream(std::ostream &os, T value);
298+
void WriteParamValueReplay(std::ostream &os, const CallCapture &call, T value);
299299

300300
template <>
301-
void WriteParamValueToStream<ParamType::TGLboolean>(std::ostream &os, GLboolean value);
301+
void WriteParamValueReplay<ParamType::TGLboolean>(std::ostream &os,
302+
const CallCapture &call,
303+
GLboolean value);
302304

303305
template <>
304-
void WriteParamValueToStream<ParamType::TvoidConstPointer>(std::ostream &os, const void *value);
306+
void WriteParamValueReplay<ParamType::TvoidConstPointer>(std::ostream &os,
307+
const CallCapture &call,
308+
const void *value);
305309

306310
template <>
307-
void WriteParamValueToStream<ParamType::TGLDEBUGPROCKHR>(std::ostream &os, GLDEBUGPROCKHR value);
311+
void WriteParamValueReplay<ParamType::TGLDEBUGPROCKHR>(std::ostream &os,
312+
const CallCapture &call,
313+
GLDEBUGPROCKHR value);
308314

309315
template <>
310-
void WriteParamValueToStream<ParamType::TGLDEBUGPROC>(std::ostream &os, GLDEBUGPROC value);
316+
void WriteParamValueReplay<ParamType::TGLDEBUGPROC>(std::ostream &os,
317+
const CallCapture &call,
318+
GLDEBUGPROC value);
311319

312320
template <>
313-
void WriteParamValueToStream<ParamType::TBufferID>(std::ostream &os, gl::BufferID value);
321+
void WriteParamValueReplay<ParamType::TBufferID>(std::ostream &os,
322+
const CallCapture &call,
323+
gl::BufferID value);
314324

315325
template <>
316-
void WriteParamValueToStream<ParamType::TFenceNVID>(std::ostream &os, gl::FenceNVID value);
326+
void WriteParamValueReplay<ParamType::TFenceNVID>(std::ostream &os,
327+
const CallCapture &call,
328+
gl::FenceNVID value);
317329

318330
template <>
319-
void WriteParamValueToStream<ParamType::TFramebufferID>(std::ostream &os, gl::FramebufferID value);
331+
void WriteParamValueReplay<ParamType::TFramebufferID>(std::ostream &os,
332+
const CallCapture &call,
333+
gl::FramebufferID value);
320334

321335
template <>
322-
void WriteParamValueToStream<ParamType::TMemoryObjectID>(std::ostream &os,
323-
gl::MemoryObjectID value);
336+
void WriteParamValueReplay<ParamType::TMemoryObjectID>(std::ostream &os,
337+
const CallCapture &call,
338+
gl::MemoryObjectID value);
324339

325340
template <>
326-
void WriteParamValueToStream<ParamType::TPathID>(std::ostream &os, gl::PathID value);
341+
void WriteParamValueReplay<ParamType::TPathID>(std::ostream &os,
342+
const CallCapture &call,
343+
gl::PathID value);
327344

328345
template <>
329-
void WriteParamValueToStream<ParamType::TProgramPipelineID>(std::ostream &os,
330-
gl::ProgramPipelineID value);
346+
void WriteParamValueReplay<ParamType::TProgramPipelineID>(std::ostream &os,
347+
const CallCapture &call,
348+
gl::ProgramPipelineID value);
331349

332350
template <>
333-
void WriteParamValueToStream<ParamType::TQueryID>(std::ostream &os, gl::QueryID value);
351+
void WriteParamValueReplay<ParamType::TQueryID>(std::ostream &os,
352+
const CallCapture &call,
353+
gl::QueryID value);
334354

335355
template <>
336-
void WriteParamValueToStream<ParamType::TRenderbufferID>(std::ostream &os,
337-
gl::RenderbufferID value);
356+
void WriteParamValueReplay<ParamType::TRenderbufferID>(std::ostream &os,
357+
const CallCapture &call,
358+
gl::RenderbufferID value);
338359

339360
template <>
340-
void WriteParamValueToStream<ParamType::TSamplerID>(std::ostream &os, gl::SamplerID value);
361+
void WriteParamValueReplay<ParamType::TSamplerID>(std::ostream &os,
362+
const CallCapture &call,
363+
gl::SamplerID value);
341364

342365
template <>
343-
void WriteParamValueToStream<ParamType::TSemaphoreID>(std::ostream &os, gl::SemaphoreID value);
366+
void WriteParamValueReplay<ParamType::TSemaphoreID>(std::ostream &os,
367+
const CallCapture &call,
368+
gl::SemaphoreID value);
344369

345370
template <>
346-
void WriteParamValueToStream<ParamType::TShaderProgramID>(std::ostream &os,
347-
gl::ShaderProgramID value);
371+
void WriteParamValueReplay<ParamType::TShaderProgramID>(std::ostream &os,
372+
const CallCapture &call,
373+
gl::ShaderProgramID value);
348374

349375
template <>
350-
void WriteParamValueToStream<ParamType::TTextureID>(std::ostream &os, gl::TextureID value);
376+
void WriteParamValueReplay<ParamType::TTextureID>(std::ostream &os,
377+
const CallCapture &call,
378+
gl::TextureID value);
351379

352380
template <>
353-
void WriteParamValueToStream<ParamType::TTransformFeedbackID>(std::ostream &os,
354-
gl::TransformFeedbackID value);
381+
void WriteParamValueReplay<ParamType::TTransformFeedbackID>(std::ostream &os,
382+
const CallCapture &call,
383+
gl::TransformFeedbackID value);
355384

356385
template <>
357-
void WriteParamValueToStream<ParamType::TVertexArrayID>(std::ostream &os, gl::VertexArrayID value);
386+
void WriteParamValueReplay<ParamType::TVertexArrayID>(std::ostream &os,
387+
const CallCapture &call,
388+
gl::VertexArrayID value);
358389

359390
template <>
360-
void WriteParamValueToStream<ParamType::TUniformLocation>(std::ostream &os,
361-
gl::UniformLocation value);
391+
void WriteParamValueReplay<ParamType::TUniformLocation>(std::ostream &os,
392+
const CallCapture &call,
393+
gl::UniformLocation value);
362394

363395
// General fallback for any unspecific type.
364396
template <ParamType ParamT, typename T>
365-
void WriteParamValueToStream(std::ostream &os, T value)
397+
void WriteParamValueReplay(std::ostream &os, const CallCapture &call, T value)
366398
{
367399
os << value;
368400
}

0 commit comments

Comments
 (0)