1*8975f5c5SAndroid Build Coastguard Worker //
2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2022 The ANGLE Project Authors. All rights reserved.
3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file.
5*8975f5c5SAndroid Build Coastguard Worker //
6*8975f5c5SAndroid Build Coastguard Worker // frame_capture_utils.cpp:
7*8975f5c5SAndroid Build Coastguard Worker // ANGLE Frame capture common classes.
8*8975f5c5SAndroid Build Coastguard Worker //
9*8975f5c5SAndroid Build Coastguard Worker
10*8975f5c5SAndroid Build Coastguard Worker #include "common/frame_capture_utils.h"
11*8975f5c5SAndroid Build Coastguard Worker
12*8975f5c5SAndroid Build Coastguard Worker namespace angle
13*8975f5c5SAndroid Build Coastguard Worker {
14*8975f5c5SAndroid Build Coastguard Worker namespace
15*8975f5c5SAndroid Build Coastguard Worker {
16*8975f5c5SAndroid Build Coastguard Worker // Keep the simplest nullptr string for easy C parsing.
17*8975f5c5SAndroid Build Coastguard Worker constexpr char kNullPointerString[] = "0";
18*8975f5c5SAndroid Build Coastguard Worker } // anonymous namespace
19*8975f5c5SAndroid Build Coastguard Worker
ParamCapture()20*8975f5c5SAndroid Build Coastguard Worker ParamCapture::ParamCapture() : type(ParamType::TGLenum), enumGroup(gl::GLESEnum::AllEnums) {}
21*8975f5c5SAndroid Build Coastguard Worker
ParamCapture(const char * nameIn,ParamType typeIn)22*8975f5c5SAndroid Build Coastguard Worker ParamCapture::ParamCapture(const char *nameIn, ParamType typeIn)
23*8975f5c5SAndroid Build Coastguard Worker : name(nameIn),
24*8975f5c5SAndroid Build Coastguard Worker type(typeIn),
25*8975f5c5SAndroid Build Coastguard Worker enumGroup(gl::GLESEnum::AllEnums),
26*8975f5c5SAndroid Build Coastguard Worker bigGLEnum(gl::BigGLEnum::AllEnums)
27*8975f5c5SAndroid Build Coastguard Worker {}
28*8975f5c5SAndroid Build Coastguard Worker
29*8975f5c5SAndroid Build Coastguard Worker ParamCapture::~ParamCapture() = default;
30*8975f5c5SAndroid Build Coastguard Worker
ParamCapture(ParamCapture && other)31*8975f5c5SAndroid Build Coastguard Worker ParamCapture::ParamCapture(ParamCapture &&other)
32*8975f5c5SAndroid Build Coastguard Worker : type(ParamType::TGLenum),
33*8975f5c5SAndroid Build Coastguard Worker enumGroup(gl::GLESEnum::AllEnums),
34*8975f5c5SAndroid Build Coastguard Worker bigGLEnum(gl::BigGLEnum::AllEnums)
35*8975f5c5SAndroid Build Coastguard Worker {
36*8975f5c5SAndroid Build Coastguard Worker *this = std::move(other);
37*8975f5c5SAndroid Build Coastguard Worker }
38*8975f5c5SAndroid Build Coastguard Worker
operator =(ParamCapture && other)39*8975f5c5SAndroid Build Coastguard Worker ParamCapture &ParamCapture::operator=(ParamCapture &&other)
40*8975f5c5SAndroid Build Coastguard Worker {
41*8975f5c5SAndroid Build Coastguard Worker std::swap(name, other.name);
42*8975f5c5SAndroid Build Coastguard Worker std::swap(type, other.type);
43*8975f5c5SAndroid Build Coastguard Worker std::swap(value, other.value);
44*8975f5c5SAndroid Build Coastguard Worker std::swap(enumGroup, other.enumGroup);
45*8975f5c5SAndroid Build Coastguard Worker std::swap(bigGLEnum, other.bigGLEnum);
46*8975f5c5SAndroid Build Coastguard Worker std::swap(data, other.data);
47*8975f5c5SAndroid Build Coastguard Worker std::swap(arrayClientPointerIndex, other.arrayClientPointerIndex);
48*8975f5c5SAndroid Build Coastguard Worker std::swap(readBufferSizeBytes, other.readBufferSizeBytes);
49*8975f5c5SAndroid Build Coastguard Worker std::swap(dataNElements, other.dataNElements);
50*8975f5c5SAndroid Build Coastguard Worker return *this;
51*8975f5c5SAndroid Build Coastguard Worker }
52*8975f5c5SAndroid Build Coastguard Worker
ParamBuffer()53*8975f5c5SAndroid Build Coastguard Worker ParamBuffer::ParamBuffer() {}
54*8975f5c5SAndroid Build Coastguard Worker
55*8975f5c5SAndroid Build Coastguard Worker ParamBuffer::~ParamBuffer() = default;
56*8975f5c5SAndroid Build Coastguard Worker
ParamBuffer(ParamBuffer && other)57*8975f5c5SAndroid Build Coastguard Worker ParamBuffer::ParamBuffer(ParamBuffer &&other)
58*8975f5c5SAndroid Build Coastguard Worker {
59*8975f5c5SAndroid Build Coastguard Worker *this = std::move(other);
60*8975f5c5SAndroid Build Coastguard Worker }
61*8975f5c5SAndroid Build Coastguard Worker
operator =(ParamBuffer && other)62*8975f5c5SAndroid Build Coastguard Worker ParamBuffer &ParamBuffer::operator=(ParamBuffer &&other)
63*8975f5c5SAndroid Build Coastguard Worker {
64*8975f5c5SAndroid Build Coastguard Worker std::swap(mParamCaptures, other.mParamCaptures);
65*8975f5c5SAndroid Build Coastguard Worker std::swap(mClientArrayDataParam, other.mClientArrayDataParam);
66*8975f5c5SAndroid Build Coastguard Worker std::swap(mReadBufferSize, other.mReadBufferSize);
67*8975f5c5SAndroid Build Coastguard Worker std::swap(mReturnValueCapture, other.mReturnValueCapture);
68*8975f5c5SAndroid Build Coastguard Worker return *this;
69*8975f5c5SAndroid Build Coastguard Worker }
70*8975f5c5SAndroid Build Coastguard Worker
getParam(const char * paramName,ParamType paramType,int index)71*8975f5c5SAndroid Build Coastguard Worker ParamCapture &ParamBuffer::getParam(const char *paramName, ParamType paramType, int index)
72*8975f5c5SAndroid Build Coastguard Worker {
73*8975f5c5SAndroid Build Coastguard Worker ParamCapture &capture = mParamCaptures[index];
74*8975f5c5SAndroid Build Coastguard Worker ASSERT(capture.name == paramName);
75*8975f5c5SAndroid Build Coastguard Worker ASSERT(capture.type == paramType);
76*8975f5c5SAndroid Build Coastguard Worker return capture;
77*8975f5c5SAndroid Build Coastguard Worker }
78*8975f5c5SAndroid Build Coastguard Worker
getParam(const char * paramName,ParamType paramType,int index) const79*8975f5c5SAndroid Build Coastguard Worker const ParamCapture &ParamBuffer::getParam(const char *paramName,
80*8975f5c5SAndroid Build Coastguard Worker ParamType paramType,
81*8975f5c5SAndroid Build Coastguard Worker int index) const
82*8975f5c5SAndroid Build Coastguard Worker {
83*8975f5c5SAndroid Build Coastguard Worker return const_cast<ParamBuffer *>(this)->getParam(paramName, paramType, index);
84*8975f5c5SAndroid Build Coastguard Worker }
85*8975f5c5SAndroid Build Coastguard Worker
getParamFlexName(const char * paramName1,const char * paramName2,ParamType paramType,int index)86*8975f5c5SAndroid Build Coastguard Worker ParamCapture &ParamBuffer::getParamFlexName(const char *paramName1,
87*8975f5c5SAndroid Build Coastguard Worker const char *paramName2,
88*8975f5c5SAndroid Build Coastguard Worker ParamType paramType,
89*8975f5c5SAndroid Build Coastguard Worker int index)
90*8975f5c5SAndroid Build Coastguard Worker {
91*8975f5c5SAndroid Build Coastguard Worker ParamCapture &capture = mParamCaptures[index];
92*8975f5c5SAndroid Build Coastguard Worker ASSERT(capture.name == paramName1 || capture.name == paramName2);
93*8975f5c5SAndroid Build Coastguard Worker ASSERT(capture.type == paramType);
94*8975f5c5SAndroid Build Coastguard Worker return capture;
95*8975f5c5SAndroid Build Coastguard Worker }
96*8975f5c5SAndroid Build Coastguard Worker
getParamFlexName(const char * paramName1,const char * paramName2,ParamType paramType,int index) const97*8975f5c5SAndroid Build Coastguard Worker const ParamCapture &ParamBuffer::getParamFlexName(const char *paramName1,
98*8975f5c5SAndroid Build Coastguard Worker const char *paramName2,
99*8975f5c5SAndroid Build Coastguard Worker ParamType paramType,
100*8975f5c5SAndroid Build Coastguard Worker int index) const
101*8975f5c5SAndroid Build Coastguard Worker {
102*8975f5c5SAndroid Build Coastguard Worker return const_cast<ParamBuffer *>(this)->getParamFlexName(paramName1, paramName2, paramType,
103*8975f5c5SAndroid Build Coastguard Worker index);
104*8975f5c5SAndroid Build Coastguard Worker }
105*8975f5c5SAndroid Build Coastguard Worker
addParam(ParamCapture && param)106*8975f5c5SAndroid Build Coastguard Worker void ParamBuffer::addParam(ParamCapture &¶m)
107*8975f5c5SAndroid Build Coastguard Worker {
108*8975f5c5SAndroid Build Coastguard Worker if (param.arrayClientPointerIndex != -1)
109*8975f5c5SAndroid Build Coastguard Worker {
110*8975f5c5SAndroid Build Coastguard Worker ASSERT(mClientArrayDataParam == -1);
111*8975f5c5SAndroid Build Coastguard Worker mClientArrayDataParam = static_cast<int>(mParamCaptures.size());
112*8975f5c5SAndroid Build Coastguard Worker }
113*8975f5c5SAndroid Build Coastguard Worker
114*8975f5c5SAndroid Build Coastguard Worker mReadBufferSize = std::max(param.readBufferSizeBytes, mReadBufferSize);
115*8975f5c5SAndroid Build Coastguard Worker mParamCaptures.emplace_back(std::move(param));
116*8975f5c5SAndroid Build Coastguard Worker }
117*8975f5c5SAndroid Build Coastguard Worker
addReturnValue(ParamCapture && returnValue)118*8975f5c5SAndroid Build Coastguard Worker void ParamBuffer::addReturnValue(ParamCapture &&returnValue)
119*8975f5c5SAndroid Build Coastguard Worker {
120*8975f5c5SAndroid Build Coastguard Worker mReturnValueCapture = std::move(returnValue);
121*8975f5c5SAndroid Build Coastguard Worker }
122*8975f5c5SAndroid Build Coastguard Worker
getNextParamName()123*8975f5c5SAndroid Build Coastguard Worker const char *ParamBuffer::getNextParamName()
124*8975f5c5SAndroid Build Coastguard Worker {
125*8975f5c5SAndroid Build Coastguard Worker static const char *kParamNames[] = {"p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7",
126*8975f5c5SAndroid Build Coastguard Worker "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15",
127*8975f5c5SAndroid Build Coastguard Worker "p16", "p17", "p18", "p19", "p20", "p21", "p22"};
128*8975f5c5SAndroid Build Coastguard Worker ASSERT(mParamCaptures.size() < ArraySize(kParamNames));
129*8975f5c5SAndroid Build Coastguard Worker return kParamNames[mParamCaptures.size()];
130*8975f5c5SAndroid Build Coastguard Worker }
131*8975f5c5SAndroid Build Coastguard Worker
getClientArrayPointerParameter()132*8975f5c5SAndroid Build Coastguard Worker ParamCapture &ParamBuffer::getClientArrayPointerParameter()
133*8975f5c5SAndroid Build Coastguard Worker {
134*8975f5c5SAndroid Build Coastguard Worker ASSERT(hasClientArrayData());
135*8975f5c5SAndroid Build Coastguard Worker return mParamCaptures[mClientArrayDataParam];
136*8975f5c5SAndroid Build Coastguard Worker }
137*8975f5c5SAndroid Build Coastguard Worker
CallCapture(EntryPoint entryPointIn,ParamBuffer && paramsIn)138*8975f5c5SAndroid Build Coastguard Worker CallCapture::CallCapture(EntryPoint entryPointIn, ParamBuffer &¶msIn)
139*8975f5c5SAndroid Build Coastguard Worker : entryPoint(entryPointIn), params(std::move(paramsIn))
140*8975f5c5SAndroid Build Coastguard Worker {}
141*8975f5c5SAndroid Build Coastguard Worker
CallCapture(const std::string & customFunctionNameIn,ParamBuffer && paramsIn)142*8975f5c5SAndroid Build Coastguard Worker CallCapture::CallCapture(const std::string &customFunctionNameIn, ParamBuffer &¶msIn)
143*8975f5c5SAndroid Build Coastguard Worker : entryPoint(EntryPoint::Invalid),
144*8975f5c5SAndroid Build Coastguard Worker customFunctionName(customFunctionNameIn),
145*8975f5c5SAndroid Build Coastguard Worker params(std::move(paramsIn))
146*8975f5c5SAndroid Build Coastguard Worker {}
147*8975f5c5SAndroid Build Coastguard Worker
148*8975f5c5SAndroid Build Coastguard Worker CallCapture::~CallCapture() = default;
149*8975f5c5SAndroid Build Coastguard Worker
CallCapture(CallCapture && other)150*8975f5c5SAndroid Build Coastguard Worker CallCapture::CallCapture(CallCapture &&other)
151*8975f5c5SAndroid Build Coastguard Worker {
152*8975f5c5SAndroid Build Coastguard Worker *this = std::move(other);
153*8975f5c5SAndroid Build Coastguard Worker }
154*8975f5c5SAndroid Build Coastguard Worker
operator =(CallCapture && other)155*8975f5c5SAndroid Build Coastguard Worker CallCapture &CallCapture::operator=(CallCapture &&other)
156*8975f5c5SAndroid Build Coastguard Worker {
157*8975f5c5SAndroid Build Coastguard Worker std::swap(entryPoint, other.entryPoint);
158*8975f5c5SAndroid Build Coastguard Worker std::swap(customFunctionName, other.customFunctionName);
159*8975f5c5SAndroid Build Coastguard Worker std::swap(params, other.params);
160*8975f5c5SAndroid Build Coastguard Worker std::swap(isActive, other.isActive);
161*8975f5c5SAndroid Build Coastguard Worker std::swap(contextID, other.contextID);
162*8975f5c5SAndroid Build Coastguard Worker std::swap(isSyncPoint, other.isSyncPoint);
163*8975f5c5SAndroid Build Coastguard Worker return *this;
164*8975f5c5SAndroid Build Coastguard Worker }
165*8975f5c5SAndroid Build Coastguard Worker
name() const166*8975f5c5SAndroid Build Coastguard Worker const char *CallCapture::name() const
167*8975f5c5SAndroid Build Coastguard Worker {
168*8975f5c5SAndroid Build Coastguard Worker if (customFunctionName.empty())
169*8975f5c5SAndroid Build Coastguard Worker {
170*8975f5c5SAndroid Build Coastguard Worker ASSERT(entryPoint != EntryPoint::Invalid);
171*8975f5c5SAndroid Build Coastguard Worker return angle::GetEntryPointName(entryPoint);
172*8975f5c5SAndroid Build Coastguard Worker }
173*8975f5c5SAndroid Build Coastguard Worker else
174*8975f5c5SAndroid Build Coastguard Worker {
175*8975f5c5SAndroid Build Coastguard Worker return customFunctionName.c_str();
176*8975f5c5SAndroid Build Coastguard Worker }
177*8975f5c5SAndroid Build Coastguard Worker }
178*8975f5c5SAndroid Build Coastguard Worker
179*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,GLboolean value)180*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TGLboolean>(std::ostream &os,
181*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
182*8975f5c5SAndroid Build Coastguard Worker GLboolean value)
183*8975f5c5SAndroid Build Coastguard Worker {
184*8975f5c5SAndroid Build Coastguard Worker switch (value)
185*8975f5c5SAndroid Build Coastguard Worker {
186*8975f5c5SAndroid Build Coastguard Worker case GL_TRUE:
187*8975f5c5SAndroid Build Coastguard Worker os << "GL_TRUE";
188*8975f5c5SAndroid Build Coastguard Worker break;
189*8975f5c5SAndroid Build Coastguard Worker case GL_FALSE:
190*8975f5c5SAndroid Build Coastguard Worker os << "GL_FALSE";
191*8975f5c5SAndroid Build Coastguard Worker break;
192*8975f5c5SAndroid Build Coastguard Worker default:
193*8975f5c5SAndroid Build Coastguard Worker os << "0x" << std::hex << std::uppercase << GLint(value);
194*8975f5c5SAndroid Build Coastguard Worker }
195*8975f5c5SAndroid Build Coastguard Worker }
196*8975f5c5SAndroid Build Coastguard Worker
197*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,GLboolean * value)198*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TGLbooleanPointer>(std::ostream &os,
199*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
200*8975f5c5SAndroid Build Coastguard Worker GLboolean *value)
201*8975f5c5SAndroid Build Coastguard Worker {
202*8975f5c5SAndroid Build Coastguard Worker if (value == 0)
203*8975f5c5SAndroid Build Coastguard Worker {
204*8975f5c5SAndroid Build Coastguard Worker os << kNullPointerString;
205*8975f5c5SAndroid Build Coastguard Worker }
206*8975f5c5SAndroid Build Coastguard Worker else
207*8975f5c5SAndroid Build Coastguard Worker {
208*8975f5c5SAndroid Build Coastguard Worker os << "(GLboolean *)" << static_cast<int>(reinterpret_cast<uintptr_t>(value));
209*8975f5c5SAndroid Build Coastguard Worker }
210*8975f5c5SAndroid Build Coastguard Worker }
211*8975f5c5SAndroid Build Coastguard Worker
212*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,const void * value)213*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TvoidConstPointer>(std::ostream &os,
214*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
215*8975f5c5SAndroid Build Coastguard Worker const void *value)
216*8975f5c5SAndroid Build Coastguard Worker {
217*8975f5c5SAndroid Build Coastguard Worker if (value == 0)
218*8975f5c5SAndroid Build Coastguard Worker {
219*8975f5c5SAndroid Build Coastguard Worker os << kNullPointerString;
220*8975f5c5SAndroid Build Coastguard Worker }
221*8975f5c5SAndroid Build Coastguard Worker else
222*8975f5c5SAndroid Build Coastguard Worker {
223*8975f5c5SAndroid Build Coastguard Worker os << "(const void *)" << static_cast<int>(reinterpret_cast<uintptr_t>(value));
224*8975f5c5SAndroid Build Coastguard Worker }
225*8975f5c5SAndroid Build Coastguard Worker }
226*8975f5c5SAndroid Build Coastguard Worker
227*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,void * value)228*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TvoidPointer>(std::ostream &os,
229*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
230*8975f5c5SAndroid Build Coastguard Worker void *value)
231*8975f5c5SAndroid Build Coastguard Worker {
232*8975f5c5SAndroid Build Coastguard Worker if (value == 0)
233*8975f5c5SAndroid Build Coastguard Worker {
234*8975f5c5SAndroid Build Coastguard Worker os << kNullPointerString;
235*8975f5c5SAndroid Build Coastguard Worker }
236*8975f5c5SAndroid Build Coastguard Worker else
237*8975f5c5SAndroid Build Coastguard Worker {
238*8975f5c5SAndroid Build Coastguard Worker os << "(void *)" << static_cast<int>(reinterpret_cast<uintptr_t>(value));
239*8975f5c5SAndroid Build Coastguard Worker }
240*8975f5c5SAndroid Build Coastguard Worker }
241*8975f5c5SAndroid Build Coastguard Worker
242*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,const GLfloat * value)243*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TGLfloatConstPointer>(std::ostream &os,
244*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
245*8975f5c5SAndroid Build Coastguard Worker const GLfloat *value)
246*8975f5c5SAndroid Build Coastguard Worker {
247*8975f5c5SAndroid Build Coastguard Worker if (value == 0)
248*8975f5c5SAndroid Build Coastguard Worker {
249*8975f5c5SAndroid Build Coastguard Worker os << kNullPointerString;
250*8975f5c5SAndroid Build Coastguard Worker }
251*8975f5c5SAndroid Build Coastguard Worker else
252*8975f5c5SAndroid Build Coastguard Worker {
253*8975f5c5SAndroid Build Coastguard Worker os << "(const GLfloat *)" << static_cast<int>(reinterpret_cast<uintptr_t>(value));
254*8975f5c5SAndroid Build Coastguard Worker }
255*8975f5c5SAndroid Build Coastguard Worker }
256*8975f5c5SAndroid Build Coastguard Worker
257*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,const GLint * value)258*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TGLintConstPointer>(std::ostream &os,
259*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
260*8975f5c5SAndroid Build Coastguard Worker const GLint *value)
261*8975f5c5SAndroid Build Coastguard Worker {
262*8975f5c5SAndroid Build Coastguard Worker if (value == 0)
263*8975f5c5SAndroid Build Coastguard Worker {
264*8975f5c5SAndroid Build Coastguard Worker os << kNullPointerString;
265*8975f5c5SAndroid Build Coastguard Worker }
266*8975f5c5SAndroid Build Coastguard Worker else
267*8975f5c5SAndroid Build Coastguard Worker {
268*8975f5c5SAndroid Build Coastguard Worker os << "(const GLint *)" << static_cast<int>(reinterpret_cast<intptr_t>(value));
269*8975f5c5SAndroid Build Coastguard Worker }
270*8975f5c5SAndroid Build Coastguard Worker }
271*8975f5c5SAndroid Build Coastguard Worker
272*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,GLsizei * value)273*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TGLsizeiPointer>(std::ostream &os,
274*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
275*8975f5c5SAndroid Build Coastguard Worker GLsizei *value)
276*8975f5c5SAndroid Build Coastguard Worker {
277*8975f5c5SAndroid Build Coastguard Worker if (value == 0)
278*8975f5c5SAndroid Build Coastguard Worker {
279*8975f5c5SAndroid Build Coastguard Worker os << kNullPointerString;
280*8975f5c5SAndroid Build Coastguard Worker }
281*8975f5c5SAndroid Build Coastguard Worker else
282*8975f5c5SAndroid Build Coastguard Worker {
283*8975f5c5SAndroid Build Coastguard Worker os << "(GLsizei *)" << static_cast<int>(reinterpret_cast<intptr_t>(value));
284*8975f5c5SAndroid Build Coastguard Worker }
285*8975f5c5SAndroid Build Coastguard Worker }
286*8975f5c5SAndroid Build Coastguard Worker
287*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,GLuint * value)288*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TGLuintPointer>(std::ostream &os,
289*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
290*8975f5c5SAndroid Build Coastguard Worker GLuint *value)
291*8975f5c5SAndroid Build Coastguard Worker {
292*8975f5c5SAndroid Build Coastguard Worker if (value == 0)
293*8975f5c5SAndroid Build Coastguard Worker {
294*8975f5c5SAndroid Build Coastguard Worker os << kNullPointerString;
295*8975f5c5SAndroid Build Coastguard Worker }
296*8975f5c5SAndroid Build Coastguard Worker else
297*8975f5c5SAndroid Build Coastguard Worker {
298*8975f5c5SAndroid Build Coastguard Worker os << "(GLuint *)" << static_cast<int>(reinterpret_cast<uintptr_t>(value));
299*8975f5c5SAndroid Build Coastguard Worker }
300*8975f5c5SAndroid Build Coastguard Worker }
301*8975f5c5SAndroid Build Coastguard Worker
302*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,const GLuint * value)303*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TGLuintConstPointer>(std::ostream &os,
304*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
305*8975f5c5SAndroid Build Coastguard Worker const GLuint *value)
306*8975f5c5SAndroid Build Coastguard Worker {
307*8975f5c5SAndroid Build Coastguard Worker if (value == 0)
308*8975f5c5SAndroid Build Coastguard Worker {
309*8975f5c5SAndroid Build Coastguard Worker os << kNullPointerString;
310*8975f5c5SAndroid Build Coastguard Worker }
311*8975f5c5SAndroid Build Coastguard Worker else
312*8975f5c5SAndroid Build Coastguard Worker {
313*8975f5c5SAndroid Build Coastguard Worker os << "(const GLuint *)" << static_cast<int>(reinterpret_cast<uintptr_t>(value));
314*8975f5c5SAndroid Build Coastguard Worker }
315*8975f5c5SAndroid Build Coastguard Worker }
316*8975f5c5SAndroid Build Coastguard Worker
317*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,GLDEBUGPROCKHR value)318*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TGLDEBUGPROCKHR>(std::ostream &os,
319*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
320*8975f5c5SAndroid Build Coastguard Worker GLDEBUGPROCKHR value)
321*8975f5c5SAndroid Build Coastguard Worker {}
322*8975f5c5SAndroid Build Coastguard Worker
323*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,GLDEBUGPROC value)324*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TGLDEBUGPROC>(std::ostream &os,
325*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
326*8975f5c5SAndroid Build Coastguard Worker GLDEBUGPROC value)
327*8975f5c5SAndroid Build Coastguard Worker {}
328*8975f5c5SAndroid Build Coastguard Worker
329*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::BufferID value)330*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TBufferID>(std::ostream &os,
331*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
332*8975f5c5SAndroid Build Coastguard Worker gl::BufferID value)
333*8975f5c5SAndroid Build Coastguard Worker {
334*8975f5c5SAndroid Build Coastguard Worker os << "gBufferMap[" << value.value << "]";
335*8975f5c5SAndroid Build Coastguard Worker }
336*8975f5c5SAndroid Build Coastguard Worker
337*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::FenceNVID value)338*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TFenceNVID>(std::ostream &os,
339*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
340*8975f5c5SAndroid Build Coastguard Worker gl::FenceNVID value)
341*8975f5c5SAndroid Build Coastguard Worker {
342*8975f5c5SAndroid Build Coastguard Worker os << "gFenceNVMap[" << value.value << "]";
343*8975f5c5SAndroid Build Coastguard Worker }
344*8975f5c5SAndroid Build Coastguard Worker
345*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::FramebufferID value)346*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TFramebufferID>(std::ostream &os,
347*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
348*8975f5c5SAndroid Build Coastguard Worker gl::FramebufferID value)
349*8975f5c5SAndroid Build Coastguard Worker {
350*8975f5c5SAndroid Build Coastguard Worker os << "gFramebufferMapPerContext[" << call.contextID.value << "][" << value.value << "]";
351*8975f5c5SAndroid Build Coastguard Worker }
352*8975f5c5SAndroid Build Coastguard Worker
353*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::MemoryObjectID value)354*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TMemoryObjectID>(std::ostream &os,
355*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
356*8975f5c5SAndroid Build Coastguard Worker gl::MemoryObjectID value)
357*8975f5c5SAndroid Build Coastguard Worker {
358*8975f5c5SAndroid Build Coastguard Worker os << "gMemoryObjectMap[" << value.value << "]";
359*8975f5c5SAndroid Build Coastguard Worker }
360*8975f5c5SAndroid Build Coastguard Worker
361*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::ProgramPipelineID value)362*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TProgramPipelineID>(std::ostream &os,
363*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
364*8975f5c5SAndroid Build Coastguard Worker gl::ProgramPipelineID value)
365*8975f5c5SAndroid Build Coastguard Worker {
366*8975f5c5SAndroid Build Coastguard Worker os << "gProgramPipelineMap[" << value.value << "]";
367*8975f5c5SAndroid Build Coastguard Worker }
368*8975f5c5SAndroid Build Coastguard Worker
369*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::QueryID value)370*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TQueryID>(std::ostream &os,
371*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
372*8975f5c5SAndroid Build Coastguard Worker gl::QueryID value)
373*8975f5c5SAndroid Build Coastguard Worker {
374*8975f5c5SAndroid Build Coastguard Worker os << "gQueryMap[" << value.value << "]";
375*8975f5c5SAndroid Build Coastguard Worker }
376*8975f5c5SAndroid Build Coastguard Worker
377*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::RenderbufferID value)378*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TRenderbufferID>(std::ostream &os,
379*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
380*8975f5c5SAndroid Build Coastguard Worker gl::RenderbufferID value)
381*8975f5c5SAndroid Build Coastguard Worker {
382*8975f5c5SAndroid Build Coastguard Worker os << "gRenderbufferMap[" << value.value << "]";
383*8975f5c5SAndroid Build Coastguard Worker }
384*8975f5c5SAndroid Build Coastguard Worker
385*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::SamplerID value)386*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TSamplerID>(std::ostream &os,
387*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
388*8975f5c5SAndroid Build Coastguard Worker gl::SamplerID value)
389*8975f5c5SAndroid Build Coastguard Worker {
390*8975f5c5SAndroid Build Coastguard Worker os << "gSamplerMap[" << value.value << "]";
391*8975f5c5SAndroid Build Coastguard Worker }
392*8975f5c5SAndroid Build Coastguard Worker
393*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::SemaphoreID value)394*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TSemaphoreID>(std::ostream &os,
395*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
396*8975f5c5SAndroid Build Coastguard Worker gl::SemaphoreID value)
397*8975f5c5SAndroid Build Coastguard Worker {
398*8975f5c5SAndroid Build Coastguard Worker os << "gSemaphoreMap[" << value.value << "]";
399*8975f5c5SAndroid Build Coastguard Worker }
400*8975f5c5SAndroid Build Coastguard Worker
401*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::ShaderProgramID value)402*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TShaderProgramID>(std::ostream &os,
403*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
404*8975f5c5SAndroid Build Coastguard Worker gl::ShaderProgramID value)
405*8975f5c5SAndroid Build Coastguard Worker {
406*8975f5c5SAndroid Build Coastguard Worker os << "gShaderProgramMap[" << value.value << "]";
407*8975f5c5SAndroid Build Coastguard Worker }
408*8975f5c5SAndroid Build Coastguard Worker
409*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::SyncID value)410*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TSyncID>(std::ostream &os,
411*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
412*8975f5c5SAndroid Build Coastguard Worker gl::SyncID value)
413*8975f5c5SAndroid Build Coastguard Worker {
414*8975f5c5SAndroid Build Coastguard Worker os << "gSyncMap2[" << value.value << "]";
415*8975f5c5SAndroid Build Coastguard Worker }
416*8975f5c5SAndroid Build Coastguard Worker
417*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::TextureID value)418*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TTextureID>(std::ostream &os,
419*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
420*8975f5c5SAndroid Build Coastguard Worker gl::TextureID value)
421*8975f5c5SAndroid Build Coastguard Worker {
422*8975f5c5SAndroid Build Coastguard Worker os << "gTextureMap[" << value.value << "]";
423*8975f5c5SAndroid Build Coastguard Worker }
424*8975f5c5SAndroid Build Coastguard Worker
425*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::TransformFeedbackID value)426*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TTransformFeedbackID>(std::ostream &os,
427*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
428*8975f5c5SAndroid Build Coastguard Worker gl::TransformFeedbackID value)
429*8975f5c5SAndroid Build Coastguard Worker {
430*8975f5c5SAndroid Build Coastguard Worker os << "gTransformFeedbackMap[" << value.value << "]";
431*8975f5c5SAndroid Build Coastguard Worker }
432*8975f5c5SAndroid Build Coastguard Worker
433*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::VertexArrayID value)434*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TVertexArrayID>(std::ostream &os,
435*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
436*8975f5c5SAndroid Build Coastguard Worker gl::VertexArrayID value)
437*8975f5c5SAndroid Build Coastguard Worker {
438*8975f5c5SAndroid Build Coastguard Worker os << "gVertexArrayMap[" << value.value << "]";
439*8975f5c5SAndroid Build Coastguard Worker }
440*8975f5c5SAndroid Build Coastguard Worker
441*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::UniformLocation value)442*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TUniformLocation>(std::ostream &os,
443*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
444*8975f5c5SAndroid Build Coastguard Worker gl::UniformLocation value)
445*8975f5c5SAndroid Build Coastguard Worker {
446*8975f5c5SAndroid Build Coastguard Worker if (value.value == -1)
447*8975f5c5SAndroid Build Coastguard Worker {
448*8975f5c5SAndroid Build Coastguard Worker os << "-1";
449*8975f5c5SAndroid Build Coastguard Worker return;
450*8975f5c5SAndroid Build Coastguard Worker }
451*8975f5c5SAndroid Build Coastguard Worker
452*8975f5c5SAndroid Build Coastguard Worker os << "gUniformLocations[";
453*8975f5c5SAndroid Build Coastguard Worker
454*8975f5c5SAndroid Build Coastguard Worker // Find the program from the call parameters.
455*8975f5c5SAndroid Build Coastguard Worker std::vector<gl::ShaderProgramID> shaderProgramIDs;
456*8975f5c5SAndroid Build Coastguard Worker if (FindResourceIDsInCall<gl::ShaderProgramID>(call, shaderProgramIDs))
457*8975f5c5SAndroid Build Coastguard Worker {
458*8975f5c5SAndroid Build Coastguard Worker ASSERT(shaderProgramIDs.size() == 1);
459*8975f5c5SAndroid Build Coastguard Worker os << shaderProgramIDs[0].value;
460*8975f5c5SAndroid Build Coastguard Worker }
461*8975f5c5SAndroid Build Coastguard Worker else
462*8975f5c5SAndroid Build Coastguard Worker {
463*8975f5c5SAndroid Build Coastguard Worker os << "gCurrentProgram";
464*8975f5c5SAndroid Build Coastguard Worker }
465*8975f5c5SAndroid Build Coastguard Worker
466*8975f5c5SAndroid Build Coastguard Worker os << "][" << value.value << "]";
467*8975f5c5SAndroid Build Coastguard Worker }
468*8975f5c5SAndroid Build Coastguard Worker
469*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::UniformBlockIndex value)470*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TUniformBlockIndex>(std::ostream &os,
471*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
472*8975f5c5SAndroid Build Coastguard Worker gl::UniformBlockIndex value)
473*8975f5c5SAndroid Build Coastguard Worker {
474*8975f5c5SAndroid Build Coastguard Worker // We do not support directly using uniform block indexes due to their multiple indirections.
475*8975f5c5SAndroid Build Coastguard Worker // Use CaptureCustomUniformBlockBinding if you end up hitting this assertion.
476*8975f5c5SAndroid Build Coastguard Worker UNREACHABLE();
477*8975f5c5SAndroid Build Coastguard Worker }
478*8975f5c5SAndroid Build Coastguard Worker
479*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,GLubyte value)480*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TGLubyte>(std::ostream &os,
481*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
482*8975f5c5SAndroid Build Coastguard Worker GLubyte value)
483*8975f5c5SAndroid Build Coastguard Worker {
484*8975f5c5SAndroid Build Coastguard Worker const int v = value;
485*8975f5c5SAndroid Build Coastguard Worker os << v;
486*8975f5c5SAndroid Build Coastguard Worker }
487*8975f5c5SAndroid Build Coastguard Worker
488*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,EGLDEBUGPROCKHR value)489*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TEGLDEBUGPROCKHR>(std::ostream &os,
490*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
491*8975f5c5SAndroid Build Coastguard Worker EGLDEBUGPROCKHR value)
492*8975f5c5SAndroid Build Coastguard Worker {
493*8975f5c5SAndroid Build Coastguard Worker // It's not necessary to implement correct capture for these types.
494*8975f5c5SAndroid Build Coastguard Worker os << "0";
495*8975f5c5SAndroid Build Coastguard Worker }
496*8975f5c5SAndroid Build Coastguard Worker
497*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,EGLGetBlobFuncANDROID value)498*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TEGLGetBlobFuncANDROID>(std::ostream &os,
499*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
500*8975f5c5SAndroid Build Coastguard Worker EGLGetBlobFuncANDROID value)
501*8975f5c5SAndroid Build Coastguard Worker {
502*8975f5c5SAndroid Build Coastguard Worker // It's not necessary to implement correct capture for these types.
503*8975f5c5SAndroid Build Coastguard Worker os << "0";
504*8975f5c5SAndroid Build Coastguard Worker }
505*8975f5c5SAndroid Build Coastguard Worker
506*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,EGLSetBlobFuncANDROID value)507*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TEGLSetBlobFuncANDROID>(std::ostream &os,
508*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
509*8975f5c5SAndroid Build Coastguard Worker EGLSetBlobFuncANDROID value)
510*8975f5c5SAndroid Build Coastguard Worker {
511*8975f5c5SAndroid Build Coastguard Worker // It's not necessary to implement correct capture for these types.
512*8975f5c5SAndroid Build Coastguard Worker os << "0";
513*8975f5c5SAndroid Build Coastguard Worker }
514*8975f5c5SAndroid Build Coastguard Worker
515*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,egl::Config * value)516*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::Tegl_ConfigPointer>(std::ostream &os,
517*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
518*8975f5c5SAndroid Build Coastguard Worker egl::Config *value)
519*8975f5c5SAndroid Build Coastguard Worker {
520*8975f5c5SAndroid Build Coastguard Worker os << "EGL_NO_CONFIG_KHR";
521*8975f5c5SAndroid Build Coastguard Worker }
522*8975f5c5SAndroid Build Coastguard Worker
523*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,egl::SurfaceID value)524*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TSurfaceID>(std::ostream &os,
525*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
526*8975f5c5SAndroid Build Coastguard Worker egl::SurfaceID value)
527*8975f5c5SAndroid Build Coastguard Worker {
528*8975f5c5SAndroid Build Coastguard Worker os << "gSurfaceMap2[" << value.value << "]";
529*8975f5c5SAndroid Build Coastguard Worker }
530*8975f5c5SAndroid Build Coastguard Worker
531*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,gl::ContextID value)532*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TContextID>(std::ostream &os,
533*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
534*8975f5c5SAndroid Build Coastguard Worker gl::ContextID value)
535*8975f5c5SAndroid Build Coastguard Worker {
536*8975f5c5SAndroid Build Coastguard Worker os << "gContextMap2[" << value.value << "]";
537*8975f5c5SAndroid Build Coastguard Worker }
538*8975f5c5SAndroid Build Coastguard Worker
539*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,egl::Display * value)540*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::Tegl_DisplayPointer>(std::ostream &os,
541*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
542*8975f5c5SAndroid Build Coastguard Worker egl::Display *value)
543*8975f5c5SAndroid Build Coastguard Worker {
544*8975f5c5SAndroid Build Coastguard Worker os << "gEGLDisplay";
545*8975f5c5SAndroid Build Coastguard Worker }
546*8975f5c5SAndroid Build Coastguard Worker
547*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,egl::ImageID value)548*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TImageID>(std::ostream &os,
549*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
550*8975f5c5SAndroid Build Coastguard Worker egl::ImageID value)
551*8975f5c5SAndroid Build Coastguard Worker {
552*8975f5c5SAndroid Build Coastguard Worker os << "gEGLImageMap2[" << value.value << "]";
553*8975f5c5SAndroid Build Coastguard Worker }
554*8975f5c5SAndroid Build Coastguard Worker
555*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,EGLClientBuffer value)556*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TEGLClientBuffer>(std::ostream &os,
557*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
558*8975f5c5SAndroid Build Coastguard Worker EGLClientBuffer value)
559*8975f5c5SAndroid Build Coastguard Worker {
560*8975f5c5SAndroid Build Coastguard Worker os << value;
561*8975f5c5SAndroid Build Coastguard Worker }
562*8975f5c5SAndroid Build Coastguard Worker
563*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,egl::SyncID value)564*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::Tegl_SyncID>(std::ostream &os,
565*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
566*8975f5c5SAndroid Build Coastguard Worker egl::SyncID value)
567*8975f5c5SAndroid Build Coastguard Worker {
568*8975f5c5SAndroid Build Coastguard Worker os << "gEGLSyncMap[" << value.value << "]";
569*8975f5c5SAndroid Build Coastguard Worker }
570*8975f5c5SAndroid Build Coastguard Worker
571*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,EGLAttrib * value)572*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TEGLAttribPointer>(std::ostream &os,
573*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
574*8975f5c5SAndroid Build Coastguard Worker EGLAttrib *value)
575*8975f5c5SAndroid Build Coastguard Worker {
576*8975f5c5SAndroid Build Coastguard Worker if (value == 0)
577*8975f5c5SAndroid Build Coastguard Worker {
578*8975f5c5SAndroid Build Coastguard Worker os << kNullPointerString;
579*8975f5c5SAndroid Build Coastguard Worker }
580*8975f5c5SAndroid Build Coastguard Worker else
581*8975f5c5SAndroid Build Coastguard Worker {
582*8975f5c5SAndroid Build Coastguard Worker os << "(EGLAttrib *)" << static_cast<int>(reinterpret_cast<uintptr_t>(value));
583*8975f5c5SAndroid Build Coastguard Worker }
584*8975f5c5SAndroid Build Coastguard Worker }
585*8975f5c5SAndroid Build Coastguard Worker
586*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,const EGLAttrib * value)587*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TEGLAttribConstPointer>(std::ostream &os,
588*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
589*8975f5c5SAndroid Build Coastguard Worker const EGLAttrib *value)
590*8975f5c5SAndroid Build Coastguard Worker {
591*8975f5c5SAndroid Build Coastguard Worker if (value == 0)
592*8975f5c5SAndroid Build Coastguard Worker {
593*8975f5c5SAndroid Build Coastguard Worker os << kNullPointerString;
594*8975f5c5SAndroid Build Coastguard Worker }
595*8975f5c5SAndroid Build Coastguard Worker else
596*8975f5c5SAndroid Build Coastguard Worker {
597*8975f5c5SAndroid Build Coastguard Worker os << "(const EGLAttrib *)" << static_cast<int>(reinterpret_cast<uintptr_t>(value));
598*8975f5c5SAndroid Build Coastguard Worker }
599*8975f5c5SAndroid Build Coastguard Worker }
600*8975f5c5SAndroid Build Coastguard Worker
601*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,const EGLint * value)602*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TEGLintConstPointer>(std::ostream &os,
603*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
604*8975f5c5SAndroid Build Coastguard Worker const EGLint *value)
605*8975f5c5SAndroid Build Coastguard Worker {
606*8975f5c5SAndroid Build Coastguard Worker if (value == 0)
607*8975f5c5SAndroid Build Coastguard Worker {
608*8975f5c5SAndroid Build Coastguard Worker os << kNullPointerString;
609*8975f5c5SAndroid Build Coastguard Worker }
610*8975f5c5SAndroid Build Coastguard Worker else
611*8975f5c5SAndroid Build Coastguard Worker {
612*8975f5c5SAndroid Build Coastguard Worker os << "(const EGLint *)" << static_cast<int>(reinterpret_cast<uintptr_t>(value));
613*8975f5c5SAndroid Build Coastguard Worker }
614*8975f5c5SAndroid Build Coastguard Worker }
615*8975f5c5SAndroid Build Coastguard Worker
616*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,EGLint * value)617*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TEGLintPointer>(std::ostream &os,
618*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
619*8975f5c5SAndroid Build Coastguard Worker EGLint *value)
620*8975f5c5SAndroid Build Coastguard Worker {
621*8975f5c5SAndroid Build Coastguard Worker if (value == 0)
622*8975f5c5SAndroid Build Coastguard Worker {
623*8975f5c5SAndroid Build Coastguard Worker os << kNullPointerString;
624*8975f5c5SAndroid Build Coastguard Worker }
625*8975f5c5SAndroid Build Coastguard Worker else
626*8975f5c5SAndroid Build Coastguard Worker {
627*8975f5c5SAndroid Build Coastguard Worker os << "(const EGLint *)" << static_cast<int>(reinterpret_cast<uintptr_t>(value));
628*8975f5c5SAndroid Build Coastguard Worker }
629*8975f5c5SAndroid Build Coastguard Worker }
630*8975f5c5SAndroid Build Coastguard Worker
631*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,EGLTime value)632*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TEGLTime>(std::ostream &os,
633*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
634*8975f5c5SAndroid Build Coastguard Worker EGLTime value)
635*8975f5c5SAndroid Build Coastguard Worker {
636*8975f5c5SAndroid Build Coastguard Worker os << value << "ul";
637*8975f5c5SAndroid Build Coastguard Worker }
638*8975f5c5SAndroid Build Coastguard Worker
639*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,EGLTimeKHR value)640*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TEGLTimeKHR>(std::ostream &os,
641*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
642*8975f5c5SAndroid Build Coastguard Worker EGLTimeKHR value)
643*8975f5c5SAndroid Build Coastguard Worker {
644*8975f5c5SAndroid Build Coastguard Worker os << value << "ul";
645*8975f5c5SAndroid Build Coastguard Worker }
646*8975f5c5SAndroid Build Coastguard Worker
647*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,GLGETBLOBPROCANGLE value)648*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TGLGETBLOBPROCANGLE>(std::ostream &os,
649*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
650*8975f5c5SAndroid Build Coastguard Worker GLGETBLOBPROCANGLE value)
651*8975f5c5SAndroid Build Coastguard Worker {
652*8975f5c5SAndroid Build Coastguard Worker // It's not necessary to implement correct capture for these types.
653*8975f5c5SAndroid Build Coastguard Worker os << "0";
654*8975f5c5SAndroid Build Coastguard Worker }
655*8975f5c5SAndroid Build Coastguard Worker
656*8975f5c5SAndroid Build Coastguard Worker template <>
WriteParamValueReplay(std::ostream & os,const CallCapture & call,GLSETBLOBPROCANGLE value)657*8975f5c5SAndroid Build Coastguard Worker void WriteParamValueReplay<ParamType::TGLSETBLOBPROCANGLE>(std::ostream &os,
658*8975f5c5SAndroid Build Coastguard Worker const CallCapture &call,
659*8975f5c5SAndroid Build Coastguard Worker GLSETBLOBPROCANGLE value)
660*8975f5c5SAndroid Build Coastguard Worker {
661*8975f5c5SAndroid Build Coastguard Worker // It's not necessary to implement correct capture for these types.
662*8975f5c5SAndroid Build Coastguard Worker os << "0";
663*8975f5c5SAndroid Build Coastguard Worker }
664*8975f5c5SAndroid Build Coastguard Worker
665*8975f5c5SAndroid Build Coastguard Worker template <typename ParamValueType>
FindResourceIDsInCall(const CallCapture & call,std::vector<ParamValueType> & idsOut)666*8975f5c5SAndroid Build Coastguard Worker bool FindResourceIDsInCall(const CallCapture &call, std::vector<ParamValueType> &idsOut)
667*8975f5c5SAndroid Build Coastguard Worker {
668*8975f5c5SAndroid Build Coastguard Worker const ParamType paramType = ParamValueTrait<ParamValueType>::typeID;
669*8975f5c5SAndroid Build Coastguard Worker for (const ParamCapture ¶m : call.params.getParamCaptures())
670*8975f5c5SAndroid Build Coastguard Worker {
671*8975f5c5SAndroid Build Coastguard Worker if (param.type == paramType)
672*8975f5c5SAndroid Build Coastguard Worker {
673*8975f5c5SAndroid Build Coastguard Worker const ParamValueType id = AccessParamValue<ParamValueType>(paramType, param.value);
674*8975f5c5SAndroid Build Coastguard Worker idsOut.push_back(id);
675*8975f5c5SAndroid Build Coastguard Worker }
676*8975f5c5SAndroid Build Coastguard Worker }
677*8975f5c5SAndroid Build Coastguard Worker
678*8975f5c5SAndroid Build Coastguard Worker return !idsOut.empty();
679*8975f5c5SAndroid Build Coastguard Worker }
680*8975f5c5SAndroid Build Coastguard Worker
681*8975f5c5SAndroid Build Coastguard Worker // Explicit instantiation
682*8975f5c5SAndroid Build Coastguard Worker template bool FindResourceIDsInCall<gl::TextureID>(const CallCapture &call,
683*8975f5c5SAndroid Build Coastguard Worker std::vector<gl::TextureID> &idsOut);
684*8975f5c5SAndroid Build Coastguard Worker template bool FindResourceIDsInCall<gl::ShaderProgramID>(const CallCapture &call,
685*8975f5c5SAndroid Build Coastguard Worker std::vector<gl::ShaderProgramID> &idsOut);
686*8975f5c5SAndroid Build Coastguard Worker } // namespace angle
687