• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2019 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // capture_gles3_params.cpp:
7 //   Pointer parameter capture functions for the OpenGL ES 3.0 entry points.
8 
9 #include "libANGLE/capture/capture_gles_2_0_autogen.h"
10 #include "libANGLE/capture/capture_gles_3_0_autogen.h"
11 
12 using namespace angle;
13 
14 namespace gl
15 {
CaptureClearBufferfv_value(const State & glState,bool isCallValid,GLenum buffer,GLint drawbuffer,const GLfloat * value,ParamCapture * paramCapture)16 void CaptureClearBufferfv_value(const State &glState,
17                                 bool isCallValid,
18                                 GLenum buffer,
19                                 GLint drawbuffer,
20                                 const GLfloat *value,
21                                 ParamCapture *paramCapture)
22 {
23     CaptureClearBufferValue<GLfloat>(buffer, value, paramCapture);
24 }
25 
CaptureClearBufferiv_value(const State & glState,bool isCallValid,GLenum buffer,GLint drawbuffer,const GLint * value,ParamCapture * paramCapture)26 void CaptureClearBufferiv_value(const State &glState,
27                                 bool isCallValid,
28                                 GLenum buffer,
29                                 GLint drawbuffer,
30                                 const GLint *value,
31                                 ParamCapture *paramCapture)
32 {
33     CaptureClearBufferValue<GLint>(buffer, value, paramCapture);
34 }
35 
CaptureClearBufferuiv_value(const State & glState,bool isCallValid,GLenum buffer,GLint drawbuffer,const GLuint * value,ParamCapture * paramCapture)36 void CaptureClearBufferuiv_value(const State &glState,
37                                  bool isCallValid,
38                                  GLenum buffer,
39                                  GLint drawbuffer,
40                                  const GLuint *value,
41                                  ParamCapture *paramCapture)
42 {
43     CaptureClearBufferValue<GLuint>(buffer, value, paramCapture);
44 }
45 
CaptureCompressedTexImage3D_data(const State & glState,bool isCallValid,TextureTarget targetPacked,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const void * data,ParamCapture * paramCapture)46 void CaptureCompressedTexImage3D_data(const State &glState,
47                                       bool isCallValid,
48                                       TextureTarget targetPacked,
49                                       GLint level,
50                                       GLenum internalformat,
51                                       GLsizei width,
52                                       GLsizei height,
53                                       GLsizei depth,
54                                       GLint border,
55                                       GLsizei imageSize,
56                                       const void *data,
57                                       ParamCapture *paramCapture)
58 {
59     if (glState.getTargetBuffer(gl::BufferBinding::PixelUnpack))
60     {
61         return;
62     }
63 
64     if (!data)
65     {
66         return;
67     }
68 
69     CaptureMemory(data, imageSize, paramCapture);
70 }
71 
CaptureCompressedTexSubImage3D_data(const State & glState,bool isCallValid,TextureTarget targetPacked,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const void * data,ParamCapture * paramCapture)72 void CaptureCompressedTexSubImage3D_data(const State &glState,
73                                          bool isCallValid,
74                                          TextureTarget targetPacked,
75                                          GLint level,
76                                          GLint xoffset,
77                                          GLint yoffset,
78                                          GLint zoffset,
79                                          GLsizei width,
80                                          GLsizei height,
81                                          GLsizei depth,
82                                          GLenum format,
83                                          GLsizei imageSize,
84                                          const void *data,
85                                          ParamCapture *paramCapture)
86 {
87     CaptureCompressedTexImage3D_data(glState, isCallValid, targetPacked, level, 0, width, height,
88                                      depth, 0, imageSize, data, paramCapture);
89 }
90 
CaptureDeleteQueries_idsPacked(const State & glState,bool isCallValid,GLsizei n,const QueryID * ids,ParamCapture * paramCapture)91 void CaptureDeleteQueries_idsPacked(const State &glState,
92                                     bool isCallValid,
93                                     GLsizei n,
94                                     const QueryID *ids,
95                                     ParamCapture *paramCapture)
96 {
97     CaptureArray(ids, n, paramCapture);
98 }
99 
CaptureDeleteSamplers_samplersPacked(const State & glState,bool isCallValid,GLsizei count,const SamplerID * samplers,ParamCapture * paramCapture)100 void CaptureDeleteSamplers_samplersPacked(const State &glState,
101                                           bool isCallValid,
102                                           GLsizei count,
103                                           const SamplerID *samplers,
104                                           ParamCapture *paramCapture)
105 {
106     CaptureArray(samplers, count, paramCapture);
107 }
108 
CaptureDeleteTransformFeedbacks_idsPacked(const State & glState,bool isCallValid,GLsizei n,const TransformFeedbackID * ids,ParamCapture * paramCapture)109 void CaptureDeleteTransformFeedbacks_idsPacked(const State &glState,
110                                                bool isCallValid,
111                                                GLsizei n,
112                                                const TransformFeedbackID *ids,
113                                                ParamCapture *paramCapture)
114 {
115     CaptureArray(ids, n, paramCapture);
116 }
117 
CaptureDeleteVertexArrays_arraysPacked(const State & glState,bool isCallValid,GLsizei n,const VertexArrayID * arrays,ParamCapture * paramCapture)118 void CaptureDeleteVertexArrays_arraysPacked(const State &glState,
119                                             bool isCallValid,
120                                             GLsizei n,
121                                             const VertexArrayID *arrays,
122                                             ParamCapture *paramCapture)
123 {
124     CaptureArray(arrays, n, paramCapture);
125 }
126 
CaptureDrawBuffers_bufs(const State & glState,bool isCallValid,GLsizei n,const GLenum * bufs,ParamCapture * paramCapture)127 void CaptureDrawBuffers_bufs(const State &glState,
128                              bool isCallValid,
129                              GLsizei n,
130                              const GLenum *bufs,
131                              ParamCapture *paramCapture)
132 {
133     CaptureArray(bufs, n, paramCapture);
134 }
135 
CaptureDrawElementsInstanced_indices(const State & glState,bool isCallValid,PrimitiveMode modePacked,GLsizei count,DrawElementsType typePacked,const void * indices,GLsizei instancecount,ParamCapture * paramCapture)136 void CaptureDrawElementsInstanced_indices(const State &glState,
137                                           bool isCallValid,
138                                           PrimitiveMode modePacked,
139                                           GLsizei count,
140                                           DrawElementsType typePacked,
141                                           const void *indices,
142                                           GLsizei instancecount,
143                                           ParamCapture *paramCapture)
144 {
145     CaptureDrawElements_indices(glState, isCallValid, modePacked, count, typePacked, indices,
146                                 paramCapture);
147 }
148 
CaptureDrawRangeElements_indices(const State & glState,bool isCallValid,PrimitiveMode modePacked,GLuint start,GLuint end,GLsizei count,DrawElementsType typePacked,const void * indices,ParamCapture * paramCapture)149 void CaptureDrawRangeElements_indices(const State &glState,
150                                       bool isCallValid,
151                                       PrimitiveMode modePacked,
152                                       GLuint start,
153                                       GLuint end,
154                                       GLsizei count,
155                                       DrawElementsType typePacked,
156                                       const void *indices,
157                                       ParamCapture *paramCapture)
158 {
159     CaptureDrawElements_indices(glState, isCallValid, modePacked, count, typePacked, indices,
160                                 paramCapture);
161 }
162 
CaptureGenQueries_idsPacked(const State & glState,bool isCallValid,GLsizei n,QueryID * ids,ParamCapture * paramCapture)163 void CaptureGenQueries_idsPacked(const State &glState,
164                                  bool isCallValid,
165                                  GLsizei n,
166                                  QueryID *ids,
167                                  ParamCapture *paramCapture)
168 {
169     CaptureGenHandles(n, ids, paramCapture);
170 }
171 
CaptureGenSamplers_samplersPacked(const State & glState,bool isCallValid,GLsizei count,SamplerID * samplers,ParamCapture * paramCapture)172 void CaptureGenSamplers_samplersPacked(const State &glState,
173                                        bool isCallValid,
174                                        GLsizei count,
175                                        SamplerID *samplers,
176                                        ParamCapture *paramCapture)
177 {
178     CaptureGenHandles(count, samplers, paramCapture);
179 }
180 
CaptureGenTransformFeedbacks_idsPacked(const State & glState,bool isCallValid,GLsizei n,TransformFeedbackID * ids,ParamCapture * paramCapture)181 void CaptureGenTransformFeedbacks_idsPacked(const State &glState,
182                                             bool isCallValid,
183                                             GLsizei n,
184                                             TransformFeedbackID *ids,
185                                             ParamCapture *paramCapture)
186 {
187     CaptureGenHandles(n, ids, paramCapture);
188 }
189 
CaptureGenVertexArrays_arraysPacked(const State & glState,bool isCallValid,GLsizei n,VertexArrayID * arrays,ParamCapture * paramCapture)190 void CaptureGenVertexArrays_arraysPacked(const State &glState,
191                                          bool isCallValid,
192                                          GLsizei n,
193                                          VertexArrayID *arrays,
194                                          ParamCapture *paramCapture)
195 {
196     CaptureGenHandles(n, arrays, paramCapture);
197 }
198 
CaptureGetActiveUniformBlockName_length(const State & glState,bool isCallValid,ShaderProgramID program,UniformBlockIndex uniformBlockIndex,GLsizei bufSize,GLsizei * length,GLchar * uniformBlockName,ParamCapture * paramCapture)199 void CaptureGetActiveUniformBlockName_length(const State &glState,
200                                              bool isCallValid,
201                                              ShaderProgramID program,
202                                              UniformBlockIndex uniformBlockIndex,
203                                              GLsizei bufSize,
204                                              GLsizei *length,
205                                              GLchar *uniformBlockName,
206                                              ParamCapture *paramCapture)
207 {
208     // From the OpenGL ES 3.0 spec:
209     // The actual number of characters written into uniformBlockName, excluding the null terminator,
210     // is returned in length. If length is NULL, no length is returned.
211     if (length)
212     {
213         paramCapture->readBufferSizeBytes = sizeof(GLsizei);
214     }
215 }
216 
CaptureGetActiveUniformBlockName_uniformBlockName(const State & glState,bool isCallValid,ShaderProgramID program,UniformBlockIndex uniformBlockIndex,GLsizei bufSize,GLsizei * length,GLchar * uniformBlockName,ParamCapture * paramCapture)217 void CaptureGetActiveUniformBlockName_uniformBlockName(const State &glState,
218                                                        bool isCallValid,
219                                                        ShaderProgramID program,
220                                                        UniformBlockIndex uniformBlockIndex,
221                                                        GLsizei bufSize,
222                                                        GLsizei *length,
223                                                        GLchar *uniformBlockName,
224                                                        ParamCapture *paramCapture)
225 {
226     // From the OpenGL ES 3.0 spec:
227     // bufSize contains the maximum number of characters (including the null terminator) that will
228     // be written back to uniformBlockName.
229     CaptureStringLimit(uniformBlockName, bufSize, paramCapture);
230 }
231 
CaptureGetActiveUniformBlockiv_params(const State & glState,bool isCallValid,ShaderProgramID program,UniformBlockIndex uniformBlockIndex,GLenum pname,GLint * params,ParamCapture * paramCapture)232 void CaptureGetActiveUniformBlockiv_params(const State &glState,
233                                            bool isCallValid,
234                                            ShaderProgramID program,
235                                            UniformBlockIndex uniformBlockIndex,
236                                            GLenum pname,
237                                            GLint *params,
238                                            ParamCapture *paramCapture)
239 {
240     CaptureGetActiveUniformBlockivParameters(glState, program, uniformBlockIndex, pname,
241                                              paramCapture);
242 }
243 
CaptureGetActiveUniformsiv_uniformIndices(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei uniformCount,const GLuint * uniformIndices,GLenum pname,GLint * params,ParamCapture * paramCapture)244 void CaptureGetActiveUniformsiv_uniformIndices(const State &glState,
245                                                bool isCallValid,
246                                                ShaderProgramID program,
247                                                GLsizei uniformCount,
248                                                const GLuint *uniformIndices,
249                                                GLenum pname,
250                                                GLint *params,
251                                                ParamCapture *paramCapture)
252 {
253     // From the OpenGL ES 3.0 spec:
254     // For GetActiveUniformsiv, uniformCountindicates both the number of
255     // elements in the array of indices uniformIndices and the number of
256     // parameters written to params upon successful return.
257     CaptureArray(uniformIndices, uniformCount, paramCapture);
258 }
259 
CaptureGetActiveUniformsiv_params(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei uniformCount,const GLuint * uniformIndices,GLenum pname,GLint * params,ParamCapture * paramCapture)260 void CaptureGetActiveUniformsiv_params(const State &glState,
261                                        bool isCallValid,
262                                        ShaderProgramID program,
263                                        GLsizei uniformCount,
264                                        const GLuint *uniformIndices,
265                                        GLenum pname,
266                                        GLint *params,
267                                        ParamCapture *paramCapture)
268 {
269     // From the OpenGL ES 3.0 spec:
270     // For GetActiveUniformsiv, uniformCountindicates both the number of
271     // elements in the array of indices uniformIndices and the number of
272     // parameters written to params upon successful return.
273     paramCapture->readBufferSizeBytes = sizeof(GLint) * uniformCount;
274 }
275 
CaptureGetBufferParameteri64v_params(const State & glState,bool isCallValid,BufferBinding targetPacked,GLenum pname,GLint64 * params,ParamCapture * paramCapture)276 void CaptureGetBufferParameteri64v_params(const State &glState,
277                                           bool isCallValid,
278                                           BufferBinding targetPacked,
279                                           GLenum pname,
280                                           GLint64 *params,
281                                           ParamCapture *paramCapture)
282 {
283     // This only returns one value
284     paramCapture->readBufferSizeBytes = sizeof(GLuint);
285 }
286 
CaptureGetBufferPointerv_params(const State & glState,bool isCallValid,BufferBinding targetPacked,GLenum pname,void ** params,ParamCapture * paramCapture)287 void CaptureGetBufferPointerv_params(const State &glState,
288                                      bool isCallValid,
289                                      BufferBinding targetPacked,
290                                      GLenum pname,
291                                      void **params,
292                                      ParamCapture *paramCapture)
293 {
294     UNIMPLEMENTED();
295 }
296 
CaptureGetFragDataLocation_name(const State & glState,bool isCallValid,ShaderProgramID program,const GLchar * name,ParamCapture * paramCapture)297 void CaptureGetFragDataLocation_name(const State &glState,
298                                      bool isCallValid,
299                                      ShaderProgramID program,
300                                      const GLchar *name,
301                                      ParamCapture *paramCapture)
302 {
303     CaptureString(name, paramCapture);
304 }
305 
CaptureGetInteger64i_v_data(const State & glState,bool isCallValid,GLenum target,GLuint index,GLint64 * data,ParamCapture * paramCapture)306 void CaptureGetInteger64i_v_data(const State &glState,
307                                  bool isCallValid,
308                                  GLenum target,
309                                  GLuint index,
310                                  GLint64 *data,
311                                  ParamCapture *paramCapture)
312 {
313     CaptureGetParameter(glState, target, sizeof(GLint64), paramCapture);
314 }
315 
CaptureGetInteger64v_data(const State & glState,bool isCallValid,GLenum pname,GLint64 * data,ParamCapture * paramCapture)316 void CaptureGetInteger64v_data(const State &glState,
317                                bool isCallValid,
318                                GLenum pname,
319                                GLint64 *data,
320                                ParamCapture *paramCapture)
321 {
322     CaptureGetParameter(glState, pname, sizeof(GLint64), paramCapture);
323 }
324 
CaptureGetIntegeri_v_data(const State & glState,bool isCallValid,GLenum target,GLuint index,GLint * data,ParamCapture * paramCapture)325 void CaptureGetIntegeri_v_data(const State &glState,
326                                bool isCallValid,
327                                GLenum target,
328                                GLuint index,
329                                GLint *data,
330                                ParamCapture *paramCapture)
331 {
332     CaptureGetParameter(glState, target, sizeof(GLint), paramCapture);
333 }
334 
CaptureGetInternalformativ_params(const State & glState,bool isCallValid,GLenum target,GLenum internalformat,GLenum pname,GLsizei bufSize,GLint * params,ParamCapture * paramCapture)335 void CaptureGetInternalformativ_params(const State &glState,
336                                        bool isCallValid,
337                                        GLenum target,
338                                        GLenum internalformat,
339                                        GLenum pname,
340                                        GLsizei bufSize,
341                                        GLint *params,
342                                        ParamCapture *paramCapture)
343 {
344     // From the OpenGL ES 3.0 spec:
345     //
346     // The information retrieved will be written to memory addressed by the pointer specified in
347     // params.
348     //
349     // No more than bufSize integers will be written to this memory.
350     //
351     // If pname is GL_NUM_SAMPLE_COUNTS, the number of sample counts that would be returned by
352     // querying GL_SAMPLES will be returned in params.
353     //
354     // If pname is GL_SAMPLES, the sample counts supported for internalformat and target are written
355     // into params in descending numeric order. Only positive values are returned.
356     //
357     // Querying GL_SAMPLES with bufSize of one will return just the maximum supported number of
358     // samples for this format.
359 
360     if (bufSize == 0)
361         return;
362 
363     if (params)
364     {
365         // For GL_NUM_SAMPLE_COUNTS, only one value is returned
366         // For GL_SAMPLES, two values will be returned, unless bufSize limits it to one
367         uint32_t paramCount = (pname == GL_SAMPLES && bufSize > 1) ? 2 : 1;
368 
369         paramCapture->readBufferSizeBytes = sizeof(GLint) * paramCount;
370     }
371 }
372 
CaptureGetProgramBinary_length(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei bufSize,GLsizei * length,GLenum * binaryFormat,void * binary,ParamCapture * paramCapture)373 void CaptureGetProgramBinary_length(const State &glState,
374                                     bool isCallValid,
375                                     ShaderProgramID program,
376                                     GLsizei bufSize,
377                                     GLsizei *length,
378                                     GLenum *binaryFormat,
379                                     void *binary,
380                                     ParamCapture *paramCapture)
381 {
382     if (length)
383     {
384         paramCapture->readBufferSizeBytes = sizeof(GLsizei);
385     }
386 }
387 
CaptureGetProgramBinary_binaryFormat(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei bufSize,GLsizei * length,GLenum * binaryFormat,void * binary,ParamCapture * paramCapture)388 void CaptureGetProgramBinary_binaryFormat(const State &glState,
389                                           bool isCallValid,
390                                           ShaderProgramID program,
391                                           GLsizei bufSize,
392                                           GLsizei *length,
393                                           GLenum *binaryFormat,
394                                           void *binary,
395                                           ParamCapture *paramCapture)
396 {
397     paramCapture->readBufferSizeBytes = sizeof(GLenum);
398 }
399 
CaptureGetProgramBinary_binary(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei bufSize,GLsizei * length,GLenum * binaryFormat,void * binary,ParamCapture * paramCapture)400 void CaptureGetProgramBinary_binary(const State &glState,
401                                     bool isCallValid,
402                                     ShaderProgramID program,
403                                     GLsizei bufSize,
404                                     GLsizei *length,
405                                     GLenum *binaryFormat,
406                                     void *binary,
407                                     ParamCapture *paramCapture)
408 {
409     // If we have length, then actual binarySize was written there
410     // Otherwise, we don't know how many bytes were written
411     if (!length)
412     {
413         UNIMPLEMENTED();
414         return;
415     }
416 
417     GLsizei binarySize = *length;
418     if (binarySize > bufSize)
419     {
420         // This is a GL error, but clamp it anyway
421         binarySize = bufSize;
422     }
423 
424     paramCapture->readBufferSizeBytes = binarySize;
425 }
426 
CaptureGetQueryObjectuiv_params(const State & glState,bool isCallValid,QueryID id,GLenum pname,GLuint * params,ParamCapture * paramCapture)427 void CaptureGetQueryObjectuiv_params(const State &glState,
428                                      bool isCallValid,
429                                      QueryID id,
430                                      GLenum pname,
431                                      GLuint *params,
432                                      ParamCapture *paramCapture)
433 {
434     // This only returns one value
435     paramCapture->readBufferSizeBytes = sizeof(GLuint);
436 }
437 
CaptureGetQueryiv_params(const State & glState,bool isCallValid,QueryType targetPacked,GLenum pname,GLint * params,ParamCapture * paramCapture)438 void CaptureGetQueryiv_params(const State &glState,
439                               bool isCallValid,
440                               QueryType targetPacked,
441                               GLenum pname,
442                               GLint *params,
443                               ParamCapture *paramCapture)
444 {
445     // This only returns one value
446     paramCapture->readBufferSizeBytes = sizeof(GLint);
447 }
448 
CaptureGetSamplerParameterfv_params(const State & glState,bool isCallValid,SamplerID sampler,GLenum pname,GLfloat * params,ParamCapture * paramCapture)449 void CaptureGetSamplerParameterfv_params(const State &glState,
450                                          bool isCallValid,
451                                          SamplerID sampler,
452                                          GLenum pname,
453                                          GLfloat *params,
454                                          ParamCapture *paramCapture)
455 {
456     // page 458 https://www.khronos.org/registry/OpenGL/specs/es/3.2/es_spec_3.2.pdf
457     paramCapture->readBufferSizeBytes = 4 * sizeof(GLfloat);
458 }
459 
CaptureGetSamplerParameteriv_params(const State & glState,bool isCallValid,SamplerID sampler,GLenum pname,GLint * params,ParamCapture * paramCapture)460 void CaptureGetSamplerParameteriv_params(const State &glState,
461                                          bool isCallValid,
462                                          SamplerID sampler,
463                                          GLenum pname,
464                                          GLint *params,
465                                          ParamCapture *paramCapture)
466 {
467     // page 458 https://www.khronos.org/registry/OpenGL/specs/es/3.2/es_spec_3.2.pdf
468     paramCapture->readBufferSizeBytes = 4 * sizeof(GLint);
469 }
470 
CaptureGetSynciv_length(const State & glState,bool isCallValid,SyncID syncPacked,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * values,ParamCapture * paramCapture)471 void CaptureGetSynciv_length(const State &glState,
472                              bool isCallValid,
473                              SyncID syncPacked,
474                              GLenum pname,
475                              GLsizei bufSize,
476                              GLsizei *length,
477                              GLint *values,
478                              ParamCapture *paramCapture)
479 {
480     if (length)
481     {
482         paramCapture->readBufferSizeBytes = sizeof(GLsizei);
483     }
484 }
485 
CaptureGetSynciv_values(const State & glState,bool isCallValid,SyncID syncPacked,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * values,ParamCapture * paramCapture)486 void CaptureGetSynciv_values(const State &glState,
487                              bool isCallValid,
488                              SyncID syncPacked,
489                              GLenum pname,
490                              GLsizei bufSize,
491                              GLsizei *length,
492                              GLint *values,
493                              ParamCapture *paramCapture)
494 {
495     // Spec: On success, GetSynciv replaces up to bufSize integers in values with the corresponding
496     // property values of the object being queried. The actual number of integers replaced is
497     // returned in *length.If length is NULL, no length is returned.
498     if (bufSize == 0)
499         return;
500 
501     if (values)
502     {
503         paramCapture->readBufferSizeBytes = sizeof(GLint) * bufSize;
504     }
505 }
506 
CaptureGetTransformFeedbackVarying_length(const State & glState,bool isCallValid,ShaderProgramID program,GLuint index,GLsizei bufSize,GLsizei * length,GLsizei * size,GLenum * type,GLchar * name,ParamCapture * paramCapture)507 void CaptureGetTransformFeedbackVarying_length(const State &glState,
508                                                bool isCallValid,
509                                                ShaderProgramID program,
510                                                GLuint index,
511                                                GLsizei bufSize,
512                                                GLsizei *length,
513                                                GLsizei *size,
514                                                GLenum *type,
515                                                GLchar *name,
516                                                ParamCapture *paramCapture)
517 {
518     UNIMPLEMENTED();
519 }
520 
CaptureGetTransformFeedbackVarying_size(const State & glState,bool isCallValid,ShaderProgramID program,GLuint index,GLsizei bufSize,GLsizei * length,GLsizei * size,GLenum * type,GLchar * name,ParamCapture * paramCapture)521 void CaptureGetTransformFeedbackVarying_size(const State &glState,
522                                              bool isCallValid,
523                                              ShaderProgramID program,
524                                              GLuint index,
525                                              GLsizei bufSize,
526                                              GLsizei *length,
527                                              GLsizei *size,
528                                              GLenum *type,
529                                              GLchar *name,
530                                              ParamCapture *paramCapture)
531 {
532     UNIMPLEMENTED();
533 }
534 
CaptureGetTransformFeedbackVarying_type(const State & glState,bool isCallValid,ShaderProgramID program,GLuint index,GLsizei bufSize,GLsizei * length,GLsizei * size,GLenum * type,GLchar * name,ParamCapture * paramCapture)535 void CaptureGetTransformFeedbackVarying_type(const State &glState,
536                                              bool isCallValid,
537                                              ShaderProgramID program,
538                                              GLuint index,
539                                              GLsizei bufSize,
540                                              GLsizei *length,
541                                              GLsizei *size,
542                                              GLenum *type,
543                                              GLchar *name,
544                                              ParamCapture *paramCapture)
545 {
546     UNIMPLEMENTED();
547 }
548 
CaptureGetTransformFeedbackVarying_name(const State & glState,bool isCallValid,ShaderProgramID program,GLuint index,GLsizei bufSize,GLsizei * length,GLsizei * size,GLenum * type,GLchar * name,ParamCapture * paramCapture)549 void CaptureGetTransformFeedbackVarying_name(const State &glState,
550                                              bool isCallValid,
551                                              ShaderProgramID program,
552                                              GLuint index,
553                                              GLsizei bufSize,
554                                              GLsizei *length,
555                                              GLsizei *size,
556                                              GLenum *type,
557                                              GLchar *name,
558                                              ParamCapture *paramCapture)
559 {
560     UNIMPLEMENTED();
561 }
562 
CaptureGetUniformBlockIndex_uniformBlockName(const State & glState,bool isCallValid,ShaderProgramID program,const GLchar * uniformBlockName,ParamCapture * paramCapture)563 void CaptureGetUniformBlockIndex_uniformBlockName(const State &glState,
564                                                   bool isCallValid,
565                                                   ShaderProgramID program,
566                                                   const GLchar *uniformBlockName,
567                                                   ParamCapture *paramCapture)
568 {
569     CaptureString(uniformBlockName, paramCapture);
570 }
571 
CaptureGetUniformIndices_uniformNames(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei uniformCount,const GLchar * const * uniformNames,GLuint * uniformIndices,ParamCapture * paramCapture)572 void CaptureGetUniformIndices_uniformNames(const State &glState,
573                                            bool isCallValid,
574                                            ShaderProgramID program,
575                                            GLsizei uniformCount,
576                                            const GLchar *const *uniformNames,
577                                            GLuint *uniformIndices,
578                                            ParamCapture *paramCapture)
579 {
580     for (GLsizei index = 0; index < uniformCount; ++index)
581     {
582         CaptureString(uniformNames[index], paramCapture);
583     }
584 }
585 
CaptureGetUniformIndices_uniformIndices(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei uniformCount,const GLchar * const * uniformNames,GLuint * uniformIndices,ParamCapture * paramCapture)586 void CaptureGetUniformIndices_uniformIndices(const State &glState,
587                                              bool isCallValid,
588                                              ShaderProgramID program,
589                                              GLsizei uniformCount,
590                                              const GLchar *const *uniformNames,
591                                              GLuint *uniformIndices,
592                                              ParamCapture *paramCapture)
593 {
594     CaptureMemory(uniformIndices, sizeof(GLuint) * uniformCount, paramCapture);
595 }
596 
CaptureGetUniformuiv_params(const State & glState,bool isCallValid,ShaderProgramID program,UniformLocation location,GLuint * params,ParamCapture * paramCapture)597 void CaptureGetUniformuiv_params(const State &glState,
598                                  bool isCallValid,
599                                  ShaderProgramID program,
600                                  UniformLocation location,
601                                  GLuint *params,
602                                  ParamCapture *paramCapture)
603 {
604     /* At most a mat4 can be returned, so use this upper bound as count */
605     CaptureArray(params, 16 * sizeof(GLuint), paramCapture);
606 }
607 
CaptureGetVertexAttribIiv_params(const State & glState,bool isCallValid,GLuint index,GLenum pname,GLint * params,ParamCapture * paramCapture)608 void CaptureGetVertexAttribIiv_params(const State &glState,
609                                       bool isCallValid,
610                                       GLuint index,
611                                       GLenum pname,
612                                       GLint *params,
613                                       ParamCapture *paramCapture)
614 {
615     int nParams = pname == GL_CURRENT_VERTEX_ATTRIB ? 4 : 1;
616 
617     paramCapture->readBufferSizeBytes = nParams * sizeof(GLint);
618 }
619 
CaptureGetVertexAttribIuiv_params(const State & glState,bool isCallValid,GLuint index,GLenum pname,GLuint * params,ParamCapture * paramCapture)620 void CaptureGetVertexAttribIuiv_params(const State &glState,
621                                        bool isCallValid,
622                                        GLuint index,
623                                        GLenum pname,
624                                        GLuint *params,
625                                        ParamCapture *paramCapture)
626 {
627     int nParams = pname == GL_CURRENT_VERTEX_ATTRIB ? 4 : 1;
628 
629     paramCapture->readBufferSizeBytes = nParams * sizeof(GLuint);
630 }
631 
CaptureInvalidateFramebuffer_attachments(const State & glState,bool isCallValid,GLenum target,GLsizei numAttachments,const GLenum * attachments,ParamCapture * paramCapture)632 void CaptureInvalidateFramebuffer_attachments(const State &glState,
633                                               bool isCallValid,
634                                               GLenum target,
635                                               GLsizei numAttachments,
636                                               const GLenum *attachments,
637                                               ParamCapture *paramCapture)
638 {
639     CaptureMemory(attachments, sizeof(GLenum) * numAttachments, paramCapture);
640     paramCapture->value.voidConstPointerVal = paramCapture->data[0].data();
641 }
642 
CaptureInvalidateSubFramebuffer_attachments(const State & glState,bool isCallValid,GLenum target,GLsizei numAttachments,const GLenum * attachments,GLint x,GLint y,GLsizei width,GLsizei height,ParamCapture * paramCapture)643 void CaptureInvalidateSubFramebuffer_attachments(const State &glState,
644                                                  bool isCallValid,
645                                                  GLenum target,
646                                                  GLsizei numAttachments,
647                                                  const GLenum *attachments,
648                                                  GLint x,
649                                                  GLint y,
650                                                  GLsizei width,
651                                                  GLsizei height,
652                                                  ParamCapture *paramCapture)
653 {
654     CaptureMemory(attachments, sizeof(GLenum) * numAttachments, paramCapture);
655 }
656 
CaptureProgramBinary_binary(const State & glState,bool isCallValid,ShaderProgramID program,GLenum binaryFormat,const void * binary,GLsizei length,ParamCapture * paramCapture)657 void CaptureProgramBinary_binary(const State &glState,
658                                  bool isCallValid,
659                                  ShaderProgramID program,
660                                  GLenum binaryFormat,
661                                  const void *binary,
662                                  GLsizei length,
663                                  ParamCapture *paramCapture)
664 {
665     // Do nothing. glProgramBinary will be overridden in GenerateLinkedProgram.
666 }
667 
CaptureSamplerParameterfv_param(const State & glState,bool isCallValid,SamplerID sampler,GLenum pname,const GLfloat * param,ParamCapture * paramCapture)668 void CaptureSamplerParameterfv_param(const State &glState,
669                                      bool isCallValid,
670                                      SamplerID sampler,
671                                      GLenum pname,
672                                      const GLfloat *param,
673                                      ParamCapture *paramCapture)
674 {
675     CaptureTextureAndSamplerParameter_params<GLfloat>(pname, param, paramCapture);
676 }
677 
CaptureSamplerParameteriv_param(const State & glState,bool isCallValid,SamplerID sampler,GLenum pname,const GLint * param,ParamCapture * paramCapture)678 void CaptureSamplerParameteriv_param(const State &glState,
679                                      bool isCallValid,
680                                      SamplerID sampler,
681                                      GLenum pname,
682                                      const GLint *param,
683                                      ParamCapture *paramCapture)
684 {
685     CaptureTextureAndSamplerParameter_params<GLint>(pname, param, paramCapture);
686 }
687 
CaptureTexImage3D_pixels(const State & glState,bool isCallValid,TextureTarget targetPacked,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,const void * pixels,ParamCapture * paramCapture)688 void CaptureTexImage3D_pixels(const State &glState,
689                               bool isCallValid,
690                               TextureTarget targetPacked,
691                               GLint level,
692                               GLint internalformat,
693                               GLsizei width,
694                               GLsizei height,
695                               GLsizei depth,
696                               GLint border,
697                               GLenum format,
698                               GLenum type,
699                               const void *pixels,
700                               ParamCapture *paramCapture)
701 {
702     if (glState.getTargetBuffer(gl::BufferBinding::PixelUnpack))
703     {
704         return;
705     }
706 
707     if (!pixels)
708     {
709         return;
710     }
711 
712     const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(format, type);
713     const gl::PixelUnpackState &unpack           = glState.getUnpackState();
714 
715     const Extents size(width, height, depth);
716 
717     GLuint endByte = 0;
718     bool unpackSize =
719         internalFormatInfo.computePackUnpackEndByte(type, size, unpack, true, &endByte);
720     ASSERT(unpackSize);
721 
722     CaptureMemory(pixels, static_cast<size_t>(endByte), paramCapture);
723 }
724 
CaptureTexSubImage3D_pixels(const State & glState,bool isCallValid,TextureTarget targetPacked,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const void * pixels,ParamCapture * paramCapture)725 void CaptureTexSubImage3D_pixels(const State &glState,
726                                  bool isCallValid,
727                                  TextureTarget targetPacked,
728                                  GLint level,
729                                  GLint xoffset,
730                                  GLint yoffset,
731                                  GLint zoffset,
732                                  GLsizei width,
733                                  GLsizei height,
734                                  GLsizei depth,
735                                  GLenum format,
736                                  GLenum type,
737                                  const void *pixels,
738                                  ParamCapture *paramCapture)
739 {
740     CaptureTexImage3D_pixels(glState, isCallValid, targetPacked, level, 0, width, height, depth, 0,
741                              format, type, pixels, paramCapture);
742 }
743 
CaptureTransformFeedbackVaryings_varyings(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei count,const GLchar * const * varyings,GLenum bufferMode,ParamCapture * paramCapture)744 void CaptureTransformFeedbackVaryings_varyings(const State &glState,
745                                                bool isCallValid,
746                                                ShaderProgramID program,
747                                                GLsizei count,
748                                                const GLchar *const *varyings,
749                                                GLenum bufferMode,
750                                                ParamCapture *paramCapture)
751 {
752     for (GLsizei index = 0; index < count; ++index)
753     {
754         CaptureString(varyings[index], paramCapture);
755     }
756 }
757 
CaptureUniform1uiv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,const GLuint * value,ParamCapture * paramCapture)758 void CaptureUniform1uiv_value(const State &glState,
759                               bool isCallValid,
760                               UniformLocation location,
761                               GLsizei count,
762                               const GLuint *value,
763                               ParamCapture *paramCapture)
764 {
765     CaptureMemory(value, count * sizeof(GLuint), paramCapture);
766 }
767 
CaptureUniform2uiv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,const GLuint * value,ParamCapture * paramCapture)768 void CaptureUniform2uiv_value(const State &glState,
769                               bool isCallValid,
770                               UniformLocation location,
771                               GLsizei count,
772                               const GLuint *value,
773                               ParamCapture *paramCapture)
774 {
775     CaptureMemory(value, count * sizeof(GLuint) * 2, paramCapture);
776 }
777 
CaptureUniform3uiv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,const GLuint * value,ParamCapture * paramCapture)778 void CaptureUniform3uiv_value(const State &glState,
779                               bool isCallValid,
780                               UniformLocation location,
781                               GLsizei count,
782                               const GLuint *value,
783                               ParamCapture *paramCapture)
784 {
785     CaptureMemory(value, count * sizeof(GLuint) * 3, paramCapture);
786 }
787 
CaptureUniform4uiv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,const GLuint * value,ParamCapture * paramCapture)788 void CaptureUniform4uiv_value(const State &glState,
789                               bool isCallValid,
790                               UniformLocation location,
791                               GLsizei count,
792                               const GLuint *value,
793                               ParamCapture *paramCapture)
794 {
795     CaptureMemory(value, count * sizeof(GLuint) * 4, paramCapture);
796 }
797 
CaptureUniformMatrix2x3fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)798 void CaptureUniformMatrix2x3fv_value(const State &glState,
799                                      bool isCallValid,
800                                      UniformLocation location,
801                                      GLsizei count,
802                                      GLboolean transpose,
803                                      const GLfloat *value,
804                                      ParamCapture *paramCapture)
805 {
806     CaptureMemory(value, count * sizeof(GLfloat) * 6, paramCapture);
807 }
808 
CaptureUniformMatrix2x4fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)809 void CaptureUniformMatrix2x4fv_value(const State &glState,
810                                      bool isCallValid,
811                                      UniformLocation location,
812                                      GLsizei count,
813                                      GLboolean transpose,
814                                      const GLfloat *value,
815                                      ParamCapture *paramCapture)
816 {
817     CaptureMemory(value, count * sizeof(GLfloat) * 8, paramCapture);
818 }
819 
CaptureUniformMatrix3x2fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)820 void CaptureUniformMatrix3x2fv_value(const State &glState,
821                                      bool isCallValid,
822                                      UniformLocation location,
823                                      GLsizei count,
824                                      GLboolean transpose,
825                                      const GLfloat *value,
826                                      ParamCapture *paramCapture)
827 {
828     CaptureMemory(value, count * sizeof(GLfloat) * 6, paramCapture);
829 }
830 
CaptureUniformMatrix3x4fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)831 void CaptureUniformMatrix3x4fv_value(const State &glState,
832                                      bool isCallValid,
833                                      UniformLocation location,
834                                      GLsizei count,
835                                      GLboolean transpose,
836                                      const GLfloat *value,
837                                      ParamCapture *paramCapture)
838 {
839     CaptureMemory(value, count * sizeof(GLfloat) * 12, paramCapture);
840 }
841 
CaptureUniformMatrix4x2fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)842 void CaptureUniformMatrix4x2fv_value(const State &glState,
843                                      bool isCallValid,
844                                      UniformLocation location,
845                                      GLsizei count,
846                                      GLboolean transpose,
847                                      const GLfloat *value,
848                                      ParamCapture *paramCapture)
849 {
850     CaptureMemory(value, count * sizeof(GLfloat) * 8, paramCapture);
851 }
852 
CaptureUniformMatrix4x3fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)853 void CaptureUniformMatrix4x3fv_value(const State &glState,
854                                      bool isCallValid,
855                                      UniformLocation location,
856                                      GLsizei count,
857                                      GLboolean transpose,
858                                      const GLfloat *value,
859                                      ParamCapture *paramCapture)
860 {
861     CaptureMemory(value, count * sizeof(GLfloat) * 12, paramCapture);
862 }
863 
CaptureVertexAttribI4iv_v(const State & glState,bool isCallValid,GLuint index,const GLint * v,ParamCapture * paramCapture)864 void CaptureVertexAttribI4iv_v(const State &glState,
865                                bool isCallValid,
866                                GLuint index,
867                                const GLint *v,
868                                ParamCapture *paramCapture)
869 {
870     UNIMPLEMENTED();
871 }
872 
CaptureVertexAttribI4uiv_v(const State & glState,bool isCallValid,GLuint index,const GLuint * v,ParamCapture * paramCapture)873 void CaptureVertexAttribI4uiv_v(const State &glState,
874                                 bool isCallValid,
875                                 GLuint index,
876                                 const GLuint *v,
877                                 ParamCapture *paramCapture)
878 {
879     UNIMPLEMENTED();
880 }
881 
CaptureVertexAttribIPointer_pointer(const State & glState,bool isCallValid,GLuint index,GLint size,VertexAttribType typePacked,GLsizei stride,const void * pointer,ParamCapture * paramCapture)882 void CaptureVertexAttribIPointer_pointer(const State &glState,
883                                          bool isCallValid,
884                                          GLuint index,
885                                          GLint size,
886                                          VertexAttribType typePacked,
887                                          GLsizei stride,
888                                          const void *pointer,
889                                          ParamCapture *paramCapture)
890 {
891     CaptureVertexAttribPointer_pointer(glState, isCallValid, index, size, typePacked, false, stride,
892                                        pointer, paramCapture);
893 }
894 
895 }  // namespace gl
896