• 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     UNIMPLEMENTED();
284 }
285 
CaptureGetBufferPointerv_params(const State & glState,bool isCallValid,BufferBinding targetPacked,GLenum pname,void ** params,ParamCapture * paramCapture)286 void CaptureGetBufferPointerv_params(const State &glState,
287                                      bool isCallValid,
288                                      BufferBinding targetPacked,
289                                      GLenum pname,
290                                      void **params,
291                                      ParamCapture *paramCapture)
292 {
293     UNIMPLEMENTED();
294 }
295 
CaptureGetFragDataLocation_name(const State & glState,bool isCallValid,ShaderProgramID program,const GLchar * name,ParamCapture * paramCapture)296 void CaptureGetFragDataLocation_name(const State &glState,
297                                      bool isCallValid,
298                                      ShaderProgramID program,
299                                      const GLchar *name,
300                                      ParamCapture *paramCapture)
301 {
302     UNIMPLEMENTED();
303 }
304 
CaptureGetInteger64i_v_data(const State & glState,bool isCallValid,GLenum target,GLuint index,GLint64 * data,ParamCapture * paramCapture)305 void CaptureGetInteger64i_v_data(const State &glState,
306                                  bool isCallValid,
307                                  GLenum target,
308                                  GLuint index,
309                                  GLint64 *data,
310                                  ParamCapture *paramCapture)
311 {
312     CaptureGetParameter(glState, target, sizeof(GLint64), paramCapture);
313 }
314 
CaptureGetInteger64v_data(const State & glState,bool isCallValid,GLenum pname,GLint64 * data,ParamCapture * paramCapture)315 void CaptureGetInteger64v_data(const State &glState,
316                                bool isCallValid,
317                                GLenum pname,
318                                GLint64 *data,
319                                ParamCapture *paramCapture)
320 {
321     CaptureGetParameter(glState, pname, sizeof(GLint64), paramCapture);
322 }
323 
CaptureGetIntegeri_v_data(const State & glState,bool isCallValid,GLenum target,GLuint index,GLint * data,ParamCapture * paramCapture)324 void CaptureGetIntegeri_v_data(const State &glState,
325                                bool isCallValid,
326                                GLenum target,
327                                GLuint index,
328                                GLint *data,
329                                ParamCapture *paramCapture)
330 {
331     CaptureGetParameter(glState, target, sizeof(GLint), paramCapture);
332 }
333 
CaptureGetInternalformativ_params(const State & glState,bool isCallValid,GLenum target,GLenum internalformat,GLenum pname,GLsizei bufSize,GLint * params,ParamCapture * paramCapture)334 void CaptureGetInternalformativ_params(const State &glState,
335                                        bool isCallValid,
336                                        GLenum target,
337                                        GLenum internalformat,
338                                        GLenum pname,
339                                        GLsizei bufSize,
340                                        GLint *params,
341                                        ParamCapture *paramCapture)
342 {
343     // From the OpenGL ES 3.0 spec:
344     //
345     // The information retrieved will be written to memory addressed by the pointer specified in
346     // params.
347     //
348     // No more than bufSize integers will be written to this memory.
349     //
350     // If pname is GL_NUM_SAMPLE_COUNTS, the number of sample counts that would be returned by
351     // querying GL_SAMPLES will be returned in params.
352     //
353     // If pname is GL_SAMPLES, the sample counts supported for internalformat and target are written
354     // into params in descending numeric order. Only positive values are returned.
355     //
356     // Querying GL_SAMPLES with bufSize of one will return just the maximum supported number of
357     // samples for this format.
358 
359     if (bufSize == 0)
360         return;
361 
362     if (params)
363     {
364         // For GL_NUM_SAMPLE_COUNTS, only one value is returned
365         // For GL_SAMPLES, two values will be returned, unless bufSize limits it to one
366         uint32_t paramCount = (pname == GL_SAMPLES && bufSize > 1) ? 2 : 1;
367 
368         paramCapture->readBufferSizeBytes = sizeof(GLint) * paramCount;
369     }
370 }
371 
CaptureGetProgramBinary_length(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei bufSize,GLsizei * length,GLenum * binaryFormat,void * binary,ParamCapture * paramCapture)372 void CaptureGetProgramBinary_length(const State &glState,
373                                     bool isCallValid,
374                                     ShaderProgramID program,
375                                     GLsizei bufSize,
376                                     GLsizei *length,
377                                     GLenum *binaryFormat,
378                                     void *binary,
379                                     ParamCapture *paramCapture)
380 {
381     if (length)
382     {
383         paramCapture->readBufferSizeBytes = sizeof(GLsizei);
384     }
385 }
386 
CaptureGetProgramBinary_binaryFormat(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei bufSize,GLsizei * length,GLenum * binaryFormat,void * binary,ParamCapture * paramCapture)387 void CaptureGetProgramBinary_binaryFormat(const State &glState,
388                                           bool isCallValid,
389                                           ShaderProgramID program,
390                                           GLsizei bufSize,
391                                           GLsizei *length,
392                                           GLenum *binaryFormat,
393                                           void *binary,
394                                           ParamCapture *paramCapture)
395 {
396     paramCapture->readBufferSizeBytes = sizeof(GLenum);
397 }
398 
CaptureGetProgramBinary_binary(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei bufSize,GLsizei * length,GLenum * binaryFormat,void * binary,ParamCapture * paramCapture)399 void CaptureGetProgramBinary_binary(const State &glState,
400                                     bool isCallValid,
401                                     ShaderProgramID program,
402                                     GLsizei bufSize,
403                                     GLsizei *length,
404                                     GLenum *binaryFormat,
405                                     void *binary,
406                                     ParamCapture *paramCapture)
407 {
408     // If we have length, then actual binarySize was written there
409     // Otherwise, we don't know how many bytes were written
410     if (!length)
411     {
412         UNIMPLEMENTED();
413         return;
414     }
415 
416     GLsizei binarySize = *length;
417     if (binarySize > bufSize)
418     {
419         // This is a GL error, but clamp it anyway
420         binarySize = bufSize;
421     }
422 
423     paramCapture->readBufferSizeBytes = binarySize;
424 }
425 
CaptureGetQueryObjectuiv_params(const State & glState,bool isCallValid,QueryID id,GLenum pname,GLuint * params,ParamCapture * paramCapture)426 void CaptureGetQueryObjectuiv_params(const State &glState,
427                                      bool isCallValid,
428                                      QueryID id,
429                                      GLenum pname,
430                                      GLuint *params,
431                                      ParamCapture *paramCapture)
432 {
433     // This only returns one value
434     paramCapture->readBufferSizeBytes = sizeof(GLuint);
435 }
436 
CaptureGetQueryiv_params(const State & glState,bool isCallValid,QueryType targetPacked,GLenum pname,GLint * params,ParamCapture * paramCapture)437 void CaptureGetQueryiv_params(const State &glState,
438                               bool isCallValid,
439                               QueryType targetPacked,
440                               GLenum pname,
441                               GLint *params,
442                               ParamCapture *paramCapture)
443 {
444     // This only returns one value
445     paramCapture->readBufferSizeBytes = sizeof(GLint);
446 }
447 
CaptureGetSamplerParameterfv_params(const State & glState,bool isCallValid,SamplerID sampler,GLenum pname,GLfloat * params,ParamCapture * paramCapture)448 void CaptureGetSamplerParameterfv_params(const State &glState,
449                                          bool isCallValid,
450                                          SamplerID sampler,
451                                          GLenum pname,
452                                          GLfloat *params,
453                                          ParamCapture *paramCapture)
454 {
455     // page 458 https://www.khronos.org/registry/OpenGL/specs/es/3.2/es_spec_3.2.pdf
456     paramCapture->readBufferSizeBytes = 4 * sizeof(GLfloat);
457 }
458 
CaptureGetSamplerParameteriv_params(const State & glState,bool isCallValid,SamplerID sampler,GLenum pname,GLint * params,ParamCapture * paramCapture)459 void CaptureGetSamplerParameteriv_params(const State &glState,
460                                          bool isCallValid,
461                                          SamplerID sampler,
462                                          GLenum pname,
463                                          GLint *params,
464                                          ParamCapture *paramCapture)
465 {
466     // page 458 https://www.khronos.org/registry/OpenGL/specs/es/3.2/es_spec_3.2.pdf
467     paramCapture->readBufferSizeBytes = 4 * sizeof(GLint);
468 }
469 
CaptureGetSynciv_length(const State & glState,bool isCallValid,GLsync sync,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * values,ParamCapture * paramCapture)470 void CaptureGetSynciv_length(const State &glState,
471                              bool isCallValid,
472                              GLsync sync,
473                              GLenum pname,
474                              GLsizei bufSize,
475                              GLsizei *length,
476                              GLint *values,
477                              ParamCapture *paramCapture)
478 {
479     if (length)
480     {
481         paramCapture->readBufferSizeBytes = sizeof(GLsizei);
482     }
483 }
484 
CaptureGetSynciv_values(const State & glState,bool isCallValid,GLsync sync,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * values,ParamCapture * paramCapture)485 void CaptureGetSynciv_values(const State &glState,
486                              bool isCallValid,
487                              GLsync sync,
488                              GLenum pname,
489                              GLsizei bufSize,
490                              GLsizei *length,
491                              GLint *values,
492                              ParamCapture *paramCapture)
493 {
494     // Spec: On success, GetSynciv replaces up to bufSize integers in values with the corresponding
495     // property values of the object being queried. The actual number of integers replaced is
496     // returned in *length.If length is NULL, no length is returned.
497     if (bufSize == 0)
498         return;
499 
500     if (values)
501     {
502         paramCapture->readBufferSizeBytes = sizeof(GLint) * bufSize;
503     }
504 }
505 
CaptureGetTransformFeedbackVarying_length(const State & glState,bool isCallValid,ShaderProgramID program,GLuint index,GLsizei bufSize,GLsizei * length,GLsizei * size,GLenum * type,GLchar * name,ParamCapture * paramCapture)506 void CaptureGetTransformFeedbackVarying_length(const State &glState,
507                                                bool isCallValid,
508                                                ShaderProgramID program,
509                                                GLuint index,
510                                                GLsizei bufSize,
511                                                GLsizei *length,
512                                                GLsizei *size,
513                                                GLenum *type,
514                                                GLchar *name,
515                                                ParamCapture *paramCapture)
516 {
517     UNIMPLEMENTED();
518 }
519 
CaptureGetTransformFeedbackVarying_size(const State & glState,bool isCallValid,ShaderProgramID program,GLuint index,GLsizei bufSize,GLsizei * length,GLsizei * size,GLenum * type,GLchar * name,ParamCapture * paramCapture)520 void CaptureGetTransformFeedbackVarying_size(const State &glState,
521                                              bool isCallValid,
522                                              ShaderProgramID program,
523                                              GLuint index,
524                                              GLsizei bufSize,
525                                              GLsizei *length,
526                                              GLsizei *size,
527                                              GLenum *type,
528                                              GLchar *name,
529                                              ParamCapture *paramCapture)
530 {
531     UNIMPLEMENTED();
532 }
533 
CaptureGetTransformFeedbackVarying_type(const State & glState,bool isCallValid,ShaderProgramID program,GLuint index,GLsizei bufSize,GLsizei * length,GLsizei * size,GLenum * type,GLchar * name,ParamCapture * paramCapture)534 void CaptureGetTransformFeedbackVarying_type(const State &glState,
535                                              bool isCallValid,
536                                              ShaderProgramID program,
537                                              GLuint index,
538                                              GLsizei bufSize,
539                                              GLsizei *length,
540                                              GLsizei *size,
541                                              GLenum *type,
542                                              GLchar *name,
543                                              ParamCapture *paramCapture)
544 {
545     UNIMPLEMENTED();
546 }
547 
CaptureGetTransformFeedbackVarying_name(const State & glState,bool isCallValid,ShaderProgramID program,GLuint index,GLsizei bufSize,GLsizei * length,GLsizei * size,GLenum * type,GLchar * name,ParamCapture * paramCapture)548 void CaptureGetTransformFeedbackVarying_name(const State &glState,
549                                              bool isCallValid,
550                                              ShaderProgramID program,
551                                              GLuint index,
552                                              GLsizei bufSize,
553                                              GLsizei *length,
554                                              GLsizei *size,
555                                              GLenum *type,
556                                              GLchar *name,
557                                              ParamCapture *paramCapture)
558 {
559     UNIMPLEMENTED();
560 }
561 
CaptureGetUniformBlockIndex_uniformBlockName(const State & glState,bool isCallValid,ShaderProgramID program,const GLchar * uniformBlockName,ParamCapture * paramCapture)562 void CaptureGetUniformBlockIndex_uniformBlockName(const State &glState,
563                                                   bool isCallValid,
564                                                   ShaderProgramID program,
565                                                   const GLchar *uniformBlockName,
566                                                   ParamCapture *paramCapture)
567 {
568     CaptureString(uniformBlockName, paramCapture);
569 }
570 
CaptureGetUniformIndices_uniformNames(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei uniformCount,const GLchar * const * uniformNames,GLuint * uniformIndices,ParamCapture * paramCapture)571 void CaptureGetUniformIndices_uniformNames(const State &glState,
572                                            bool isCallValid,
573                                            ShaderProgramID program,
574                                            GLsizei uniformCount,
575                                            const GLchar *const *uniformNames,
576                                            GLuint *uniformIndices,
577                                            ParamCapture *paramCapture)
578 {
579     for (GLsizei index = 0; index < uniformCount; ++index)
580     {
581         CaptureString(uniformNames[index], paramCapture);
582     }
583 }
584 
CaptureGetUniformIndices_uniformIndices(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei uniformCount,const GLchar * const * uniformNames,GLuint * uniformIndices,ParamCapture * paramCapture)585 void CaptureGetUniformIndices_uniformIndices(const State &glState,
586                                              bool isCallValid,
587                                              ShaderProgramID program,
588                                              GLsizei uniformCount,
589                                              const GLchar *const *uniformNames,
590                                              GLuint *uniformIndices,
591                                              ParamCapture *paramCapture)
592 {
593     CaptureMemory(uniformIndices, sizeof(GLuint) * uniformCount, paramCapture);
594 }
595 
CaptureGetUniformuiv_params(const State & glState,bool isCallValid,ShaderProgramID program,UniformLocation location,GLuint * params,ParamCapture * paramCapture)596 void CaptureGetUniformuiv_params(const State &glState,
597                                  bool isCallValid,
598                                  ShaderProgramID program,
599                                  UniformLocation location,
600                                  GLuint *params,
601                                  ParamCapture *paramCapture)
602 {
603     UNIMPLEMENTED();
604 }
605 
CaptureGetVertexAttribIiv_params(const State & glState,bool isCallValid,GLuint index,GLenum pname,GLint * params,ParamCapture * paramCapture)606 void CaptureGetVertexAttribIiv_params(const State &glState,
607                                       bool isCallValid,
608                                       GLuint index,
609                                       GLenum pname,
610                                       GLint *params,
611                                       ParamCapture *paramCapture)
612 {
613     UNIMPLEMENTED();
614 }
615 
CaptureGetVertexAttribIuiv_params(const State & glState,bool isCallValid,GLuint index,GLenum pname,GLuint * params,ParamCapture * paramCapture)616 void CaptureGetVertexAttribIuiv_params(const State &glState,
617                                        bool isCallValid,
618                                        GLuint index,
619                                        GLenum pname,
620                                        GLuint *params,
621                                        ParamCapture *paramCapture)
622 {
623     UNIMPLEMENTED();
624 }
625 
CaptureInvalidateFramebuffer_attachments(const State & glState,bool isCallValid,GLenum target,GLsizei numAttachments,const GLenum * attachments,ParamCapture * paramCapture)626 void CaptureInvalidateFramebuffer_attachments(const State &glState,
627                                               bool isCallValid,
628                                               GLenum target,
629                                               GLsizei numAttachments,
630                                               const GLenum *attachments,
631                                               ParamCapture *paramCapture)
632 {
633     CaptureMemory(attachments, sizeof(GLenum) * numAttachments, paramCapture);
634     paramCapture->value.voidConstPointerVal = paramCapture->data[0].data();
635 }
636 
CaptureInvalidateSubFramebuffer_attachments(const State & glState,bool isCallValid,GLenum target,GLsizei numAttachments,const GLenum * attachments,GLint x,GLint y,GLsizei width,GLsizei height,ParamCapture * paramCapture)637 void CaptureInvalidateSubFramebuffer_attachments(const State &glState,
638                                                  bool isCallValid,
639                                                  GLenum target,
640                                                  GLsizei numAttachments,
641                                                  const GLenum *attachments,
642                                                  GLint x,
643                                                  GLint y,
644                                                  GLsizei width,
645                                                  GLsizei height,
646                                                  ParamCapture *paramCapture)
647 {
648     UNIMPLEMENTED();
649 }
650 
CaptureProgramBinary_binary(const State & glState,bool isCallValid,ShaderProgramID program,GLenum binaryFormat,const void * binary,GLsizei length,ParamCapture * paramCapture)651 void CaptureProgramBinary_binary(const State &glState,
652                                  bool isCallValid,
653                                  ShaderProgramID program,
654                                  GLenum binaryFormat,
655                                  const void *binary,
656                                  GLsizei length,
657                                  ParamCapture *paramCapture)
658 {
659     UNIMPLEMENTED();
660 }
661 
CaptureSamplerParameterfv_param(const State & glState,bool isCallValid,SamplerID sampler,GLenum pname,const GLfloat * param,ParamCapture * paramCapture)662 void CaptureSamplerParameterfv_param(const State &glState,
663                                      bool isCallValid,
664                                      SamplerID sampler,
665                                      GLenum pname,
666                                      const GLfloat *param,
667                                      ParamCapture *paramCapture)
668 {
669     CaptureTextureAndSamplerParameter_params<GLfloat>(pname, param, paramCapture);
670 }
671 
CaptureSamplerParameteriv_param(const State & glState,bool isCallValid,SamplerID sampler,GLenum pname,const GLint * param,ParamCapture * paramCapture)672 void CaptureSamplerParameteriv_param(const State &glState,
673                                      bool isCallValid,
674                                      SamplerID sampler,
675                                      GLenum pname,
676                                      const GLint *param,
677                                      ParamCapture *paramCapture)
678 {
679     CaptureTextureAndSamplerParameter_params<GLint>(pname, param, paramCapture);
680 }
681 
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)682 void CaptureTexImage3D_pixels(const State &glState,
683                               bool isCallValid,
684                               TextureTarget targetPacked,
685                               GLint level,
686                               GLint internalformat,
687                               GLsizei width,
688                               GLsizei height,
689                               GLsizei depth,
690                               GLint border,
691                               GLenum format,
692                               GLenum type,
693                               const void *pixels,
694                               ParamCapture *paramCapture)
695 {
696     if (glState.getTargetBuffer(gl::BufferBinding::PixelUnpack))
697     {
698         return;
699     }
700 
701     if (!pixels)
702     {
703         return;
704     }
705 
706     const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(format, type);
707     const gl::PixelUnpackState &unpack           = glState.getUnpackState();
708 
709     const Extents size(width, height, depth);
710 
711     GLuint endByte = 0;
712     bool unpackSize =
713         internalFormatInfo.computePackUnpackEndByte(type, size, unpack, true, &endByte);
714     ASSERT(unpackSize);
715 
716     CaptureMemory(pixels, static_cast<size_t>(endByte), paramCapture);
717 }
718 
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)719 void CaptureTexSubImage3D_pixels(const State &glState,
720                                  bool isCallValid,
721                                  TextureTarget targetPacked,
722                                  GLint level,
723                                  GLint xoffset,
724                                  GLint yoffset,
725                                  GLint zoffset,
726                                  GLsizei width,
727                                  GLsizei height,
728                                  GLsizei depth,
729                                  GLenum format,
730                                  GLenum type,
731                                  const void *pixels,
732                                  ParamCapture *paramCapture)
733 {
734     CaptureTexImage3D_pixels(glState, isCallValid, targetPacked, level, 0, width, height, depth, 0,
735                              format, type, pixels, paramCapture);
736 }
737 
CaptureTransformFeedbackVaryings_varyings(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei count,const GLchar * const * varyings,GLenum bufferMode,ParamCapture * paramCapture)738 void CaptureTransformFeedbackVaryings_varyings(const State &glState,
739                                                bool isCallValid,
740                                                ShaderProgramID program,
741                                                GLsizei count,
742                                                const GLchar *const *varyings,
743                                                GLenum bufferMode,
744                                                ParamCapture *paramCapture)
745 {
746     for (GLsizei index = 0; index < count; ++index)
747     {
748         CaptureString(varyings[index], paramCapture);
749     }
750 }
751 
CaptureUniform1uiv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,const GLuint * value,ParamCapture * paramCapture)752 void CaptureUniform1uiv_value(const State &glState,
753                               bool isCallValid,
754                               UniformLocation location,
755                               GLsizei count,
756                               const GLuint *value,
757                               ParamCapture *paramCapture)
758 {
759     CaptureMemory(value, count * sizeof(GLuint), paramCapture);
760 }
761 
CaptureUniform2uiv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,const GLuint * value,ParamCapture * paramCapture)762 void CaptureUniform2uiv_value(const State &glState,
763                               bool isCallValid,
764                               UniformLocation location,
765                               GLsizei count,
766                               const GLuint *value,
767                               ParamCapture *paramCapture)
768 {
769     CaptureMemory(value, count * sizeof(GLuint) * 2, paramCapture);
770 }
771 
CaptureUniform3uiv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,const GLuint * value,ParamCapture * paramCapture)772 void CaptureUniform3uiv_value(const State &glState,
773                               bool isCallValid,
774                               UniformLocation location,
775                               GLsizei count,
776                               const GLuint *value,
777                               ParamCapture *paramCapture)
778 {
779     CaptureMemory(value, count * sizeof(GLuint) * 3, paramCapture);
780 }
781 
CaptureUniform4uiv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,const GLuint * value,ParamCapture * paramCapture)782 void CaptureUniform4uiv_value(const State &glState,
783                               bool isCallValid,
784                               UniformLocation location,
785                               GLsizei count,
786                               const GLuint *value,
787                               ParamCapture *paramCapture)
788 {
789     CaptureMemory(value, count * sizeof(GLuint) * 4, paramCapture);
790 }
791 
CaptureUniformMatrix2x3fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)792 void CaptureUniformMatrix2x3fv_value(const State &glState,
793                                      bool isCallValid,
794                                      UniformLocation location,
795                                      GLsizei count,
796                                      GLboolean transpose,
797                                      const GLfloat *value,
798                                      ParamCapture *paramCapture)
799 {
800     CaptureMemory(value, count * sizeof(GLfloat) * 6, paramCapture);
801 }
802 
CaptureUniformMatrix2x4fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)803 void CaptureUniformMatrix2x4fv_value(const State &glState,
804                                      bool isCallValid,
805                                      UniformLocation location,
806                                      GLsizei count,
807                                      GLboolean transpose,
808                                      const GLfloat *value,
809                                      ParamCapture *paramCapture)
810 {
811     CaptureMemory(value, count * sizeof(GLfloat) * 8, paramCapture);
812 }
813 
CaptureUniformMatrix3x2fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)814 void CaptureUniformMatrix3x2fv_value(const State &glState,
815                                      bool isCallValid,
816                                      UniformLocation location,
817                                      GLsizei count,
818                                      GLboolean transpose,
819                                      const GLfloat *value,
820                                      ParamCapture *paramCapture)
821 {
822     CaptureMemory(value, count * sizeof(GLfloat) * 6, paramCapture);
823 }
824 
CaptureUniformMatrix3x4fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)825 void CaptureUniformMatrix3x4fv_value(const State &glState,
826                                      bool isCallValid,
827                                      UniformLocation location,
828                                      GLsizei count,
829                                      GLboolean transpose,
830                                      const GLfloat *value,
831                                      ParamCapture *paramCapture)
832 {
833     CaptureMemory(value, count * sizeof(GLfloat) * 12, paramCapture);
834 }
835 
CaptureUniformMatrix4x2fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)836 void CaptureUniformMatrix4x2fv_value(const State &glState,
837                                      bool isCallValid,
838                                      UniformLocation location,
839                                      GLsizei count,
840                                      GLboolean transpose,
841                                      const GLfloat *value,
842                                      ParamCapture *paramCapture)
843 {
844     CaptureMemory(value, count * sizeof(GLfloat) * 8, paramCapture);
845 }
846 
CaptureUniformMatrix4x3fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)847 void CaptureUniformMatrix4x3fv_value(const State &glState,
848                                      bool isCallValid,
849                                      UniformLocation location,
850                                      GLsizei count,
851                                      GLboolean transpose,
852                                      const GLfloat *value,
853                                      ParamCapture *paramCapture)
854 {
855     CaptureMemory(value, count * sizeof(GLfloat) * 12, paramCapture);
856 }
857 
CaptureVertexAttribI4iv_v(const State & glState,bool isCallValid,GLuint index,const GLint * v,ParamCapture * paramCapture)858 void CaptureVertexAttribI4iv_v(const State &glState,
859                                bool isCallValid,
860                                GLuint index,
861                                const GLint *v,
862                                ParamCapture *paramCapture)
863 {
864     UNIMPLEMENTED();
865 }
866 
CaptureVertexAttribI4uiv_v(const State & glState,bool isCallValid,GLuint index,const GLuint * v,ParamCapture * paramCapture)867 void CaptureVertexAttribI4uiv_v(const State &glState,
868                                 bool isCallValid,
869                                 GLuint index,
870                                 const GLuint *v,
871                                 ParamCapture *paramCapture)
872 {
873     UNIMPLEMENTED();
874 }
875 
CaptureVertexAttribIPointer_pointer(const State & glState,bool isCallValid,GLuint index,GLint size,VertexAttribType typePacked,GLsizei stride,const void * pointer,ParamCapture * paramCapture)876 void CaptureVertexAttribIPointer_pointer(const State &glState,
877                                          bool isCallValid,
878                                          GLuint index,
879                                          GLint size,
880                                          VertexAttribType typePacked,
881                                          GLsizei stride,
882                                          const void *pointer,
883                                          ParamCapture *paramCapture)
884 {
885     CaptureVertexAttribPointer_pointer(glState, isCallValid, index, size, typePacked, false, stride,
886                                        pointer, paramCapture);
887 }
888 
889 }  // namespace gl
890