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 CaptureString(name, paramCapture);
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 /* At most a mat4 can be returned, so use this upper bound as count */
604 CaptureArray(params, 16 * sizeof(GLuint), paramCapture);
605 }
606
CaptureGetVertexAttribIiv_params(const State & glState,bool isCallValid,GLuint index,GLenum pname,GLint * params,ParamCapture * paramCapture)607 void CaptureGetVertexAttribIiv_params(const State &glState,
608 bool isCallValid,
609 GLuint index,
610 GLenum pname,
611 GLint *params,
612 ParamCapture *paramCapture)
613 {
614 UNIMPLEMENTED();
615 }
616
CaptureGetVertexAttribIuiv_params(const State & glState,bool isCallValid,GLuint index,GLenum pname,GLuint * params,ParamCapture * paramCapture)617 void CaptureGetVertexAttribIuiv_params(const State &glState,
618 bool isCallValid,
619 GLuint index,
620 GLenum pname,
621 GLuint *params,
622 ParamCapture *paramCapture)
623 {
624 UNIMPLEMENTED();
625 }
626
CaptureInvalidateFramebuffer_attachments(const State & glState,bool isCallValid,GLenum target,GLsizei numAttachments,const GLenum * attachments,ParamCapture * paramCapture)627 void CaptureInvalidateFramebuffer_attachments(const State &glState,
628 bool isCallValid,
629 GLenum target,
630 GLsizei numAttachments,
631 const GLenum *attachments,
632 ParamCapture *paramCapture)
633 {
634 CaptureMemory(attachments, sizeof(GLenum) * numAttachments, paramCapture);
635 paramCapture->value.voidConstPointerVal = paramCapture->data[0].data();
636 }
637
CaptureInvalidateSubFramebuffer_attachments(const State & glState,bool isCallValid,GLenum target,GLsizei numAttachments,const GLenum * attachments,GLint x,GLint y,GLsizei width,GLsizei height,ParamCapture * paramCapture)638 void CaptureInvalidateSubFramebuffer_attachments(const State &glState,
639 bool isCallValid,
640 GLenum target,
641 GLsizei numAttachments,
642 const GLenum *attachments,
643 GLint x,
644 GLint y,
645 GLsizei width,
646 GLsizei height,
647 ParamCapture *paramCapture)
648 {
649 CaptureMemory(attachments, sizeof(GLenum) * numAttachments, paramCapture);
650 }
651
CaptureProgramBinary_binary(const State & glState,bool isCallValid,ShaderProgramID program,GLenum binaryFormat,const void * binary,GLsizei length,ParamCapture * paramCapture)652 void CaptureProgramBinary_binary(const State &glState,
653 bool isCallValid,
654 ShaderProgramID program,
655 GLenum binaryFormat,
656 const void *binary,
657 GLsizei length,
658 ParamCapture *paramCapture)
659 {
660 // Do nothing. glProgramBinary will be overridden in GenerateLinkedProgram.
661 }
662
CaptureSamplerParameterfv_param(const State & glState,bool isCallValid,SamplerID sampler,GLenum pname,const GLfloat * param,ParamCapture * paramCapture)663 void CaptureSamplerParameterfv_param(const State &glState,
664 bool isCallValid,
665 SamplerID sampler,
666 GLenum pname,
667 const GLfloat *param,
668 ParamCapture *paramCapture)
669 {
670 CaptureTextureAndSamplerParameter_params<GLfloat>(pname, param, paramCapture);
671 }
672
CaptureSamplerParameteriv_param(const State & glState,bool isCallValid,SamplerID sampler,GLenum pname,const GLint * param,ParamCapture * paramCapture)673 void CaptureSamplerParameteriv_param(const State &glState,
674 bool isCallValid,
675 SamplerID sampler,
676 GLenum pname,
677 const GLint *param,
678 ParamCapture *paramCapture)
679 {
680 CaptureTextureAndSamplerParameter_params<GLint>(pname, param, paramCapture);
681 }
682
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)683 void CaptureTexImage3D_pixels(const State &glState,
684 bool isCallValid,
685 TextureTarget targetPacked,
686 GLint level,
687 GLint internalformat,
688 GLsizei width,
689 GLsizei height,
690 GLsizei depth,
691 GLint border,
692 GLenum format,
693 GLenum type,
694 const void *pixels,
695 ParamCapture *paramCapture)
696 {
697 if (glState.getTargetBuffer(gl::BufferBinding::PixelUnpack))
698 {
699 return;
700 }
701
702 if (!pixels)
703 {
704 return;
705 }
706
707 const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(format, type);
708 const gl::PixelUnpackState &unpack = glState.getUnpackState();
709
710 const Extents size(width, height, depth);
711
712 GLuint endByte = 0;
713 bool unpackSize =
714 internalFormatInfo.computePackUnpackEndByte(type, size, unpack, true, &endByte);
715 ASSERT(unpackSize);
716
717 CaptureMemory(pixels, static_cast<size_t>(endByte), paramCapture);
718 }
719
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)720 void CaptureTexSubImage3D_pixels(const State &glState,
721 bool isCallValid,
722 TextureTarget targetPacked,
723 GLint level,
724 GLint xoffset,
725 GLint yoffset,
726 GLint zoffset,
727 GLsizei width,
728 GLsizei height,
729 GLsizei depth,
730 GLenum format,
731 GLenum type,
732 const void *pixels,
733 ParamCapture *paramCapture)
734 {
735 CaptureTexImage3D_pixels(glState, isCallValid, targetPacked, level, 0, width, height, depth, 0,
736 format, type, pixels, paramCapture);
737 }
738
CaptureTransformFeedbackVaryings_varyings(const State & glState,bool isCallValid,ShaderProgramID program,GLsizei count,const GLchar * const * varyings,GLenum bufferMode,ParamCapture * paramCapture)739 void CaptureTransformFeedbackVaryings_varyings(const State &glState,
740 bool isCallValid,
741 ShaderProgramID program,
742 GLsizei count,
743 const GLchar *const *varyings,
744 GLenum bufferMode,
745 ParamCapture *paramCapture)
746 {
747 for (GLsizei index = 0; index < count; ++index)
748 {
749 CaptureString(varyings[index], paramCapture);
750 }
751 }
752
CaptureUniform1uiv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,const GLuint * value,ParamCapture * paramCapture)753 void CaptureUniform1uiv_value(const State &glState,
754 bool isCallValid,
755 UniformLocation location,
756 GLsizei count,
757 const GLuint *value,
758 ParamCapture *paramCapture)
759 {
760 CaptureMemory(value, count * sizeof(GLuint), paramCapture);
761 }
762
CaptureUniform2uiv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,const GLuint * value,ParamCapture * paramCapture)763 void CaptureUniform2uiv_value(const State &glState,
764 bool isCallValid,
765 UniformLocation location,
766 GLsizei count,
767 const GLuint *value,
768 ParamCapture *paramCapture)
769 {
770 CaptureMemory(value, count * sizeof(GLuint) * 2, paramCapture);
771 }
772
CaptureUniform3uiv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,const GLuint * value,ParamCapture * paramCapture)773 void CaptureUniform3uiv_value(const State &glState,
774 bool isCallValid,
775 UniformLocation location,
776 GLsizei count,
777 const GLuint *value,
778 ParamCapture *paramCapture)
779 {
780 CaptureMemory(value, count * sizeof(GLuint) * 3, paramCapture);
781 }
782
CaptureUniform4uiv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,const GLuint * value,ParamCapture * paramCapture)783 void CaptureUniform4uiv_value(const State &glState,
784 bool isCallValid,
785 UniformLocation location,
786 GLsizei count,
787 const GLuint *value,
788 ParamCapture *paramCapture)
789 {
790 CaptureMemory(value, count * sizeof(GLuint) * 4, paramCapture);
791 }
792
CaptureUniformMatrix2x3fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)793 void CaptureUniformMatrix2x3fv_value(const State &glState,
794 bool isCallValid,
795 UniformLocation location,
796 GLsizei count,
797 GLboolean transpose,
798 const GLfloat *value,
799 ParamCapture *paramCapture)
800 {
801 CaptureMemory(value, count * sizeof(GLfloat) * 6, paramCapture);
802 }
803
CaptureUniformMatrix2x4fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)804 void CaptureUniformMatrix2x4fv_value(const State &glState,
805 bool isCallValid,
806 UniformLocation location,
807 GLsizei count,
808 GLboolean transpose,
809 const GLfloat *value,
810 ParamCapture *paramCapture)
811 {
812 CaptureMemory(value, count * sizeof(GLfloat) * 8, paramCapture);
813 }
814
CaptureUniformMatrix3x2fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)815 void CaptureUniformMatrix3x2fv_value(const State &glState,
816 bool isCallValid,
817 UniformLocation location,
818 GLsizei count,
819 GLboolean transpose,
820 const GLfloat *value,
821 ParamCapture *paramCapture)
822 {
823 CaptureMemory(value, count * sizeof(GLfloat) * 6, paramCapture);
824 }
825
CaptureUniformMatrix3x4fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)826 void CaptureUniformMatrix3x4fv_value(const State &glState,
827 bool isCallValid,
828 UniformLocation location,
829 GLsizei count,
830 GLboolean transpose,
831 const GLfloat *value,
832 ParamCapture *paramCapture)
833 {
834 CaptureMemory(value, count * sizeof(GLfloat) * 12, paramCapture);
835 }
836
CaptureUniformMatrix4x2fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)837 void CaptureUniformMatrix4x2fv_value(const State &glState,
838 bool isCallValid,
839 UniformLocation location,
840 GLsizei count,
841 GLboolean transpose,
842 const GLfloat *value,
843 ParamCapture *paramCapture)
844 {
845 CaptureMemory(value, count * sizeof(GLfloat) * 8, paramCapture);
846 }
847
CaptureUniformMatrix4x3fv_value(const State & glState,bool isCallValid,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value,ParamCapture * paramCapture)848 void CaptureUniformMatrix4x3fv_value(const State &glState,
849 bool isCallValid,
850 UniformLocation location,
851 GLsizei count,
852 GLboolean transpose,
853 const GLfloat *value,
854 ParamCapture *paramCapture)
855 {
856 CaptureMemory(value, count * sizeof(GLfloat) * 12, paramCapture);
857 }
858
CaptureVertexAttribI4iv_v(const State & glState,bool isCallValid,GLuint index,const GLint * v,ParamCapture * paramCapture)859 void CaptureVertexAttribI4iv_v(const State &glState,
860 bool isCallValid,
861 GLuint index,
862 const GLint *v,
863 ParamCapture *paramCapture)
864 {
865 UNIMPLEMENTED();
866 }
867
CaptureVertexAttribI4uiv_v(const State & glState,bool isCallValid,GLuint index,const GLuint * v,ParamCapture * paramCapture)868 void CaptureVertexAttribI4uiv_v(const State &glState,
869 bool isCallValid,
870 GLuint index,
871 const GLuint *v,
872 ParamCapture *paramCapture)
873 {
874 UNIMPLEMENTED();
875 }
876
CaptureVertexAttribIPointer_pointer(const State & glState,bool isCallValid,GLuint index,GLint size,VertexAttribType typePacked,GLsizei stride,const void * pointer,ParamCapture * paramCapture)877 void CaptureVertexAttribIPointer_pointer(const State &glState,
878 bool isCallValid,
879 GLuint index,
880 GLint size,
881 VertexAttribType typePacked,
882 GLsizei stride,
883 const void *pointer,
884 ParamCapture *paramCapture)
885 {
886 CaptureVertexAttribPointer_pointer(glState, isCallValid, index, size, typePacked, false, stride,
887 pointer, paramCapture);
888 }
889
890 } // namespace gl
891