1/* DO NOT EDIT - This file generated automatically by gl_marshal.py script */
2
3/*
4 * Copyright (C) 2012 Intel Corporation
5 * All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sub license,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the next
15 * paragraph) shall be included in all copies or substantial portions of the
16 * Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
21 * INTEL CORPORATION,
22 * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 */
27
28
29#include "api_exec.h"
30#include "glthread_marshal.h"
31#include "bufferobj.h"
32#include "dispatch.h"
33
34#define COMPAT (ctx->API != API_OPENGL_CORE)
35
36UNUSED static inline int safe_mul(int a, int b)
37{
38    if (a < 0 || b < 0) return -1;
39    if (a == 0 || b == 0) return 0;
40    if (a > INT_MAX / b) return -1;
41    return a * b;
42}
43
44/* ProgramUniform3i: marshalled asynchronously */
45struct marshal_cmd_ProgramUniform3i
46{
47   struct marshal_cmd_base cmd_base;
48   GLuint program;
49   GLint location;
50   GLint x;
51   GLint y;
52   GLint z;
53};
54uint32_t
55_mesa_unmarshal_ProgramUniform3i(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform3i *cmd, const uint64_t *last)
56{
57   GLuint program = cmd->program;
58   GLint location = cmd->location;
59   GLint x = cmd->x;
60   GLint y = cmd->y;
61   GLint z = cmd->z;
62   CALL_ProgramUniform3i(ctx->CurrentServerDispatch, (program, location, x, y, z));
63   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ProgramUniform3i), 8) / 8);
64   assert (cmd_size == cmd->cmd_base.cmd_size);
65   return cmd_size;
66}
67void GLAPIENTRY
68_mesa_marshal_ProgramUniform3i(GLuint program, GLint location, GLint x, GLint y, GLint z)
69{
70   GET_CURRENT_CONTEXT(ctx);
71   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform3i);
72   struct marshal_cmd_ProgramUniform3i *cmd;
73   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform3i, cmd_size);
74   cmd->program = program;
75   cmd->location = location;
76   cmd->x = x;
77   cmd->y = y;
78   cmd->z = z;
79}
80
81
82/* ProgramUniform4i: marshalled asynchronously */
83struct marshal_cmd_ProgramUniform4i
84{
85   struct marshal_cmd_base cmd_base;
86   GLuint program;
87   GLint location;
88   GLint x;
89   GLint y;
90   GLint z;
91   GLint w;
92};
93uint32_t
94_mesa_unmarshal_ProgramUniform4i(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform4i *cmd, const uint64_t *last)
95{
96   GLuint program = cmd->program;
97   GLint location = cmd->location;
98   GLint x = cmd->x;
99   GLint y = cmd->y;
100   GLint z = cmd->z;
101   GLint w = cmd->w;
102   CALL_ProgramUniform4i(ctx->CurrentServerDispatch, (program, location, x, y, z, w));
103   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ProgramUniform4i), 8) / 8);
104   assert (cmd_size == cmd->cmd_base.cmd_size);
105   return cmd_size;
106}
107void GLAPIENTRY
108_mesa_marshal_ProgramUniform4i(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w)
109{
110   GET_CURRENT_CONTEXT(ctx);
111   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform4i);
112   struct marshal_cmd_ProgramUniform4i *cmd;
113   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform4i, cmd_size);
114   cmd->program = program;
115   cmd->location = location;
116   cmd->x = x;
117   cmd->y = y;
118   cmd->z = z;
119   cmd->w = w;
120}
121
122
123/* ProgramUniform1ui: marshalled asynchronously */
124struct marshal_cmd_ProgramUniform1ui
125{
126   struct marshal_cmd_base cmd_base;
127   GLuint program;
128   GLint location;
129   GLuint x;
130};
131uint32_t
132_mesa_unmarshal_ProgramUniform1ui(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform1ui *cmd, const uint64_t *last)
133{
134   GLuint program = cmd->program;
135   GLint location = cmd->location;
136   GLuint x = cmd->x;
137   CALL_ProgramUniform1ui(ctx->CurrentServerDispatch, (program, location, x));
138   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ProgramUniform1ui), 8) / 8);
139   assert (cmd_size == cmd->cmd_base.cmd_size);
140   return cmd_size;
141}
142void GLAPIENTRY
143_mesa_marshal_ProgramUniform1ui(GLuint program, GLint location, GLuint x)
144{
145   GET_CURRENT_CONTEXT(ctx);
146   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform1ui);
147   struct marshal_cmd_ProgramUniform1ui *cmd;
148   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform1ui, cmd_size);
149   cmd->program = program;
150   cmd->location = location;
151   cmd->x = x;
152}
153
154
155/* ProgramUniform2ui: marshalled asynchronously */
156struct marshal_cmd_ProgramUniform2ui
157{
158   struct marshal_cmd_base cmd_base;
159   GLuint program;
160   GLint location;
161   GLuint x;
162   GLuint y;
163};
164uint32_t
165_mesa_unmarshal_ProgramUniform2ui(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform2ui *cmd, const uint64_t *last)
166{
167   GLuint program = cmd->program;
168   GLint location = cmd->location;
169   GLuint x = cmd->x;
170   GLuint y = cmd->y;
171   CALL_ProgramUniform2ui(ctx->CurrentServerDispatch, (program, location, x, y));
172   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ProgramUniform2ui), 8) / 8);
173   assert (cmd_size == cmd->cmd_base.cmd_size);
174   return cmd_size;
175}
176void GLAPIENTRY
177_mesa_marshal_ProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
178{
179   GET_CURRENT_CONTEXT(ctx);
180   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform2ui);
181   struct marshal_cmd_ProgramUniform2ui *cmd;
182   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform2ui, cmd_size);
183   cmd->program = program;
184   cmd->location = location;
185   cmd->x = x;
186   cmd->y = y;
187}
188
189
190/* ProgramUniform3ui: marshalled asynchronously */
191struct marshal_cmd_ProgramUniform3ui
192{
193   struct marshal_cmd_base cmd_base;
194   GLuint program;
195   GLint location;
196   GLuint x;
197   GLuint y;
198   GLuint z;
199};
200uint32_t
201_mesa_unmarshal_ProgramUniform3ui(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform3ui *cmd, const uint64_t *last)
202{
203   GLuint program = cmd->program;
204   GLint location = cmd->location;
205   GLuint x = cmd->x;
206   GLuint y = cmd->y;
207   GLuint z = cmd->z;
208   CALL_ProgramUniform3ui(ctx->CurrentServerDispatch, (program, location, x, y, z));
209   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ProgramUniform3ui), 8) / 8);
210   assert (cmd_size == cmd->cmd_base.cmd_size);
211   return cmd_size;
212}
213void GLAPIENTRY
214_mesa_marshal_ProgramUniform3ui(GLuint program, GLint location, GLuint x, GLuint y, GLuint z)
215{
216   GET_CURRENT_CONTEXT(ctx);
217   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform3ui);
218   struct marshal_cmd_ProgramUniform3ui *cmd;
219   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform3ui, cmd_size);
220   cmd->program = program;
221   cmd->location = location;
222   cmd->x = x;
223   cmd->y = y;
224   cmd->z = z;
225}
226
227
228/* ProgramUniform4ui: marshalled asynchronously */
229struct marshal_cmd_ProgramUniform4ui
230{
231   struct marshal_cmd_base cmd_base;
232   GLuint program;
233   GLint location;
234   GLuint x;
235   GLuint y;
236   GLuint z;
237   GLuint w;
238};
239uint32_t
240_mesa_unmarshal_ProgramUniform4ui(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform4ui *cmd, const uint64_t *last)
241{
242   GLuint program = cmd->program;
243   GLint location = cmd->location;
244   GLuint x = cmd->x;
245   GLuint y = cmd->y;
246   GLuint z = cmd->z;
247   GLuint w = cmd->w;
248   CALL_ProgramUniform4ui(ctx->CurrentServerDispatch, (program, location, x, y, z, w));
249   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ProgramUniform4ui), 8) / 8);
250   assert (cmd_size == cmd->cmd_base.cmd_size);
251   return cmd_size;
252}
253void GLAPIENTRY
254_mesa_marshal_ProgramUniform4ui(GLuint program, GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
255{
256   GET_CURRENT_CONTEXT(ctx);
257   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform4ui);
258   struct marshal_cmd_ProgramUniform4ui *cmd;
259   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform4ui, cmd_size);
260   cmd->program = program;
261   cmd->location = location;
262   cmd->x = x;
263   cmd->y = y;
264   cmd->z = z;
265   cmd->w = w;
266}
267
268
269/* ProgramUniform1f: marshalled asynchronously */
270struct marshal_cmd_ProgramUniform1f
271{
272   struct marshal_cmd_base cmd_base;
273   GLuint program;
274   GLint location;
275   GLfloat x;
276};
277uint32_t
278_mesa_unmarshal_ProgramUniform1f(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform1f *cmd, const uint64_t *last)
279{
280   GLuint program = cmd->program;
281   GLint location = cmd->location;
282   GLfloat x = cmd->x;
283   CALL_ProgramUniform1f(ctx->CurrentServerDispatch, (program, location, x));
284   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ProgramUniform1f), 8) / 8);
285   assert (cmd_size == cmd->cmd_base.cmd_size);
286   return cmd_size;
287}
288void GLAPIENTRY
289_mesa_marshal_ProgramUniform1f(GLuint program, GLint location, GLfloat x)
290{
291   GET_CURRENT_CONTEXT(ctx);
292   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform1f);
293   struct marshal_cmd_ProgramUniform1f *cmd;
294   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform1f, cmd_size);
295   cmd->program = program;
296   cmd->location = location;
297   cmd->x = x;
298}
299
300
301/* ProgramUniform2f: marshalled asynchronously */
302struct marshal_cmd_ProgramUniform2f
303{
304   struct marshal_cmd_base cmd_base;
305   GLuint program;
306   GLint location;
307   GLfloat x;
308   GLfloat y;
309};
310uint32_t
311_mesa_unmarshal_ProgramUniform2f(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform2f *cmd, const uint64_t *last)
312{
313   GLuint program = cmd->program;
314   GLint location = cmd->location;
315   GLfloat x = cmd->x;
316   GLfloat y = cmd->y;
317   CALL_ProgramUniform2f(ctx->CurrentServerDispatch, (program, location, x, y));
318   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ProgramUniform2f), 8) / 8);
319   assert (cmd_size == cmd->cmd_base.cmd_size);
320   return cmd_size;
321}
322void GLAPIENTRY
323_mesa_marshal_ProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
324{
325   GET_CURRENT_CONTEXT(ctx);
326   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform2f);
327   struct marshal_cmd_ProgramUniform2f *cmd;
328   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform2f, cmd_size);
329   cmd->program = program;
330   cmd->location = location;
331   cmd->x = x;
332   cmd->y = y;
333}
334
335
336/* ProgramUniform3f: marshalled asynchronously */
337struct marshal_cmd_ProgramUniform3f
338{
339   struct marshal_cmd_base cmd_base;
340   GLuint program;
341   GLint location;
342   GLfloat x;
343   GLfloat y;
344   GLfloat z;
345};
346uint32_t
347_mesa_unmarshal_ProgramUniform3f(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform3f *cmd, const uint64_t *last)
348{
349   GLuint program = cmd->program;
350   GLint location = cmd->location;
351   GLfloat x = cmd->x;
352   GLfloat y = cmd->y;
353   GLfloat z = cmd->z;
354   CALL_ProgramUniform3f(ctx->CurrentServerDispatch, (program, location, x, y, z));
355   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ProgramUniform3f), 8) / 8);
356   assert (cmd_size == cmd->cmd_base.cmd_size);
357   return cmd_size;
358}
359void GLAPIENTRY
360_mesa_marshal_ProgramUniform3f(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z)
361{
362   GET_CURRENT_CONTEXT(ctx);
363   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform3f);
364   struct marshal_cmd_ProgramUniform3f *cmd;
365   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform3f, cmd_size);
366   cmd->program = program;
367   cmd->location = location;
368   cmd->x = x;
369   cmd->y = y;
370   cmd->z = z;
371}
372
373
374/* ProgramUniform4f: marshalled asynchronously */
375struct marshal_cmd_ProgramUniform4f
376{
377   struct marshal_cmd_base cmd_base;
378   GLuint program;
379   GLint location;
380   GLfloat x;
381   GLfloat y;
382   GLfloat z;
383   GLfloat w;
384};
385uint32_t
386_mesa_unmarshal_ProgramUniform4f(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform4f *cmd, const uint64_t *last)
387{
388   GLuint program = cmd->program;
389   GLint location = cmd->location;
390   GLfloat x = cmd->x;
391   GLfloat y = cmd->y;
392   GLfloat z = cmd->z;
393   GLfloat w = cmd->w;
394   CALL_ProgramUniform4f(ctx->CurrentServerDispatch, (program, location, x, y, z, w));
395   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ProgramUniform4f), 8) / 8);
396   assert (cmd_size == cmd->cmd_base.cmd_size);
397   return cmd_size;
398}
399void GLAPIENTRY
400_mesa_marshal_ProgramUniform4f(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
401{
402   GET_CURRENT_CONTEXT(ctx);
403   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform4f);
404   struct marshal_cmd_ProgramUniform4f *cmd;
405   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform4f, cmd_size);
406   cmd->program = program;
407   cmd->location = location;
408   cmd->x = x;
409   cmd->y = y;
410   cmd->z = z;
411   cmd->w = w;
412}
413
414
415/* ProgramUniform1iv: marshalled asynchronously */
416struct marshal_cmd_ProgramUniform1iv
417{
418   struct marshal_cmd_base cmd_base;
419   GLuint program;
420   GLint location;
421   GLsizei count;
422   /* Next safe_mul(count, 1 * sizeof(GLint)) bytes are GLint value[count] */
423};
424uint32_t
425_mesa_unmarshal_ProgramUniform1iv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform1iv *cmd, const uint64_t *last)
426{
427   GLuint program = cmd->program;
428   GLint location = cmd->location;
429   GLsizei count = cmd->count;
430   GLint * value;
431   const char *variable_data = (const char *) (cmd + 1);
432   value = (GLint *) variable_data;
433   CALL_ProgramUniform1iv(ctx->CurrentServerDispatch, (program, location, count, value));
434   return cmd->cmd_base.cmd_size;
435}
436void GLAPIENTRY
437_mesa_marshal_ProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint * value)
438{
439   GET_CURRENT_CONTEXT(ctx);
440   int value_size = safe_mul(count, 1 * sizeof(GLint));
441   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform1iv) + value_size;
442   struct marshal_cmd_ProgramUniform1iv *cmd;
443   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
444      _mesa_glthread_finish_before(ctx, "ProgramUniform1iv");
445      CALL_ProgramUniform1iv(ctx->CurrentServerDispatch, (program, location, count, value));
446      return;
447   }
448   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform1iv, cmd_size);
449   cmd->program = program;
450   cmd->location = location;
451   cmd->count = count;
452   char *variable_data = (char *) (cmd + 1);
453   memcpy(variable_data, value, value_size);
454}
455
456
457/* ProgramUniform2iv: marshalled asynchronously */
458struct marshal_cmd_ProgramUniform2iv
459{
460   struct marshal_cmd_base cmd_base;
461   GLuint program;
462   GLint location;
463   GLsizei count;
464   /* Next safe_mul(count, 2 * sizeof(GLint)) bytes are GLint value[count][2] */
465};
466uint32_t
467_mesa_unmarshal_ProgramUniform2iv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform2iv *cmd, const uint64_t *last)
468{
469   GLuint program = cmd->program;
470   GLint location = cmd->location;
471   GLsizei count = cmd->count;
472   GLint * value;
473   const char *variable_data = (const char *) (cmd + 1);
474   value = (GLint *) variable_data;
475   CALL_ProgramUniform2iv(ctx->CurrentServerDispatch, (program, location, count, value));
476   return cmd->cmd_base.cmd_size;
477}
478void GLAPIENTRY
479_mesa_marshal_ProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint * value)
480{
481   GET_CURRENT_CONTEXT(ctx);
482   int value_size = safe_mul(count, 2 * sizeof(GLint));
483   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform2iv) + value_size;
484   struct marshal_cmd_ProgramUniform2iv *cmd;
485   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
486      _mesa_glthread_finish_before(ctx, "ProgramUniform2iv");
487      CALL_ProgramUniform2iv(ctx->CurrentServerDispatch, (program, location, count, value));
488      return;
489   }
490   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform2iv, cmd_size);
491   cmd->program = program;
492   cmd->location = location;
493   cmd->count = count;
494   char *variable_data = (char *) (cmd + 1);
495   memcpy(variable_data, value, value_size);
496}
497
498
499/* ProgramUniform3iv: marshalled asynchronously */
500struct marshal_cmd_ProgramUniform3iv
501{
502   struct marshal_cmd_base cmd_base;
503   GLuint program;
504   GLint location;
505   GLsizei count;
506   /* Next safe_mul(count, 3 * sizeof(GLint)) bytes are GLint value[count][3] */
507};
508uint32_t
509_mesa_unmarshal_ProgramUniform3iv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform3iv *cmd, const uint64_t *last)
510{
511   GLuint program = cmd->program;
512   GLint location = cmd->location;
513   GLsizei count = cmd->count;
514   GLint * value;
515   const char *variable_data = (const char *) (cmd + 1);
516   value = (GLint *) variable_data;
517   CALL_ProgramUniform3iv(ctx->CurrentServerDispatch, (program, location, count, value));
518   return cmd->cmd_base.cmd_size;
519}
520void GLAPIENTRY
521_mesa_marshal_ProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint * value)
522{
523   GET_CURRENT_CONTEXT(ctx);
524   int value_size = safe_mul(count, 3 * sizeof(GLint));
525   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform3iv) + value_size;
526   struct marshal_cmd_ProgramUniform3iv *cmd;
527   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
528      _mesa_glthread_finish_before(ctx, "ProgramUniform3iv");
529      CALL_ProgramUniform3iv(ctx->CurrentServerDispatch, (program, location, count, value));
530      return;
531   }
532   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform3iv, cmd_size);
533   cmd->program = program;
534   cmd->location = location;
535   cmd->count = count;
536   char *variable_data = (char *) (cmd + 1);
537   memcpy(variable_data, value, value_size);
538}
539
540
541/* ProgramUniform4iv: marshalled asynchronously */
542struct marshal_cmd_ProgramUniform4iv
543{
544   struct marshal_cmd_base cmd_base;
545   GLuint program;
546   GLint location;
547   GLsizei count;
548   /* Next safe_mul(count, 4 * sizeof(GLint)) bytes are GLint value[count][4] */
549};
550uint32_t
551_mesa_unmarshal_ProgramUniform4iv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform4iv *cmd, const uint64_t *last)
552{
553   GLuint program = cmd->program;
554   GLint location = cmd->location;
555   GLsizei count = cmd->count;
556   GLint * value;
557   const char *variable_data = (const char *) (cmd + 1);
558   value = (GLint *) variable_data;
559   CALL_ProgramUniform4iv(ctx->CurrentServerDispatch, (program, location, count, value));
560   return cmd->cmd_base.cmd_size;
561}
562void GLAPIENTRY
563_mesa_marshal_ProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint * value)
564{
565   GET_CURRENT_CONTEXT(ctx);
566   int value_size = safe_mul(count, 4 * sizeof(GLint));
567   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform4iv) + value_size;
568   struct marshal_cmd_ProgramUniform4iv *cmd;
569   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
570      _mesa_glthread_finish_before(ctx, "ProgramUniform4iv");
571      CALL_ProgramUniform4iv(ctx->CurrentServerDispatch, (program, location, count, value));
572      return;
573   }
574   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform4iv, cmd_size);
575   cmd->program = program;
576   cmd->location = location;
577   cmd->count = count;
578   char *variable_data = (char *) (cmd + 1);
579   memcpy(variable_data, value, value_size);
580}
581
582
583/* ProgramUniform1uiv: marshalled asynchronously */
584struct marshal_cmd_ProgramUniform1uiv
585{
586   struct marshal_cmd_base cmd_base;
587   GLuint program;
588   GLint location;
589   GLsizei count;
590   /* Next safe_mul(count, 1 * sizeof(GLuint)) bytes are GLuint value[count] */
591};
592uint32_t
593_mesa_unmarshal_ProgramUniform1uiv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform1uiv *cmd, const uint64_t *last)
594{
595   GLuint program = cmd->program;
596   GLint location = cmd->location;
597   GLsizei count = cmd->count;
598   GLuint * value;
599   const char *variable_data = (const char *) (cmd + 1);
600   value = (GLuint *) variable_data;
601   CALL_ProgramUniform1uiv(ctx->CurrentServerDispatch, (program, location, count, value));
602   return cmd->cmd_base.cmd_size;
603}
604void GLAPIENTRY
605_mesa_marshal_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint * value)
606{
607   GET_CURRENT_CONTEXT(ctx);
608   int value_size = safe_mul(count, 1 * sizeof(GLuint));
609   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform1uiv) + value_size;
610   struct marshal_cmd_ProgramUniform1uiv *cmd;
611   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
612      _mesa_glthread_finish_before(ctx, "ProgramUniform1uiv");
613      CALL_ProgramUniform1uiv(ctx->CurrentServerDispatch, (program, location, count, value));
614      return;
615   }
616   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform1uiv, cmd_size);
617   cmd->program = program;
618   cmd->location = location;
619   cmd->count = count;
620   char *variable_data = (char *) (cmd + 1);
621   memcpy(variable_data, value, value_size);
622}
623
624
625/* ProgramUniform2uiv: marshalled asynchronously */
626struct marshal_cmd_ProgramUniform2uiv
627{
628   struct marshal_cmd_base cmd_base;
629   GLuint program;
630   GLint location;
631   GLsizei count;
632   /* Next safe_mul(count, 2 * sizeof(GLuint)) bytes are GLuint value[count][2] */
633};
634uint32_t
635_mesa_unmarshal_ProgramUniform2uiv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform2uiv *cmd, const uint64_t *last)
636{
637   GLuint program = cmd->program;
638   GLint location = cmd->location;
639   GLsizei count = cmd->count;
640   GLuint * value;
641   const char *variable_data = (const char *) (cmd + 1);
642   value = (GLuint *) variable_data;
643   CALL_ProgramUniform2uiv(ctx->CurrentServerDispatch, (program, location, count, value));
644   return cmd->cmd_base.cmd_size;
645}
646void GLAPIENTRY
647_mesa_marshal_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint * value)
648{
649   GET_CURRENT_CONTEXT(ctx);
650   int value_size = safe_mul(count, 2 * sizeof(GLuint));
651   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform2uiv) + value_size;
652   struct marshal_cmd_ProgramUniform2uiv *cmd;
653   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
654      _mesa_glthread_finish_before(ctx, "ProgramUniform2uiv");
655      CALL_ProgramUniform2uiv(ctx->CurrentServerDispatch, (program, location, count, value));
656      return;
657   }
658   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform2uiv, cmd_size);
659   cmd->program = program;
660   cmd->location = location;
661   cmd->count = count;
662   char *variable_data = (char *) (cmd + 1);
663   memcpy(variable_data, value, value_size);
664}
665
666
667/* ProgramUniform3uiv: marshalled asynchronously */
668struct marshal_cmd_ProgramUniform3uiv
669{
670   struct marshal_cmd_base cmd_base;
671   GLuint program;
672   GLint location;
673   GLsizei count;
674   /* Next safe_mul(count, 3 * sizeof(GLuint)) bytes are GLuint value[count][3] */
675};
676uint32_t
677_mesa_unmarshal_ProgramUniform3uiv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform3uiv *cmd, const uint64_t *last)
678{
679   GLuint program = cmd->program;
680   GLint location = cmd->location;
681   GLsizei count = cmd->count;
682   GLuint * value;
683   const char *variable_data = (const char *) (cmd + 1);
684   value = (GLuint *) variable_data;
685   CALL_ProgramUniform3uiv(ctx->CurrentServerDispatch, (program, location, count, value));
686   return cmd->cmd_base.cmd_size;
687}
688void GLAPIENTRY
689_mesa_marshal_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint * value)
690{
691   GET_CURRENT_CONTEXT(ctx);
692   int value_size = safe_mul(count, 3 * sizeof(GLuint));
693   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform3uiv) + value_size;
694   struct marshal_cmd_ProgramUniform3uiv *cmd;
695   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
696      _mesa_glthread_finish_before(ctx, "ProgramUniform3uiv");
697      CALL_ProgramUniform3uiv(ctx->CurrentServerDispatch, (program, location, count, value));
698      return;
699   }
700   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform3uiv, cmd_size);
701   cmd->program = program;
702   cmd->location = location;
703   cmd->count = count;
704   char *variable_data = (char *) (cmd + 1);
705   memcpy(variable_data, value, value_size);
706}
707
708
709/* ProgramUniform4uiv: marshalled asynchronously */
710struct marshal_cmd_ProgramUniform4uiv
711{
712   struct marshal_cmd_base cmd_base;
713   GLuint program;
714   GLint location;
715   GLsizei count;
716   /* Next safe_mul(count, 4 * sizeof(GLuint)) bytes are GLuint value[count][4] */
717};
718uint32_t
719_mesa_unmarshal_ProgramUniform4uiv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform4uiv *cmd, const uint64_t *last)
720{
721   GLuint program = cmd->program;
722   GLint location = cmd->location;
723   GLsizei count = cmd->count;
724   GLuint * value;
725   const char *variable_data = (const char *) (cmd + 1);
726   value = (GLuint *) variable_data;
727   CALL_ProgramUniform4uiv(ctx->CurrentServerDispatch, (program, location, count, value));
728   return cmd->cmd_base.cmd_size;
729}
730void GLAPIENTRY
731_mesa_marshal_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint * value)
732{
733   GET_CURRENT_CONTEXT(ctx);
734   int value_size = safe_mul(count, 4 * sizeof(GLuint));
735   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform4uiv) + value_size;
736   struct marshal_cmd_ProgramUniform4uiv *cmd;
737   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
738      _mesa_glthread_finish_before(ctx, "ProgramUniform4uiv");
739      CALL_ProgramUniform4uiv(ctx->CurrentServerDispatch, (program, location, count, value));
740      return;
741   }
742   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform4uiv, cmd_size);
743   cmd->program = program;
744   cmd->location = location;
745   cmd->count = count;
746   char *variable_data = (char *) (cmd + 1);
747   memcpy(variable_data, value, value_size);
748}
749
750
751/* ProgramUniform1fv: marshalled asynchronously */
752struct marshal_cmd_ProgramUniform1fv
753{
754   struct marshal_cmd_base cmd_base;
755   GLuint program;
756   GLint location;
757   GLsizei count;
758   /* Next safe_mul(count, 1 * sizeof(GLfloat)) bytes are GLfloat value[count] */
759};
760uint32_t
761_mesa_unmarshal_ProgramUniform1fv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform1fv *cmd, const uint64_t *last)
762{
763   GLuint program = cmd->program;
764   GLint location = cmd->location;
765   GLsizei count = cmd->count;
766   GLfloat * value;
767   const char *variable_data = (const char *) (cmd + 1);
768   value = (GLfloat *) variable_data;
769   CALL_ProgramUniform1fv(ctx->CurrentServerDispatch, (program, location, count, value));
770   return cmd->cmd_base.cmd_size;
771}
772void GLAPIENTRY
773_mesa_marshal_ProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat * value)
774{
775   GET_CURRENT_CONTEXT(ctx);
776   int value_size = safe_mul(count, 1 * sizeof(GLfloat));
777   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform1fv) + value_size;
778   struct marshal_cmd_ProgramUniform1fv *cmd;
779   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
780      _mesa_glthread_finish_before(ctx, "ProgramUniform1fv");
781      CALL_ProgramUniform1fv(ctx->CurrentServerDispatch, (program, location, count, value));
782      return;
783   }
784   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform1fv, cmd_size);
785   cmd->program = program;
786   cmd->location = location;
787   cmd->count = count;
788   char *variable_data = (char *) (cmd + 1);
789   memcpy(variable_data, value, value_size);
790}
791
792
793/* ProgramUniform2fv: marshalled asynchronously */
794struct marshal_cmd_ProgramUniform2fv
795{
796   struct marshal_cmd_base cmd_base;
797   GLuint program;
798   GLint location;
799   GLsizei count;
800   /* Next safe_mul(count, 2 * sizeof(GLfloat)) bytes are GLfloat value[count][2] */
801};
802uint32_t
803_mesa_unmarshal_ProgramUniform2fv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform2fv *cmd, const uint64_t *last)
804{
805   GLuint program = cmd->program;
806   GLint location = cmd->location;
807   GLsizei count = cmd->count;
808   GLfloat * value;
809   const char *variable_data = (const char *) (cmd + 1);
810   value = (GLfloat *) variable_data;
811   CALL_ProgramUniform2fv(ctx->CurrentServerDispatch, (program, location, count, value));
812   return cmd->cmd_base.cmd_size;
813}
814void GLAPIENTRY
815_mesa_marshal_ProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat * value)
816{
817   GET_CURRENT_CONTEXT(ctx);
818   int value_size = safe_mul(count, 2 * sizeof(GLfloat));
819   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform2fv) + value_size;
820   struct marshal_cmd_ProgramUniform2fv *cmd;
821   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
822      _mesa_glthread_finish_before(ctx, "ProgramUniform2fv");
823      CALL_ProgramUniform2fv(ctx->CurrentServerDispatch, (program, location, count, value));
824      return;
825   }
826   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform2fv, cmd_size);
827   cmd->program = program;
828   cmd->location = location;
829   cmd->count = count;
830   char *variable_data = (char *) (cmd + 1);
831   memcpy(variable_data, value, value_size);
832}
833
834
835/* ProgramUniform3fv: marshalled asynchronously */
836struct marshal_cmd_ProgramUniform3fv
837{
838   struct marshal_cmd_base cmd_base;
839   GLuint program;
840   GLint location;
841   GLsizei count;
842   /* Next safe_mul(count, 3 * sizeof(GLfloat)) bytes are GLfloat value[count][3] */
843};
844uint32_t
845_mesa_unmarshal_ProgramUniform3fv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform3fv *cmd, const uint64_t *last)
846{
847   GLuint program = cmd->program;
848   GLint location = cmd->location;
849   GLsizei count = cmd->count;
850   GLfloat * value;
851   const char *variable_data = (const char *) (cmd + 1);
852   value = (GLfloat *) variable_data;
853   CALL_ProgramUniform3fv(ctx->CurrentServerDispatch, (program, location, count, value));
854   return cmd->cmd_base.cmd_size;
855}
856void GLAPIENTRY
857_mesa_marshal_ProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat * value)
858{
859   GET_CURRENT_CONTEXT(ctx);
860   int value_size = safe_mul(count, 3 * sizeof(GLfloat));
861   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform3fv) + value_size;
862   struct marshal_cmd_ProgramUniform3fv *cmd;
863   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
864      _mesa_glthread_finish_before(ctx, "ProgramUniform3fv");
865      CALL_ProgramUniform3fv(ctx->CurrentServerDispatch, (program, location, count, value));
866      return;
867   }
868   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform3fv, cmd_size);
869   cmd->program = program;
870   cmd->location = location;
871   cmd->count = count;
872   char *variable_data = (char *) (cmd + 1);
873   memcpy(variable_data, value, value_size);
874}
875
876
877/* ProgramUniform4fv: marshalled asynchronously */
878struct marshal_cmd_ProgramUniform4fv
879{
880   struct marshal_cmd_base cmd_base;
881   GLuint program;
882   GLint location;
883   GLsizei count;
884   /* Next safe_mul(count, 4 * sizeof(GLfloat)) bytes are GLfloat value[count][4] */
885};
886uint32_t
887_mesa_unmarshal_ProgramUniform4fv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniform4fv *cmd, const uint64_t *last)
888{
889   GLuint program = cmd->program;
890   GLint location = cmd->location;
891   GLsizei count = cmd->count;
892   GLfloat * value;
893   const char *variable_data = (const char *) (cmd + 1);
894   value = (GLfloat *) variable_data;
895   CALL_ProgramUniform4fv(ctx->CurrentServerDispatch, (program, location, count, value));
896   return cmd->cmd_base.cmd_size;
897}
898void GLAPIENTRY
899_mesa_marshal_ProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat * value)
900{
901   GET_CURRENT_CONTEXT(ctx);
902   int value_size = safe_mul(count, 4 * sizeof(GLfloat));
903   int cmd_size = sizeof(struct marshal_cmd_ProgramUniform4fv) + value_size;
904   struct marshal_cmd_ProgramUniform4fv *cmd;
905   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
906      _mesa_glthread_finish_before(ctx, "ProgramUniform4fv");
907      CALL_ProgramUniform4fv(ctx->CurrentServerDispatch, (program, location, count, value));
908      return;
909   }
910   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniform4fv, cmd_size);
911   cmd->program = program;
912   cmd->location = location;
913   cmd->count = count;
914   char *variable_data = (char *) (cmd + 1);
915   memcpy(variable_data, value, value_size);
916}
917
918
919/* ProgramUniformMatrix2fv: marshalled asynchronously */
920struct marshal_cmd_ProgramUniformMatrix2fv
921{
922   struct marshal_cmd_base cmd_base;
923   GLboolean transpose;
924   GLuint program;
925   GLint location;
926   GLsizei count;
927   /* Next safe_mul(count, 4 * sizeof(GLfloat)) bytes are GLfloat value[count][4] */
928};
929uint32_t
930_mesa_unmarshal_ProgramUniformMatrix2fv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniformMatrix2fv *cmd, const uint64_t *last)
931{
932   GLuint program = cmd->program;
933   GLint location = cmd->location;
934   GLsizei count = cmd->count;
935   GLboolean transpose = cmd->transpose;
936   GLfloat * value;
937   const char *variable_data = (const char *) (cmd + 1);
938   value = (GLfloat *) variable_data;
939   CALL_ProgramUniformMatrix2fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
940   return cmd->cmd_base.cmd_size;
941}
942void GLAPIENTRY
943_mesa_marshal_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
944{
945   GET_CURRENT_CONTEXT(ctx);
946   int value_size = safe_mul(count, 4 * sizeof(GLfloat));
947   int cmd_size = sizeof(struct marshal_cmd_ProgramUniformMatrix2fv) + value_size;
948   struct marshal_cmd_ProgramUniformMatrix2fv *cmd;
949   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
950      _mesa_glthread_finish_before(ctx, "ProgramUniformMatrix2fv");
951      CALL_ProgramUniformMatrix2fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
952      return;
953   }
954   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniformMatrix2fv, cmd_size);
955   cmd->program = program;
956   cmd->location = location;
957   cmd->count = count;
958   cmd->transpose = transpose;
959   char *variable_data = (char *) (cmd + 1);
960   memcpy(variable_data, value, value_size);
961}
962
963
964/* ProgramUniformMatrix3fv: marshalled asynchronously */
965struct marshal_cmd_ProgramUniformMatrix3fv
966{
967   struct marshal_cmd_base cmd_base;
968   GLboolean transpose;
969   GLuint program;
970   GLint location;
971   GLsizei count;
972   /* Next safe_mul(count, 9 * sizeof(GLfloat)) bytes are GLfloat value[count][9] */
973};
974uint32_t
975_mesa_unmarshal_ProgramUniformMatrix3fv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniformMatrix3fv *cmd, const uint64_t *last)
976{
977   GLuint program = cmd->program;
978   GLint location = cmd->location;
979   GLsizei count = cmd->count;
980   GLboolean transpose = cmd->transpose;
981   GLfloat * value;
982   const char *variable_data = (const char *) (cmd + 1);
983   value = (GLfloat *) variable_data;
984   CALL_ProgramUniformMatrix3fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
985   return cmd->cmd_base.cmd_size;
986}
987void GLAPIENTRY
988_mesa_marshal_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
989{
990   GET_CURRENT_CONTEXT(ctx);
991   int value_size = safe_mul(count, 9 * sizeof(GLfloat));
992   int cmd_size = sizeof(struct marshal_cmd_ProgramUniformMatrix3fv) + value_size;
993   struct marshal_cmd_ProgramUniformMatrix3fv *cmd;
994   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
995      _mesa_glthread_finish_before(ctx, "ProgramUniformMatrix3fv");
996      CALL_ProgramUniformMatrix3fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
997      return;
998   }
999   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniformMatrix3fv, cmd_size);
1000   cmd->program = program;
1001   cmd->location = location;
1002   cmd->count = count;
1003   cmd->transpose = transpose;
1004   char *variable_data = (char *) (cmd + 1);
1005   memcpy(variable_data, value, value_size);
1006}
1007
1008
1009/* ProgramUniformMatrix4fv: marshalled asynchronously */
1010struct marshal_cmd_ProgramUniformMatrix4fv
1011{
1012   struct marshal_cmd_base cmd_base;
1013   GLboolean transpose;
1014   GLuint program;
1015   GLint location;
1016   GLsizei count;
1017   /* Next safe_mul(count, 16 * sizeof(GLfloat)) bytes are GLfloat value[count][16] */
1018};
1019uint32_t
1020_mesa_unmarshal_ProgramUniformMatrix4fv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniformMatrix4fv *cmd, const uint64_t *last)
1021{
1022   GLuint program = cmd->program;
1023   GLint location = cmd->location;
1024   GLsizei count = cmd->count;
1025   GLboolean transpose = cmd->transpose;
1026   GLfloat * value;
1027   const char *variable_data = (const char *) (cmd + 1);
1028   value = (GLfloat *) variable_data;
1029   CALL_ProgramUniformMatrix4fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1030   return cmd->cmd_base.cmd_size;
1031}
1032void GLAPIENTRY
1033_mesa_marshal_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
1034{
1035   GET_CURRENT_CONTEXT(ctx);
1036   int value_size = safe_mul(count, 16 * sizeof(GLfloat));
1037   int cmd_size = sizeof(struct marshal_cmd_ProgramUniformMatrix4fv) + value_size;
1038   struct marshal_cmd_ProgramUniformMatrix4fv *cmd;
1039   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
1040      _mesa_glthread_finish_before(ctx, "ProgramUniformMatrix4fv");
1041      CALL_ProgramUniformMatrix4fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1042      return;
1043   }
1044   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniformMatrix4fv, cmd_size);
1045   cmd->program = program;
1046   cmd->location = location;
1047   cmd->count = count;
1048   cmd->transpose = transpose;
1049   char *variable_data = (char *) (cmd + 1);
1050   memcpy(variable_data, value, value_size);
1051}
1052
1053
1054/* ProgramUniformMatrix2x3fv: marshalled asynchronously */
1055struct marshal_cmd_ProgramUniformMatrix2x3fv
1056{
1057   struct marshal_cmd_base cmd_base;
1058   GLboolean transpose;
1059   GLuint program;
1060   GLint location;
1061   GLsizei count;
1062   /* Next safe_mul(count, 6 * sizeof(GLfloat)) bytes are GLfloat value[count][6] */
1063};
1064uint32_t
1065_mesa_unmarshal_ProgramUniformMatrix2x3fv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniformMatrix2x3fv *cmd, const uint64_t *last)
1066{
1067   GLuint program = cmd->program;
1068   GLint location = cmd->location;
1069   GLsizei count = cmd->count;
1070   GLboolean transpose = cmd->transpose;
1071   GLfloat * value;
1072   const char *variable_data = (const char *) (cmd + 1);
1073   value = (GLfloat *) variable_data;
1074   CALL_ProgramUniformMatrix2x3fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1075   return cmd->cmd_base.cmd_size;
1076}
1077void GLAPIENTRY
1078_mesa_marshal_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
1079{
1080   GET_CURRENT_CONTEXT(ctx);
1081   int value_size = safe_mul(count, 6 * sizeof(GLfloat));
1082   int cmd_size = sizeof(struct marshal_cmd_ProgramUniformMatrix2x3fv) + value_size;
1083   struct marshal_cmd_ProgramUniformMatrix2x3fv *cmd;
1084   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
1085      _mesa_glthread_finish_before(ctx, "ProgramUniformMatrix2x3fv");
1086      CALL_ProgramUniformMatrix2x3fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1087      return;
1088   }
1089   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniformMatrix2x3fv, cmd_size);
1090   cmd->program = program;
1091   cmd->location = location;
1092   cmd->count = count;
1093   cmd->transpose = transpose;
1094   char *variable_data = (char *) (cmd + 1);
1095   memcpy(variable_data, value, value_size);
1096}
1097
1098
1099/* ProgramUniformMatrix3x2fv: marshalled asynchronously */
1100struct marshal_cmd_ProgramUniformMatrix3x2fv
1101{
1102   struct marshal_cmd_base cmd_base;
1103   GLboolean transpose;
1104   GLuint program;
1105   GLint location;
1106   GLsizei count;
1107   /* Next safe_mul(count, 6 * sizeof(GLfloat)) bytes are GLfloat value[count][6] */
1108};
1109uint32_t
1110_mesa_unmarshal_ProgramUniformMatrix3x2fv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniformMatrix3x2fv *cmd, const uint64_t *last)
1111{
1112   GLuint program = cmd->program;
1113   GLint location = cmd->location;
1114   GLsizei count = cmd->count;
1115   GLboolean transpose = cmd->transpose;
1116   GLfloat * value;
1117   const char *variable_data = (const char *) (cmd + 1);
1118   value = (GLfloat *) variable_data;
1119   CALL_ProgramUniformMatrix3x2fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1120   return cmd->cmd_base.cmd_size;
1121}
1122void GLAPIENTRY
1123_mesa_marshal_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
1124{
1125   GET_CURRENT_CONTEXT(ctx);
1126   int value_size = safe_mul(count, 6 * sizeof(GLfloat));
1127   int cmd_size = sizeof(struct marshal_cmd_ProgramUniformMatrix3x2fv) + value_size;
1128   struct marshal_cmd_ProgramUniformMatrix3x2fv *cmd;
1129   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
1130      _mesa_glthread_finish_before(ctx, "ProgramUniformMatrix3x2fv");
1131      CALL_ProgramUniformMatrix3x2fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1132      return;
1133   }
1134   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniformMatrix3x2fv, cmd_size);
1135   cmd->program = program;
1136   cmd->location = location;
1137   cmd->count = count;
1138   cmd->transpose = transpose;
1139   char *variable_data = (char *) (cmd + 1);
1140   memcpy(variable_data, value, value_size);
1141}
1142
1143
1144/* ProgramUniformMatrix2x4fv: marshalled asynchronously */
1145struct marshal_cmd_ProgramUniformMatrix2x4fv
1146{
1147   struct marshal_cmd_base cmd_base;
1148   GLboolean transpose;
1149   GLuint program;
1150   GLint location;
1151   GLsizei count;
1152   /* Next safe_mul(count, 8 * sizeof(GLfloat)) bytes are GLfloat value[count][8] */
1153};
1154uint32_t
1155_mesa_unmarshal_ProgramUniformMatrix2x4fv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniformMatrix2x4fv *cmd, const uint64_t *last)
1156{
1157   GLuint program = cmd->program;
1158   GLint location = cmd->location;
1159   GLsizei count = cmd->count;
1160   GLboolean transpose = cmd->transpose;
1161   GLfloat * value;
1162   const char *variable_data = (const char *) (cmd + 1);
1163   value = (GLfloat *) variable_data;
1164   CALL_ProgramUniformMatrix2x4fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1165   return cmd->cmd_base.cmd_size;
1166}
1167void GLAPIENTRY
1168_mesa_marshal_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
1169{
1170   GET_CURRENT_CONTEXT(ctx);
1171   int value_size = safe_mul(count, 8 * sizeof(GLfloat));
1172   int cmd_size = sizeof(struct marshal_cmd_ProgramUniformMatrix2x4fv) + value_size;
1173   struct marshal_cmd_ProgramUniformMatrix2x4fv *cmd;
1174   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
1175      _mesa_glthread_finish_before(ctx, "ProgramUniformMatrix2x4fv");
1176      CALL_ProgramUniformMatrix2x4fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1177      return;
1178   }
1179   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniformMatrix2x4fv, cmd_size);
1180   cmd->program = program;
1181   cmd->location = location;
1182   cmd->count = count;
1183   cmd->transpose = transpose;
1184   char *variable_data = (char *) (cmd + 1);
1185   memcpy(variable_data, value, value_size);
1186}
1187
1188
1189/* ProgramUniformMatrix4x2fv: marshalled asynchronously */
1190struct marshal_cmd_ProgramUniformMatrix4x2fv
1191{
1192   struct marshal_cmd_base cmd_base;
1193   GLboolean transpose;
1194   GLuint program;
1195   GLint location;
1196   GLsizei count;
1197   /* Next safe_mul(count, 8 * sizeof(GLfloat)) bytes are GLfloat value[count][8] */
1198};
1199uint32_t
1200_mesa_unmarshal_ProgramUniformMatrix4x2fv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniformMatrix4x2fv *cmd, const uint64_t *last)
1201{
1202   GLuint program = cmd->program;
1203   GLint location = cmd->location;
1204   GLsizei count = cmd->count;
1205   GLboolean transpose = cmd->transpose;
1206   GLfloat * value;
1207   const char *variable_data = (const char *) (cmd + 1);
1208   value = (GLfloat *) variable_data;
1209   CALL_ProgramUniformMatrix4x2fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1210   return cmd->cmd_base.cmd_size;
1211}
1212void GLAPIENTRY
1213_mesa_marshal_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
1214{
1215   GET_CURRENT_CONTEXT(ctx);
1216   int value_size = safe_mul(count, 8 * sizeof(GLfloat));
1217   int cmd_size = sizeof(struct marshal_cmd_ProgramUniformMatrix4x2fv) + value_size;
1218   struct marshal_cmd_ProgramUniformMatrix4x2fv *cmd;
1219   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
1220      _mesa_glthread_finish_before(ctx, "ProgramUniformMatrix4x2fv");
1221      CALL_ProgramUniformMatrix4x2fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1222      return;
1223   }
1224   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniformMatrix4x2fv, cmd_size);
1225   cmd->program = program;
1226   cmd->location = location;
1227   cmd->count = count;
1228   cmd->transpose = transpose;
1229   char *variable_data = (char *) (cmd + 1);
1230   memcpy(variable_data, value, value_size);
1231}
1232
1233
1234/* ProgramUniformMatrix3x4fv: marshalled asynchronously */
1235struct marshal_cmd_ProgramUniformMatrix3x4fv
1236{
1237   struct marshal_cmd_base cmd_base;
1238   GLboolean transpose;
1239   GLuint program;
1240   GLint location;
1241   GLsizei count;
1242   /* Next safe_mul(count, 12 * sizeof(GLfloat)) bytes are GLfloat value[count][12] */
1243};
1244uint32_t
1245_mesa_unmarshal_ProgramUniformMatrix3x4fv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniformMatrix3x4fv *cmd, const uint64_t *last)
1246{
1247   GLuint program = cmd->program;
1248   GLint location = cmd->location;
1249   GLsizei count = cmd->count;
1250   GLboolean transpose = cmd->transpose;
1251   GLfloat * value;
1252   const char *variable_data = (const char *) (cmd + 1);
1253   value = (GLfloat *) variable_data;
1254   CALL_ProgramUniformMatrix3x4fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1255   return cmd->cmd_base.cmd_size;
1256}
1257void GLAPIENTRY
1258_mesa_marshal_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
1259{
1260   GET_CURRENT_CONTEXT(ctx);
1261   int value_size = safe_mul(count, 12 * sizeof(GLfloat));
1262   int cmd_size = sizeof(struct marshal_cmd_ProgramUniformMatrix3x4fv) + value_size;
1263   struct marshal_cmd_ProgramUniformMatrix3x4fv *cmd;
1264   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
1265      _mesa_glthread_finish_before(ctx, "ProgramUniformMatrix3x4fv");
1266      CALL_ProgramUniformMatrix3x4fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1267      return;
1268   }
1269   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniformMatrix3x4fv, cmd_size);
1270   cmd->program = program;
1271   cmd->location = location;
1272   cmd->count = count;
1273   cmd->transpose = transpose;
1274   char *variable_data = (char *) (cmd + 1);
1275   memcpy(variable_data, value, value_size);
1276}
1277
1278
1279/* ProgramUniformMatrix4x3fv: marshalled asynchronously */
1280struct marshal_cmd_ProgramUniformMatrix4x3fv
1281{
1282   struct marshal_cmd_base cmd_base;
1283   GLboolean transpose;
1284   GLuint program;
1285   GLint location;
1286   GLsizei count;
1287   /* Next safe_mul(count, 12 * sizeof(GLfloat)) bytes are GLfloat value[count][12] */
1288};
1289uint32_t
1290_mesa_unmarshal_ProgramUniformMatrix4x3fv(struct gl_context *ctx, const struct marshal_cmd_ProgramUniformMatrix4x3fv *cmd, const uint64_t *last)
1291{
1292   GLuint program = cmd->program;
1293   GLint location = cmd->location;
1294   GLsizei count = cmd->count;
1295   GLboolean transpose = cmd->transpose;
1296   GLfloat * value;
1297   const char *variable_data = (const char *) (cmd + 1);
1298   value = (GLfloat *) variable_data;
1299   CALL_ProgramUniformMatrix4x3fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1300   return cmd->cmd_base.cmd_size;
1301}
1302void GLAPIENTRY
1303_mesa_marshal_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
1304{
1305   GET_CURRENT_CONTEXT(ctx);
1306   int value_size = safe_mul(count, 12 * sizeof(GLfloat));
1307   int cmd_size = sizeof(struct marshal_cmd_ProgramUniformMatrix4x3fv) + value_size;
1308   struct marshal_cmd_ProgramUniformMatrix4x3fv *cmd;
1309   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
1310      _mesa_glthread_finish_before(ctx, "ProgramUniformMatrix4x3fv");
1311      CALL_ProgramUniformMatrix4x3fv(ctx->CurrentServerDispatch, (program, location, count, transpose, value));
1312      return;
1313   }
1314   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniformMatrix4x3fv, cmd_size);
1315   cmd->program = program;
1316   cmd->location = location;
1317   cmd->count = count;
1318   cmd->transpose = transpose;
1319   char *variable_data = (char *) (cmd + 1);
1320   memcpy(variable_data, value, value_size);
1321}
1322
1323
1324/* ValidateProgramPipeline: marshalled asynchronously */
1325struct marshal_cmd_ValidateProgramPipeline
1326{
1327   struct marshal_cmd_base cmd_base;
1328   GLuint pipeline;
1329};
1330uint32_t
1331_mesa_unmarshal_ValidateProgramPipeline(struct gl_context *ctx, const struct marshal_cmd_ValidateProgramPipeline *cmd, const uint64_t *last)
1332{
1333   GLuint pipeline = cmd->pipeline;
1334   CALL_ValidateProgramPipeline(ctx->CurrentServerDispatch, (pipeline));
1335   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ValidateProgramPipeline), 8) / 8);
1336   assert (cmd_size == cmd->cmd_base.cmd_size);
1337   return cmd_size;
1338}
1339void GLAPIENTRY
1340_mesa_marshal_ValidateProgramPipeline(GLuint pipeline)
1341{
1342   GET_CURRENT_CONTEXT(ctx);
1343   int cmd_size = sizeof(struct marshal_cmd_ValidateProgramPipeline);
1344   struct marshal_cmd_ValidateProgramPipeline *cmd;
1345   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ValidateProgramPipeline, cmd_size);
1346   cmd->pipeline = pipeline;
1347}
1348
1349
1350/* GetProgramPipelineInfoLog: marshalled synchronously */
1351void GLAPIENTRY
1352_mesa_marshal_GetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog)
1353{
1354   GET_CURRENT_CONTEXT(ctx);
1355   _mesa_glthread_finish_before(ctx, "GetProgramPipelineInfoLog");
1356   CALL_GetProgramPipelineInfoLog(ctx->CurrentServerDispatch, (pipeline, bufSize, length, infoLog));
1357}
1358
1359
1360/* VertexAttribL1d: marshalled asynchronously */
1361struct marshal_cmd_VertexAttribL1d
1362{
1363   struct marshal_cmd_base cmd_base;
1364   GLuint index;
1365   GLdouble x;
1366};
1367uint32_t
1368_mesa_unmarshal_VertexAttribL1d(struct gl_context *ctx, const struct marshal_cmd_VertexAttribL1d *cmd, const uint64_t *last)
1369{
1370   GLuint index = cmd->index;
1371   GLdouble x = cmd->x;
1372   CALL_VertexAttribL1d(ctx->CurrentServerDispatch, (index, x));
1373   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribL1d), 8) / 8);
1374   assert (cmd_size == cmd->cmd_base.cmd_size);
1375   return cmd_size;
1376}
1377void GLAPIENTRY
1378_mesa_marshal_VertexAttribL1d(GLuint index, GLdouble x)
1379{
1380   GET_CURRENT_CONTEXT(ctx);
1381   int cmd_size = sizeof(struct marshal_cmd_VertexAttribL1d);
1382   struct marshal_cmd_VertexAttribL1d *cmd;
1383   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribL1d, cmd_size);
1384   cmd->index = index;
1385   cmd->x = x;
1386}
1387
1388
1389/* VertexAttribL2d: marshalled asynchronously */
1390struct marshal_cmd_VertexAttribL2d
1391{
1392   struct marshal_cmd_base cmd_base;
1393   GLuint index;
1394   GLdouble x;
1395   GLdouble y;
1396};
1397uint32_t
1398_mesa_unmarshal_VertexAttribL2d(struct gl_context *ctx, const struct marshal_cmd_VertexAttribL2d *cmd, const uint64_t *last)
1399{
1400   GLuint index = cmd->index;
1401   GLdouble x = cmd->x;
1402   GLdouble y = cmd->y;
1403   CALL_VertexAttribL2d(ctx->CurrentServerDispatch, (index, x, y));
1404   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribL2d), 8) / 8);
1405   assert (cmd_size == cmd->cmd_base.cmd_size);
1406   return cmd_size;
1407}
1408void GLAPIENTRY
1409_mesa_marshal_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
1410{
1411   GET_CURRENT_CONTEXT(ctx);
1412   int cmd_size = sizeof(struct marshal_cmd_VertexAttribL2d);
1413   struct marshal_cmd_VertexAttribL2d *cmd;
1414   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribL2d, cmd_size);
1415   cmd->index = index;
1416   cmd->x = x;
1417   cmd->y = y;
1418}
1419
1420
1421/* VertexAttribL3d: marshalled asynchronously */
1422struct marshal_cmd_VertexAttribL3d
1423{
1424   struct marshal_cmd_base cmd_base;
1425   GLuint index;
1426   GLdouble x;
1427   GLdouble y;
1428   GLdouble z;
1429};
1430uint32_t
1431_mesa_unmarshal_VertexAttribL3d(struct gl_context *ctx, const struct marshal_cmd_VertexAttribL3d *cmd, const uint64_t *last)
1432{
1433   GLuint index = cmd->index;
1434   GLdouble x = cmd->x;
1435   GLdouble y = cmd->y;
1436   GLdouble z = cmd->z;
1437   CALL_VertexAttribL3d(ctx->CurrentServerDispatch, (index, x, y, z));
1438   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribL3d), 8) / 8);
1439   assert (cmd_size == cmd->cmd_base.cmd_size);
1440   return cmd_size;
1441}
1442void GLAPIENTRY
1443_mesa_marshal_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
1444{
1445   GET_CURRENT_CONTEXT(ctx);
1446   int cmd_size = sizeof(struct marshal_cmd_VertexAttribL3d);
1447   struct marshal_cmd_VertexAttribL3d *cmd;
1448   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribL3d, cmd_size);
1449   cmd->index = index;
1450   cmd->x = x;
1451   cmd->y = y;
1452   cmd->z = z;
1453}
1454
1455
1456/* VertexAttribL4d: marshalled asynchronously */
1457struct marshal_cmd_VertexAttribL4d
1458{
1459   struct marshal_cmd_base cmd_base;
1460   GLuint index;
1461   GLdouble x;
1462   GLdouble y;
1463   GLdouble z;
1464   GLdouble w;
1465};
1466uint32_t
1467_mesa_unmarshal_VertexAttribL4d(struct gl_context *ctx, const struct marshal_cmd_VertexAttribL4d *cmd, const uint64_t *last)
1468{
1469   GLuint index = cmd->index;
1470   GLdouble x = cmd->x;
1471   GLdouble y = cmd->y;
1472   GLdouble z = cmd->z;
1473   GLdouble w = cmd->w;
1474   CALL_VertexAttribL4d(ctx->CurrentServerDispatch, (index, x, y, z, w));
1475   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribL4d), 8) / 8);
1476   assert (cmd_size == cmd->cmd_base.cmd_size);
1477   return cmd_size;
1478}
1479void GLAPIENTRY
1480_mesa_marshal_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
1481{
1482   GET_CURRENT_CONTEXT(ctx);
1483   int cmd_size = sizeof(struct marshal_cmd_VertexAttribL4d);
1484   struct marshal_cmd_VertexAttribL4d *cmd;
1485   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribL4d, cmd_size);
1486   cmd->index = index;
1487   cmd->x = x;
1488   cmd->y = y;
1489   cmd->z = z;
1490   cmd->w = w;
1491}
1492
1493
1494/* VertexAttribL1dv: marshalled asynchronously */
1495struct marshal_cmd_VertexAttribL1dv
1496{
1497   struct marshal_cmd_base cmd_base;
1498   GLuint index;
1499   GLdouble v[1];
1500};
1501uint32_t
1502_mesa_unmarshal_VertexAttribL1dv(struct gl_context *ctx, const struct marshal_cmd_VertexAttribL1dv *cmd, const uint64_t *last)
1503{
1504   GLuint index = cmd->index;
1505   const GLdouble * v = cmd->v;
1506   CALL_VertexAttribL1dv(ctx->CurrentServerDispatch, (index, v));
1507   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribL1dv), 8) / 8);
1508   assert (cmd_size == cmd->cmd_base.cmd_size);
1509   return cmd_size;
1510}
1511void GLAPIENTRY
1512_mesa_marshal_VertexAttribL1dv(GLuint index, const GLdouble * v)
1513{
1514   GET_CURRENT_CONTEXT(ctx);
1515   int cmd_size = sizeof(struct marshal_cmd_VertexAttribL1dv);
1516   struct marshal_cmd_VertexAttribL1dv *cmd;
1517   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribL1dv, cmd_size);
1518   cmd->index = index;
1519   memcpy(cmd->v, v, 1 * sizeof(GLdouble));
1520}
1521
1522
1523/* VertexAttribL2dv: marshalled asynchronously */
1524struct marshal_cmd_VertexAttribL2dv
1525{
1526   struct marshal_cmd_base cmd_base;
1527   GLuint index;
1528   GLdouble v[2];
1529};
1530uint32_t
1531_mesa_unmarshal_VertexAttribL2dv(struct gl_context *ctx, const struct marshal_cmd_VertexAttribL2dv *cmd, const uint64_t *last)
1532{
1533   GLuint index = cmd->index;
1534   const GLdouble * v = cmd->v;
1535   CALL_VertexAttribL2dv(ctx->CurrentServerDispatch, (index, v));
1536   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribL2dv), 8) / 8);
1537   assert (cmd_size == cmd->cmd_base.cmd_size);
1538   return cmd_size;
1539}
1540void GLAPIENTRY
1541_mesa_marshal_VertexAttribL2dv(GLuint index, const GLdouble * v)
1542{
1543   GET_CURRENT_CONTEXT(ctx);
1544   int cmd_size = sizeof(struct marshal_cmd_VertexAttribL2dv);
1545   struct marshal_cmd_VertexAttribL2dv *cmd;
1546   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribL2dv, cmd_size);
1547   cmd->index = index;
1548   memcpy(cmd->v, v, 2 * sizeof(GLdouble));
1549}
1550
1551
1552/* VertexAttribL3dv: marshalled asynchronously */
1553struct marshal_cmd_VertexAttribL3dv
1554{
1555   struct marshal_cmd_base cmd_base;
1556   GLuint index;
1557   GLdouble v[3];
1558};
1559uint32_t
1560_mesa_unmarshal_VertexAttribL3dv(struct gl_context *ctx, const struct marshal_cmd_VertexAttribL3dv *cmd, const uint64_t *last)
1561{
1562   GLuint index = cmd->index;
1563   const GLdouble * v = cmd->v;
1564   CALL_VertexAttribL3dv(ctx->CurrentServerDispatch, (index, v));
1565   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribL3dv), 8) / 8);
1566   assert (cmd_size == cmd->cmd_base.cmd_size);
1567   return cmd_size;
1568}
1569void GLAPIENTRY
1570_mesa_marshal_VertexAttribL3dv(GLuint index, const GLdouble * v)
1571{
1572   GET_CURRENT_CONTEXT(ctx);
1573   int cmd_size = sizeof(struct marshal_cmd_VertexAttribL3dv);
1574   struct marshal_cmd_VertexAttribL3dv *cmd;
1575   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribL3dv, cmd_size);
1576   cmd->index = index;
1577   memcpy(cmd->v, v, 3 * sizeof(GLdouble));
1578}
1579
1580
1581/* VertexAttribL4dv: marshalled asynchronously */
1582struct marshal_cmd_VertexAttribL4dv
1583{
1584   struct marshal_cmd_base cmd_base;
1585   GLuint index;
1586   GLdouble v[4];
1587};
1588uint32_t
1589_mesa_unmarshal_VertexAttribL4dv(struct gl_context *ctx, const struct marshal_cmd_VertexAttribL4dv *cmd, const uint64_t *last)
1590{
1591   GLuint index = cmd->index;
1592   const GLdouble * v = cmd->v;
1593   CALL_VertexAttribL4dv(ctx->CurrentServerDispatch, (index, v));
1594   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribL4dv), 8) / 8);
1595   assert (cmd_size == cmd->cmd_base.cmd_size);
1596   return cmd_size;
1597}
1598void GLAPIENTRY
1599_mesa_marshal_VertexAttribL4dv(GLuint index, const GLdouble * v)
1600{
1601   GET_CURRENT_CONTEXT(ctx);
1602   int cmd_size = sizeof(struct marshal_cmd_VertexAttribL4dv);
1603   struct marshal_cmd_VertexAttribL4dv *cmd;
1604   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribL4dv, cmd_size);
1605   cmd->index = index;
1606   memcpy(cmd->v, v, 4 * sizeof(GLdouble));
1607}
1608
1609
1610/* VertexAttribLPointer: marshalled asynchronously */
1611struct marshal_cmd_VertexAttribLPointer
1612{
1613   struct marshal_cmd_base cmd_base;
1614   GLuint index;
1615   GLint size;
1616   GLenum type;
1617   GLsizei stride;
1618   const GLvoid * pointer;
1619};
1620uint32_t
1621_mesa_unmarshal_VertexAttribLPointer(struct gl_context *ctx, const struct marshal_cmd_VertexAttribLPointer *cmd, const uint64_t *last)
1622{
1623   GLuint index = cmd->index;
1624   GLint size = cmd->size;
1625   GLenum type = cmd->type;
1626   GLsizei stride = cmd->stride;
1627   const GLvoid * pointer = cmd->pointer;
1628   CALL_VertexAttribLPointer(ctx->CurrentServerDispatch, (index, size, type, stride, pointer));
1629   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribLPointer), 8) / 8);
1630   assert (cmd_size == cmd->cmd_base.cmd_size);
1631   return cmd_size;
1632}
1633void GLAPIENTRY
1634_mesa_marshal_VertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer)
1635{
1636   GET_CURRENT_CONTEXT(ctx);
1637   int cmd_size = sizeof(struct marshal_cmd_VertexAttribLPointer);
1638   struct marshal_cmd_VertexAttribLPointer *cmd;
1639   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribLPointer, cmd_size);
1640   cmd->index = index;
1641   cmd->size = size;
1642   cmd->type = type;
1643   cmd->stride = stride;
1644   cmd->pointer = pointer;
1645   if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_GENERIC(index), size, type, stride, pointer);
1646}
1647
1648
1649/* GetVertexAttribLdv: marshalled synchronously */
1650void GLAPIENTRY
1651_mesa_marshal_GetVertexAttribLdv(GLuint index, GLenum pname, GLdouble * params)
1652{
1653   GET_CURRENT_CONTEXT(ctx);
1654   _mesa_glthread_finish_before(ctx, "GetVertexAttribLdv");
1655   CALL_GetVertexAttribLdv(ctx->CurrentServerDispatch, (index, pname, params));
1656}
1657
1658
1659/* VertexArrayVertexAttribLOffsetEXT: marshalled asynchronously */
1660struct marshal_cmd_VertexArrayVertexAttribLOffsetEXT
1661{
1662   struct marshal_cmd_base cmd_base;
1663   GLuint vaobj;
1664   GLuint buffer;
1665   GLuint index;
1666   GLint size;
1667   GLenum type;
1668   GLsizei stride;
1669   GLintptr offset;
1670};
1671uint32_t
1672_mesa_unmarshal_VertexArrayVertexAttribLOffsetEXT(struct gl_context *ctx, const struct marshal_cmd_VertexArrayVertexAttribLOffsetEXT *cmd, const uint64_t *last)
1673{
1674   GLuint vaobj = cmd->vaobj;
1675   GLuint buffer = cmd->buffer;
1676   GLuint index = cmd->index;
1677   GLint size = cmd->size;
1678   GLenum type = cmd->type;
1679   GLsizei stride = cmd->stride;
1680   GLintptr offset = cmd->offset;
1681   CALL_VertexArrayVertexAttribLOffsetEXT(ctx->CurrentServerDispatch, (vaobj, buffer, index, size, type, stride, offset));
1682   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayVertexAttribLOffsetEXT), 8) / 8);
1683   assert (cmd_size == cmd->cmd_base.cmd_size);
1684   return cmd_size;
1685}
1686void GLAPIENTRY
1687_mesa_marshal_VertexArrayVertexAttribLOffsetEXT(GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset)
1688{
1689   GET_CURRENT_CONTEXT(ctx);
1690   int cmd_size = sizeof(struct marshal_cmd_VertexArrayVertexAttribLOffsetEXT);
1691   struct marshal_cmd_VertexArrayVertexAttribLOffsetEXT *cmd;
1692   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayVertexAttribLOffsetEXT, cmd_size);
1693   cmd->vaobj = vaobj;
1694   cmd->buffer = buffer;
1695   cmd->index = index;
1696   cmd->size = size;
1697   cmd->type = type;
1698   cmd->stride = stride;
1699   cmd->offset = offset;
1700   if (COMPAT) _mesa_glthread_DSAAttribPointer(ctx, vaobj, buffer, VERT_ATTRIB_GENERIC(index), size, type, stride, offset);
1701}
1702
1703
1704/* GetShaderPrecisionFormat: marshalled synchronously */
1705void GLAPIENTRY
1706_mesa_marshal_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision)
1707{
1708   GET_CURRENT_CONTEXT(ctx);
1709   _mesa_glthread_finish_before(ctx, "GetShaderPrecisionFormat");
1710   CALL_GetShaderPrecisionFormat(ctx->CurrentServerDispatch, (shadertype, precisiontype, range, precision));
1711}
1712
1713
1714/* ReleaseShaderCompiler: marshalled asynchronously */
1715struct marshal_cmd_ReleaseShaderCompiler
1716{
1717   struct marshal_cmd_base cmd_base;
1718};
1719uint32_t
1720_mesa_unmarshal_ReleaseShaderCompiler(struct gl_context *ctx, const struct marshal_cmd_ReleaseShaderCompiler *cmd, const uint64_t *last)
1721{
1722   CALL_ReleaseShaderCompiler(ctx->CurrentServerDispatch, ());
1723   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ReleaseShaderCompiler), 8) / 8);
1724   assert (cmd_size == cmd->cmd_base.cmd_size);
1725   return cmd_size;
1726}
1727void GLAPIENTRY
1728_mesa_marshal_ReleaseShaderCompiler(void)
1729{
1730   GET_CURRENT_CONTEXT(ctx);
1731   int cmd_size = sizeof(struct marshal_cmd_ReleaseShaderCompiler);
1732   struct marshal_cmd_ReleaseShaderCompiler *cmd;
1733   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ReleaseShaderCompiler, cmd_size);
1734   (void) cmd;
1735}
1736
1737
1738/* ShaderBinary: marshalled asynchronously */
1739struct marshal_cmd_ShaderBinary
1740{
1741   struct marshal_cmd_base cmd_base;
1742   GLsizei n;
1743   GLenum binaryformat;
1744   GLsizei length;
1745   /* Next safe_mul(n, 1 * sizeof(GLuint)) bytes are GLuint shaders[n] */
1746   /* Next length bytes are GLvoid binary[length] */
1747};
1748uint32_t
1749_mesa_unmarshal_ShaderBinary(struct gl_context *ctx, const struct marshal_cmd_ShaderBinary *cmd, const uint64_t *last)
1750{
1751   GLsizei n = cmd->n;
1752   GLenum binaryformat = cmd->binaryformat;
1753   GLsizei length = cmd->length;
1754   GLuint * shaders;
1755   GLvoid * binary;
1756   const char *variable_data = (const char *) (cmd + 1);
1757   shaders = (GLuint *) variable_data;
1758   variable_data += n * 1 * sizeof(GLuint);
1759   binary = (GLvoid *) variable_data;
1760   CALL_ShaderBinary(ctx->CurrentServerDispatch, (n, shaders, binaryformat, binary, length));
1761   return cmd->cmd_base.cmd_size;
1762}
1763void GLAPIENTRY
1764_mesa_marshal_ShaderBinary(GLsizei n, const GLuint * shaders, GLenum binaryformat, const GLvoid * binary, GLsizei length)
1765{
1766   GET_CURRENT_CONTEXT(ctx);
1767   int shaders_size = safe_mul(n, 1 * sizeof(GLuint));
1768   int binary_size = length;
1769   int cmd_size = sizeof(struct marshal_cmd_ShaderBinary) + shaders_size + binary_size;
1770   struct marshal_cmd_ShaderBinary *cmd;
1771   if (unlikely(shaders_size < 0 || (shaders_size > 0 && !shaders) || binary_size < 0 || (binary_size > 0 && !binary) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
1772      _mesa_glthread_finish_before(ctx, "ShaderBinary");
1773      CALL_ShaderBinary(ctx->CurrentServerDispatch, (n, shaders, binaryformat, binary, length));
1774      return;
1775   }
1776   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ShaderBinary, cmd_size);
1777   cmd->n = n;
1778   cmd->binaryformat = binaryformat;
1779   cmd->length = length;
1780   char *variable_data = (char *) (cmd + 1);
1781   memcpy(variable_data, shaders, shaders_size);
1782   variable_data += shaders_size;
1783   memcpy(variable_data, binary, binary_size);
1784}
1785
1786
1787/* ClearDepthf: marshalled asynchronously */
1788struct marshal_cmd_ClearDepthf
1789{
1790   struct marshal_cmd_base cmd_base;
1791   GLclampf depth;
1792};
1793uint32_t
1794_mesa_unmarshal_ClearDepthf(struct gl_context *ctx, const struct marshal_cmd_ClearDepthf *cmd, const uint64_t *last)
1795{
1796   GLclampf depth = cmd->depth;
1797   CALL_ClearDepthf(ctx->CurrentServerDispatch, (depth));
1798   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ClearDepthf), 8) / 8);
1799   assert (cmd_size == cmd->cmd_base.cmd_size);
1800   return cmd_size;
1801}
1802void GLAPIENTRY
1803_mesa_marshal_ClearDepthf(GLclampf depth)
1804{
1805   GET_CURRENT_CONTEXT(ctx);
1806   int cmd_size = sizeof(struct marshal_cmd_ClearDepthf);
1807   struct marshal_cmd_ClearDepthf *cmd;
1808   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ClearDepthf, cmd_size);
1809   cmd->depth = depth;
1810}
1811
1812
1813/* DepthRangef: marshalled asynchronously */
1814struct marshal_cmd_DepthRangef
1815{
1816   struct marshal_cmd_base cmd_base;
1817   GLclampf zNear;
1818   GLclampf zFar;
1819};
1820uint32_t
1821_mesa_unmarshal_DepthRangef(struct gl_context *ctx, const struct marshal_cmd_DepthRangef *cmd, const uint64_t *last)
1822{
1823   GLclampf zNear = cmd->zNear;
1824   GLclampf zFar = cmd->zFar;
1825   CALL_DepthRangef(ctx->CurrentServerDispatch, (zNear, zFar));
1826   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_DepthRangef), 8) / 8);
1827   assert (cmd_size == cmd->cmd_base.cmd_size);
1828   return cmd_size;
1829}
1830void GLAPIENTRY
1831_mesa_marshal_DepthRangef(GLclampf zNear, GLclampf zFar)
1832{
1833   GET_CURRENT_CONTEXT(ctx);
1834   int cmd_size = sizeof(struct marshal_cmd_DepthRangef);
1835   struct marshal_cmd_DepthRangef *cmd;
1836   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DepthRangef, cmd_size);
1837   cmd->zNear = zNear;
1838   cmd->zFar = zFar;
1839}
1840
1841
1842/* GetProgramBinary: marshalled synchronously */
1843void GLAPIENTRY
1844_mesa_marshal_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, GLvoid * binary)
1845{
1846   GET_CURRENT_CONTEXT(ctx);
1847   _mesa_glthread_finish_before(ctx, "GetProgramBinary");
1848   CALL_GetProgramBinary(ctx->CurrentServerDispatch, (program, bufSize, length, binaryFormat, binary));
1849}
1850
1851
1852/* ProgramBinary: marshalled asynchronously */
1853struct marshal_cmd_ProgramBinary
1854{
1855   struct marshal_cmd_base cmd_base;
1856   GLuint program;
1857   GLenum binaryFormat;
1858   GLsizei length;
1859   /* Next length bytes are GLvoid binary[length] */
1860};
1861uint32_t
1862_mesa_unmarshal_ProgramBinary(struct gl_context *ctx, const struct marshal_cmd_ProgramBinary *cmd, const uint64_t *last)
1863{
1864   GLuint program = cmd->program;
1865   GLenum binaryFormat = cmd->binaryFormat;
1866   GLsizei length = cmd->length;
1867   GLvoid * binary;
1868   const char *variable_data = (const char *) (cmd + 1);
1869   binary = (GLvoid *) variable_data;
1870   CALL_ProgramBinary(ctx->CurrentServerDispatch, (program, binaryFormat, binary, length));
1871   return cmd->cmd_base.cmd_size;
1872}
1873void GLAPIENTRY
1874_mesa_marshal_ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid * binary, GLsizei length)
1875{
1876   GET_CURRENT_CONTEXT(ctx);
1877   int binary_size = length;
1878   int cmd_size = sizeof(struct marshal_cmd_ProgramBinary) + binary_size;
1879   struct marshal_cmd_ProgramBinary *cmd;
1880   if (unlikely(binary_size < 0 || (binary_size > 0 && !binary) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
1881      _mesa_glthread_finish_before(ctx, "ProgramBinary");
1882      CALL_ProgramBinary(ctx->CurrentServerDispatch, (program, binaryFormat, binary, length));
1883      return;
1884   }
1885   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramBinary, cmd_size);
1886   cmd->program = program;
1887   cmd->binaryFormat = binaryFormat;
1888   cmd->length = length;
1889   char *variable_data = (char *) (cmd + 1);
1890   memcpy(variable_data, binary, binary_size);
1891}
1892
1893
1894/* ProgramParameteri: marshalled asynchronously */
1895struct marshal_cmd_ProgramParameteri
1896{
1897   struct marshal_cmd_base cmd_base;
1898   GLuint program;
1899   GLenum pname;
1900   GLint value;
1901};
1902uint32_t
1903_mesa_unmarshal_ProgramParameteri(struct gl_context *ctx, const struct marshal_cmd_ProgramParameteri *cmd, const uint64_t *last)
1904{
1905   GLuint program = cmd->program;
1906   GLenum pname = cmd->pname;
1907   GLint value = cmd->value;
1908   CALL_ProgramParameteri(ctx->CurrentServerDispatch, (program, pname, value));
1909   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ProgramParameteri), 8) / 8);
1910   assert (cmd_size == cmd->cmd_base.cmd_size);
1911   return cmd_size;
1912}
1913void GLAPIENTRY
1914_mesa_marshal_ProgramParameteri(GLuint program, GLenum pname, GLint value)
1915{
1916   GET_CURRENT_CONTEXT(ctx);
1917   int cmd_size = sizeof(struct marshal_cmd_ProgramParameteri);
1918   struct marshal_cmd_ProgramParameteri *cmd;
1919   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramParameteri, cmd_size);
1920   cmd->program = program;
1921   cmd->pname = pname;
1922   cmd->value = value;
1923}
1924
1925
1926/* DebugMessageControl: marshalled asynchronously */
1927struct marshal_cmd_DebugMessageControl
1928{
1929   struct marshal_cmd_base cmd_base;
1930   GLboolean enabled;
1931   GLenum source;
1932   GLenum type;
1933   GLenum severity;
1934   GLsizei count;
1935   /* Next safe_mul(count, 1 * sizeof(GLuint)) bytes are GLuint ids[count] */
1936};
1937uint32_t
1938_mesa_unmarshal_DebugMessageControl(struct gl_context *ctx, const struct marshal_cmd_DebugMessageControl *cmd, const uint64_t *last)
1939{
1940   GLenum source = cmd->source;
1941   GLenum type = cmd->type;
1942   GLenum severity = cmd->severity;
1943   GLsizei count = cmd->count;
1944   GLboolean enabled = cmd->enabled;
1945   GLuint * ids;
1946   const char *variable_data = (const char *) (cmd + 1);
1947   ids = (GLuint *) variable_data;
1948   CALL_DebugMessageControl(ctx->CurrentServerDispatch, (source, type, severity, count, ids, enabled));
1949   return cmd->cmd_base.cmd_size;
1950}
1951void GLAPIENTRY
1952_mesa_marshal_DebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled)
1953{
1954   GET_CURRENT_CONTEXT(ctx);
1955   int ids_size = safe_mul(count, 1 * sizeof(GLuint));
1956   int cmd_size = sizeof(struct marshal_cmd_DebugMessageControl) + ids_size;
1957   struct marshal_cmd_DebugMessageControl *cmd;
1958   if (unlikely(ids_size < 0 || (ids_size > 0 && !ids) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
1959      _mesa_glthread_finish_before(ctx, "DebugMessageControl");
1960      CALL_DebugMessageControl(ctx->CurrentServerDispatch, (source, type, severity, count, ids, enabled));
1961      return;
1962   }
1963   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DebugMessageControl, cmd_size);
1964   cmd->source = source;
1965   cmd->type = type;
1966   cmd->severity = severity;
1967   cmd->count = count;
1968   cmd->enabled = enabled;
1969   char *variable_data = (char *) (cmd + 1);
1970   memcpy(variable_data, ids, ids_size);
1971}
1972
1973
1974/* DebugMessageInsert: marshalled asynchronously */
1975struct marshal_cmd_DebugMessageInsert
1976{
1977   struct marshal_cmd_base cmd_base;
1978   GLenum source;
1979   GLenum type;
1980   GLuint id;
1981   GLenum severity;
1982   GLsizei length;
1983   /* Next length bytes are GLchar buf[length] */
1984};
1985uint32_t
1986_mesa_unmarshal_DebugMessageInsert(struct gl_context *ctx, const struct marshal_cmd_DebugMessageInsert *cmd, const uint64_t *last)
1987{
1988   GLenum source = cmd->source;
1989   GLenum type = cmd->type;
1990   GLuint id = cmd->id;
1991   GLenum severity = cmd->severity;
1992   GLsizei length = cmd->length;
1993   GLchar * buf;
1994   const char *variable_data = (const char *) (cmd + 1);
1995   buf = (GLchar *) variable_data;
1996   CALL_DebugMessageInsert(ctx->CurrentServerDispatch, (source, type, id, severity, length, buf));
1997   return cmd->cmd_base.cmd_size;
1998}
1999void GLAPIENTRY
2000_mesa_marshal_DebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf)
2001{
2002   GET_CURRENT_CONTEXT(ctx);
2003   int buf_size = length;
2004   int cmd_size = sizeof(struct marshal_cmd_DebugMessageInsert) + buf_size;
2005   struct marshal_cmd_DebugMessageInsert *cmd;
2006   if (unlikely(buf_size < 0 || (buf_size > 0 && !buf) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
2007      _mesa_glthread_finish_before(ctx, "DebugMessageInsert");
2008      CALL_DebugMessageInsert(ctx->CurrentServerDispatch, (source, type, id, severity, length, buf));
2009      return;
2010   }
2011   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DebugMessageInsert, cmd_size);
2012   cmd->source = source;
2013   cmd->type = type;
2014   cmd->id = id;
2015   cmd->severity = severity;
2016   cmd->length = length;
2017   char *variable_data = (char *) (cmd + 1);
2018   memcpy(variable_data, buf, buf_size);
2019}
2020
2021
2022/* DebugMessageCallback: marshalled synchronously */
2023void GLAPIENTRY
2024_mesa_marshal_DebugMessageCallback(GLDEBUGPROC callback, const GLvoid * userParam)
2025{
2026   GET_CURRENT_CONTEXT(ctx);
2027   _mesa_glthread_finish_before(ctx, "DebugMessageCallback");
2028   CALL_DebugMessageCallback(ctx->CurrentServerDispatch, (callback, userParam));
2029}
2030
2031
2032/* GetDebugMessageLog: marshalled synchronously */
2033GLuint GLAPIENTRY
2034_mesa_marshal_GetDebugMessageLog(GLuint count, GLsizei bufsize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLchar * messageLog)
2035{
2036   GET_CURRENT_CONTEXT(ctx);
2037   _mesa_glthread_finish_before(ctx, "GetDebugMessageLog");
2038   return CALL_GetDebugMessageLog(ctx->CurrentServerDispatch, (count, bufsize, sources, types, ids, severities, lengths, messageLog));
2039}
2040
2041
2042/* GetGraphicsResetStatusARB: marshalled synchronously */
2043GLenum GLAPIENTRY
2044_mesa_marshal_GetGraphicsResetStatusARB(void)
2045{
2046   GET_CURRENT_CONTEXT(ctx);
2047   _mesa_glthread_finish_before(ctx, "GetGraphicsResetStatusARB");
2048   return CALL_GetGraphicsResetStatusARB(ctx->CurrentServerDispatch, ());
2049}
2050
2051
2052/* GetnMapdvARB: marshalled synchronously */
2053void GLAPIENTRY
2054_mesa_marshal_GetnMapdvARB(GLenum target, GLenum query, GLsizei bufSize, GLdouble * v)
2055{
2056   GET_CURRENT_CONTEXT(ctx);
2057   _mesa_glthread_finish_before(ctx, "GetnMapdvARB");
2058   CALL_GetnMapdvARB(ctx->CurrentServerDispatch, (target, query, bufSize, v));
2059}
2060
2061
2062/* GetnMapfvARB: marshalled synchronously */
2063void GLAPIENTRY
2064_mesa_marshal_GetnMapfvARB(GLenum target, GLenum query, GLsizei bufSize, GLfloat * v)
2065{
2066   GET_CURRENT_CONTEXT(ctx);
2067   _mesa_glthread_finish_before(ctx, "GetnMapfvARB");
2068   CALL_GetnMapfvARB(ctx->CurrentServerDispatch, (target, query, bufSize, v));
2069}
2070
2071
2072/* GetnMapivARB: marshalled synchronously */
2073void GLAPIENTRY
2074_mesa_marshal_GetnMapivARB(GLenum target, GLenum query, GLsizei bufSize, GLint * v)
2075{
2076   GET_CURRENT_CONTEXT(ctx);
2077   _mesa_glthread_finish_before(ctx, "GetnMapivARB");
2078   CALL_GetnMapivARB(ctx->CurrentServerDispatch, (target, query, bufSize, v));
2079}
2080
2081
2082/* GetnPixelMapfvARB: marshalled synchronously */
2083void GLAPIENTRY
2084_mesa_marshal_GetnPixelMapfvARB(GLenum map, GLsizei bufSize, GLfloat * values)
2085{
2086   GET_CURRENT_CONTEXT(ctx);
2087   _mesa_glthread_finish_before(ctx, "GetnPixelMapfvARB");
2088   CALL_GetnPixelMapfvARB(ctx->CurrentServerDispatch, (map, bufSize, values));
2089}
2090
2091
2092/* GetnPixelMapuivARB: marshalled synchronously */
2093void GLAPIENTRY
2094_mesa_marshal_GetnPixelMapuivARB(GLenum map, GLsizei bufSize, GLuint * values)
2095{
2096   GET_CURRENT_CONTEXT(ctx);
2097   _mesa_glthread_finish_before(ctx, "GetnPixelMapuivARB");
2098   CALL_GetnPixelMapuivARB(ctx->CurrentServerDispatch, (map, bufSize, values));
2099}
2100
2101
2102/* GetnPixelMapusvARB: marshalled synchronously */
2103void GLAPIENTRY
2104_mesa_marshal_GetnPixelMapusvARB(GLenum map, GLsizei bufSize, GLushort * values)
2105{
2106   GET_CURRENT_CONTEXT(ctx);
2107   _mesa_glthread_finish_before(ctx, "GetnPixelMapusvARB");
2108   CALL_GetnPixelMapusvARB(ctx->CurrentServerDispatch, (map, bufSize, values));
2109}
2110
2111
2112/* GetnPolygonStippleARB: marshalled asynchronously */
2113struct marshal_cmd_GetnPolygonStippleARB
2114{
2115   struct marshal_cmd_base cmd_base;
2116   GLsizei bufSize;
2117   GLubyte * pattern;
2118};
2119uint32_t
2120_mesa_unmarshal_GetnPolygonStippleARB(struct gl_context *ctx, const struct marshal_cmd_GetnPolygonStippleARB *cmd, const uint64_t *last)
2121{
2122   GLsizei bufSize = cmd->bufSize;
2123   GLubyte * pattern = cmd->pattern;
2124   CALL_GetnPolygonStippleARB(ctx->CurrentServerDispatch, (bufSize, pattern));
2125   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_GetnPolygonStippleARB), 8) / 8);
2126   assert (cmd_size == cmd->cmd_base.cmd_size);
2127   return cmd_size;
2128}
2129void GLAPIENTRY
2130_mesa_marshal_GetnPolygonStippleARB(GLsizei bufSize, GLubyte * pattern)
2131{
2132   GET_CURRENT_CONTEXT(ctx);
2133   int cmd_size = sizeof(struct marshal_cmd_GetnPolygonStippleARB);
2134   struct marshal_cmd_GetnPolygonStippleARB *cmd;
2135   if (_mesa_glthread_has_no_pack_buffer(ctx)) {
2136      _mesa_glthread_finish_before(ctx, "GetnPolygonStippleARB");
2137      CALL_GetnPolygonStippleARB(ctx->CurrentServerDispatch, (bufSize, pattern));
2138      return;
2139   }
2140   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_GetnPolygonStippleARB, cmd_size);
2141   cmd->bufSize = bufSize;
2142   cmd->pattern = pattern;
2143}
2144
2145
2146/* GetnTexImageARB: marshalled asynchronously */
2147struct marshal_cmd_GetnTexImageARB
2148{
2149   struct marshal_cmd_base cmd_base;
2150   GLenum target;
2151   GLint level;
2152   GLenum format;
2153   GLenum type;
2154   GLsizei bufSize;
2155   GLvoid * img;
2156};
2157uint32_t
2158_mesa_unmarshal_GetnTexImageARB(struct gl_context *ctx, const struct marshal_cmd_GetnTexImageARB *cmd, const uint64_t *last)
2159{
2160   GLenum target = cmd->target;
2161   GLint level = cmd->level;
2162   GLenum format = cmd->format;
2163   GLenum type = cmd->type;
2164   GLsizei bufSize = cmd->bufSize;
2165   GLvoid * img = cmd->img;
2166   CALL_GetnTexImageARB(ctx->CurrentServerDispatch, (target, level, format, type, bufSize, img));
2167   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_GetnTexImageARB), 8) / 8);
2168   assert (cmd_size == cmd->cmd_base.cmd_size);
2169   return cmd_size;
2170}
2171void GLAPIENTRY
2172_mesa_marshal_GetnTexImageARB(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid * img)
2173{
2174   GET_CURRENT_CONTEXT(ctx);
2175   int cmd_size = sizeof(struct marshal_cmd_GetnTexImageARB);
2176   struct marshal_cmd_GetnTexImageARB *cmd;
2177   if (_mesa_glthread_has_no_pack_buffer(ctx)) {
2178      _mesa_glthread_finish_before(ctx, "GetnTexImageARB");
2179      CALL_GetnTexImageARB(ctx->CurrentServerDispatch, (target, level, format, type, bufSize, img));
2180      return;
2181   }
2182   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_GetnTexImageARB, cmd_size);
2183   cmd->target = target;
2184   cmd->level = level;
2185   cmd->format = format;
2186   cmd->type = type;
2187   cmd->bufSize = bufSize;
2188   cmd->img = img;
2189}
2190
2191
2192/* ReadnPixelsARB: marshalled asynchronously */
2193struct marshal_cmd_ReadnPixelsARB
2194{
2195   struct marshal_cmd_base cmd_base;
2196   GLint x;
2197   GLint y;
2198   GLsizei width;
2199   GLsizei height;
2200   GLenum format;
2201   GLenum type;
2202   GLsizei bufSize;
2203   GLvoid * data;
2204};
2205uint32_t
2206_mesa_unmarshal_ReadnPixelsARB(struct gl_context *ctx, const struct marshal_cmd_ReadnPixelsARB *cmd, const uint64_t *last)
2207{
2208   GLint x = cmd->x;
2209   GLint y = cmd->y;
2210   GLsizei width = cmd->width;
2211   GLsizei height = cmd->height;
2212   GLenum format = cmd->format;
2213   GLenum type = cmd->type;
2214   GLsizei bufSize = cmd->bufSize;
2215   GLvoid * data = cmd->data;
2216   CALL_ReadnPixelsARB(ctx->CurrentServerDispatch, (x, y, width, height, format, type, bufSize, data));
2217   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ReadnPixelsARB), 8) / 8);
2218   assert (cmd_size == cmd->cmd_base.cmd_size);
2219   return cmd_size;
2220}
2221void GLAPIENTRY
2222_mesa_marshal_ReadnPixelsARB(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid * data)
2223{
2224   GET_CURRENT_CONTEXT(ctx);
2225   int cmd_size = sizeof(struct marshal_cmd_ReadnPixelsARB);
2226   struct marshal_cmd_ReadnPixelsARB *cmd;
2227   if (_mesa_glthread_has_no_pack_buffer(ctx)) {
2228      _mesa_glthread_finish_before(ctx, "ReadnPixelsARB");
2229      CALL_ReadnPixelsARB(ctx->CurrentServerDispatch, (x, y, width, height, format, type, bufSize, data));
2230      return;
2231   }
2232   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ReadnPixelsARB, cmd_size);
2233   cmd->x = x;
2234   cmd->y = y;
2235   cmd->width = width;
2236   cmd->height = height;
2237   cmd->format = format;
2238   cmd->type = type;
2239   cmd->bufSize = bufSize;
2240   cmd->data = data;
2241}
2242
2243
2244/* GetnColorTableARB: marshalled synchronously */
2245void GLAPIENTRY
2246_mesa_marshal_GetnColorTableARB(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid * table)
2247{
2248   GET_CURRENT_CONTEXT(ctx);
2249   _mesa_glthread_finish_before(ctx, "GetnColorTableARB");
2250   CALL_GetnColorTableARB(ctx->CurrentServerDispatch, (target, format, type, bufSize, table));
2251}
2252
2253
2254/* GetnConvolutionFilterARB: marshalled synchronously */
2255void GLAPIENTRY
2256_mesa_marshal_GetnConvolutionFilterARB(GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid * image)
2257{
2258   GET_CURRENT_CONTEXT(ctx);
2259   _mesa_glthread_finish_before(ctx, "GetnConvolutionFilterARB");
2260   CALL_GetnConvolutionFilterARB(ctx->CurrentServerDispatch, (target, format, type, bufSize, image));
2261}
2262
2263
2264/* GetnSeparableFilterARB: marshalled synchronously */
2265void GLAPIENTRY
2266_mesa_marshal_GetnSeparableFilterARB(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid * row, GLsizei columnBufSize, GLvoid * column, GLvoid * span)
2267{
2268   GET_CURRENT_CONTEXT(ctx);
2269   _mesa_glthread_finish_before(ctx, "GetnSeparableFilterARB");
2270   CALL_GetnSeparableFilterARB(ctx->CurrentServerDispatch, (target, format, type, rowBufSize, row, columnBufSize, column, span));
2271}
2272
2273
2274/* GetnHistogramARB: marshalled synchronously */
2275void GLAPIENTRY
2276_mesa_marshal_GetnHistogramARB(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid * values)
2277{
2278   GET_CURRENT_CONTEXT(ctx);
2279   _mesa_glthread_finish_before(ctx, "GetnHistogramARB");
2280   CALL_GetnHistogramARB(ctx->CurrentServerDispatch, (target, reset, format, type, bufSize, values));
2281}
2282
2283
2284/* GetnMinmaxARB: marshalled synchronously */
2285void GLAPIENTRY
2286_mesa_marshal_GetnMinmaxARB(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid * values)
2287{
2288   GET_CURRENT_CONTEXT(ctx);
2289   _mesa_glthread_finish_before(ctx, "GetnMinmaxARB");
2290   CALL_GetnMinmaxARB(ctx->CurrentServerDispatch, (target, reset, format, type, bufSize, values));
2291}
2292
2293
2294/* GetnCompressedTexImageARB: marshalled asynchronously */
2295struct marshal_cmd_GetnCompressedTexImageARB
2296{
2297   struct marshal_cmd_base cmd_base;
2298   GLenum target;
2299   GLint lod;
2300   GLsizei bufSize;
2301   GLvoid * img;
2302};
2303uint32_t
2304_mesa_unmarshal_GetnCompressedTexImageARB(struct gl_context *ctx, const struct marshal_cmd_GetnCompressedTexImageARB *cmd, const uint64_t *last)
2305{
2306   GLenum target = cmd->target;
2307   GLint lod = cmd->lod;
2308   GLsizei bufSize = cmd->bufSize;
2309   GLvoid * img = cmd->img;
2310   CALL_GetnCompressedTexImageARB(ctx->CurrentServerDispatch, (target, lod, bufSize, img));
2311   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_GetnCompressedTexImageARB), 8) / 8);
2312   assert (cmd_size == cmd->cmd_base.cmd_size);
2313   return cmd_size;
2314}
2315void GLAPIENTRY
2316_mesa_marshal_GetnCompressedTexImageARB(GLenum target, GLint lod, GLsizei bufSize, GLvoid * img)
2317{
2318   GET_CURRENT_CONTEXT(ctx);
2319   int cmd_size = sizeof(struct marshal_cmd_GetnCompressedTexImageARB);
2320   struct marshal_cmd_GetnCompressedTexImageARB *cmd;
2321   if (_mesa_glthread_has_no_pack_buffer(ctx)) {
2322      _mesa_glthread_finish_before(ctx, "GetnCompressedTexImageARB");
2323      CALL_GetnCompressedTexImageARB(ctx->CurrentServerDispatch, (target, lod, bufSize, img));
2324      return;
2325   }
2326   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_GetnCompressedTexImageARB, cmd_size);
2327   cmd->target = target;
2328   cmd->lod = lod;
2329   cmd->bufSize = bufSize;
2330   cmd->img = img;
2331}
2332
2333
2334/* GetnUniformfvARB: marshalled synchronously */
2335void GLAPIENTRY
2336_mesa_marshal_GetnUniformfvARB(GLuint program, GLint location, GLsizei bufSize, GLfloat * params)
2337{
2338   GET_CURRENT_CONTEXT(ctx);
2339   _mesa_glthread_finish_before(ctx, "GetnUniformfvARB");
2340   CALL_GetnUniformfvARB(ctx->CurrentServerDispatch, (program, location, bufSize, params));
2341}
2342
2343
2344/* GetnUniformivARB: marshalled synchronously */
2345void GLAPIENTRY
2346_mesa_marshal_GetnUniformivARB(GLuint program, GLint location, GLsizei bufSize, GLint * params)
2347{
2348   GET_CURRENT_CONTEXT(ctx);
2349   _mesa_glthread_finish_before(ctx, "GetnUniformivARB");
2350   CALL_GetnUniformivARB(ctx->CurrentServerDispatch, (program, location, bufSize, params));
2351}
2352
2353
2354/* GetnUniformuivARB: marshalled synchronously */
2355void GLAPIENTRY
2356_mesa_marshal_GetnUniformuivARB(GLuint program, GLint location, GLsizei bufSize, GLuint * params)
2357{
2358   GET_CURRENT_CONTEXT(ctx);
2359   _mesa_glthread_finish_before(ctx, "GetnUniformuivARB");
2360   CALL_GetnUniformuivARB(ctx->CurrentServerDispatch, (program, location, bufSize, params));
2361}
2362
2363
2364/* GetnUniformdvARB: marshalled synchronously */
2365void GLAPIENTRY
2366_mesa_marshal_GetnUniformdvARB(GLuint program, GLint location, GLsizei bufSize, GLdouble * params)
2367{
2368   GET_CURRENT_CONTEXT(ctx);
2369   _mesa_glthread_finish_before(ctx, "GetnUniformdvARB");
2370   CALL_GetnUniformdvARB(ctx->CurrentServerDispatch, (program, location, bufSize, params));
2371}
2372
2373
2374/* DrawTransformFeedbackInstanced: marshalled asynchronously */
2375struct marshal_cmd_DrawTransformFeedbackInstanced
2376{
2377   struct marshal_cmd_base cmd_base;
2378   GLenum mode;
2379   GLuint id;
2380   GLsizei primcount;
2381};
2382uint32_t
2383_mesa_unmarshal_DrawTransformFeedbackInstanced(struct gl_context *ctx, const struct marshal_cmd_DrawTransformFeedbackInstanced *cmd, const uint64_t *last)
2384{
2385   GLenum mode = cmd->mode;
2386   GLuint id = cmd->id;
2387   GLsizei primcount = cmd->primcount;
2388   CALL_DrawTransformFeedbackInstanced(ctx->CurrentServerDispatch, (mode, id, primcount));
2389   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_DrawTransformFeedbackInstanced), 8) / 8);
2390   assert (cmd_size == cmd->cmd_base.cmd_size);
2391   return cmd_size;
2392}
2393void GLAPIENTRY
2394_mesa_marshal_DrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei primcount)
2395{
2396   GET_CURRENT_CONTEXT(ctx);
2397   int cmd_size = sizeof(struct marshal_cmd_DrawTransformFeedbackInstanced);
2398   struct marshal_cmd_DrawTransformFeedbackInstanced *cmd;
2399   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DrawTransformFeedbackInstanced, cmd_size);
2400   cmd->mode = mode;
2401   cmd->id = id;
2402   cmd->primcount = primcount;
2403}
2404
2405
2406/* DrawTransformFeedbackStreamInstanced: marshalled asynchronously */
2407struct marshal_cmd_DrawTransformFeedbackStreamInstanced
2408{
2409   struct marshal_cmd_base cmd_base;
2410   GLenum mode;
2411   GLuint id;
2412   GLuint stream;
2413   GLsizei primcount;
2414};
2415uint32_t
2416_mesa_unmarshal_DrawTransformFeedbackStreamInstanced(struct gl_context *ctx, const struct marshal_cmd_DrawTransformFeedbackStreamInstanced *cmd, const uint64_t *last)
2417{
2418   GLenum mode = cmd->mode;
2419   GLuint id = cmd->id;
2420   GLuint stream = cmd->stream;
2421   GLsizei primcount = cmd->primcount;
2422   CALL_DrawTransformFeedbackStreamInstanced(ctx->CurrentServerDispatch, (mode, id, stream, primcount));
2423   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_DrawTransformFeedbackStreamInstanced), 8) / 8);
2424   assert (cmd_size == cmd->cmd_base.cmd_size);
2425   return cmd_size;
2426}
2427void GLAPIENTRY
2428_mesa_marshal_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei primcount)
2429{
2430   GET_CURRENT_CONTEXT(ctx);
2431   int cmd_size = sizeof(struct marshal_cmd_DrawTransformFeedbackStreamInstanced);
2432   struct marshal_cmd_DrawTransformFeedbackStreamInstanced *cmd;
2433   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DrawTransformFeedbackStreamInstanced, cmd_size);
2434   cmd->mode = mode;
2435   cmd->id = id;
2436   cmd->stream = stream;
2437   cmd->primcount = primcount;
2438}
2439
2440
2441/* GetInternalformativ: marshalled synchronously */
2442void GLAPIENTRY
2443_mesa_marshal_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint * params)
2444{
2445   GET_CURRENT_CONTEXT(ctx);
2446   _mesa_glthread_finish_before(ctx, "GetInternalformativ");
2447   CALL_GetInternalformativ(ctx->CurrentServerDispatch, (target, internalformat, pname, bufSize, params));
2448}
2449
2450
2451/* GetActiveAtomicCounterBufferiv: marshalled synchronously */
2452void GLAPIENTRY
2453_mesa_marshal_GetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint * params)
2454{
2455   GET_CURRENT_CONTEXT(ctx);
2456   _mesa_glthread_finish_before(ctx, "GetActiveAtomicCounterBufferiv");
2457   CALL_GetActiveAtomicCounterBufferiv(ctx->CurrentServerDispatch, (program, bufferIndex, pname, params));
2458}
2459
2460
2461/* BindImageTexture: marshalled asynchronously */
2462struct marshal_cmd_BindImageTexture
2463{
2464   struct marshal_cmd_base cmd_base;
2465   GLboolean layered;
2466   GLuint unit;
2467   GLuint texture;
2468   GLint level;
2469   GLint layer;
2470   GLenum access;
2471   GLenum format;
2472};
2473uint32_t
2474_mesa_unmarshal_BindImageTexture(struct gl_context *ctx, const struct marshal_cmd_BindImageTexture *cmd, const uint64_t *last)
2475{
2476   GLuint unit = cmd->unit;
2477   GLuint texture = cmd->texture;
2478   GLint level = cmd->level;
2479   GLboolean layered = cmd->layered;
2480   GLint layer = cmd->layer;
2481   GLenum access = cmd->access;
2482   GLenum format = cmd->format;
2483   CALL_BindImageTexture(ctx->CurrentServerDispatch, (unit, texture, level, layered, layer, access, format));
2484   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_BindImageTexture), 8) / 8);
2485   assert (cmd_size == cmd->cmd_base.cmd_size);
2486   return cmd_size;
2487}
2488void GLAPIENTRY
2489_mesa_marshal_BindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
2490{
2491   GET_CURRENT_CONTEXT(ctx);
2492   int cmd_size = sizeof(struct marshal_cmd_BindImageTexture);
2493   struct marshal_cmd_BindImageTexture *cmd;
2494   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_BindImageTexture, cmd_size);
2495   cmd->unit = unit;
2496   cmd->texture = texture;
2497   cmd->level = level;
2498   cmd->layered = layered;
2499   cmd->layer = layer;
2500   cmd->access = access;
2501   cmd->format = format;
2502}
2503
2504
2505/* MemoryBarrier: marshalled asynchronously */
2506struct marshal_cmd_MemoryBarrier
2507{
2508   struct marshal_cmd_base cmd_base;
2509   GLbitfield barriers;
2510};
2511uint32_t
2512_mesa_unmarshal_MemoryBarrier(struct gl_context *ctx, const struct marshal_cmd_MemoryBarrier *cmd, const uint64_t *last)
2513{
2514   GLbitfield barriers = cmd->barriers;
2515   CALL_MemoryBarrier(ctx->CurrentServerDispatch, (barriers));
2516   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_MemoryBarrier), 8) / 8);
2517   assert (cmd_size == cmd->cmd_base.cmd_size);
2518   return cmd_size;
2519}
2520void GLAPIENTRY
2521_mesa_marshal_MemoryBarrier(GLbitfield barriers)
2522{
2523   GET_CURRENT_CONTEXT(ctx);
2524   int cmd_size = sizeof(struct marshal_cmd_MemoryBarrier);
2525   struct marshal_cmd_MemoryBarrier *cmd;
2526   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_MemoryBarrier, cmd_size);
2527   cmd->barriers = barriers;
2528}
2529
2530
2531/* TexStorage1D: marshalled asynchronously */
2532struct marshal_cmd_TexStorage1D
2533{
2534   struct marshal_cmd_base cmd_base;
2535   GLenum target;
2536   GLsizei levels;
2537   GLenum internalFormat;
2538   GLsizei width;
2539};
2540uint32_t
2541_mesa_unmarshal_TexStorage1D(struct gl_context *ctx, const struct marshal_cmd_TexStorage1D *cmd, const uint64_t *last)
2542{
2543   GLenum target = cmd->target;
2544   GLsizei levels = cmd->levels;
2545   GLenum internalFormat = cmd->internalFormat;
2546   GLsizei width = cmd->width;
2547   CALL_TexStorage1D(ctx->CurrentServerDispatch, (target, levels, internalFormat, width));
2548   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TexStorage1D), 8) / 8);
2549   assert (cmd_size == cmd->cmd_base.cmd_size);
2550   return cmd_size;
2551}
2552void GLAPIENTRY
2553_mesa_marshal_TexStorage1D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width)
2554{
2555   GET_CURRENT_CONTEXT(ctx);
2556   int cmd_size = sizeof(struct marshal_cmd_TexStorage1D);
2557   struct marshal_cmd_TexStorage1D *cmd;
2558   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TexStorage1D, cmd_size);
2559   cmd->target = target;
2560   cmd->levels = levels;
2561   cmd->internalFormat = internalFormat;
2562   cmd->width = width;
2563}
2564
2565
2566/* TexStorage2D: marshalled asynchronously */
2567struct marshal_cmd_TexStorage2D
2568{
2569   struct marshal_cmd_base cmd_base;
2570   GLenum target;
2571   GLsizei levels;
2572   GLenum internalFormat;
2573   GLsizei width;
2574   GLsizei height;
2575};
2576uint32_t
2577_mesa_unmarshal_TexStorage2D(struct gl_context *ctx, const struct marshal_cmd_TexStorage2D *cmd, const uint64_t *last)
2578{
2579   GLenum target = cmd->target;
2580   GLsizei levels = cmd->levels;
2581   GLenum internalFormat = cmd->internalFormat;
2582   GLsizei width = cmd->width;
2583   GLsizei height = cmd->height;
2584   CALL_TexStorage2D(ctx->CurrentServerDispatch, (target, levels, internalFormat, width, height));
2585   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TexStorage2D), 8) / 8);
2586   assert (cmd_size == cmd->cmd_base.cmd_size);
2587   return cmd_size;
2588}
2589void GLAPIENTRY
2590_mesa_marshal_TexStorage2D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height)
2591{
2592   GET_CURRENT_CONTEXT(ctx);
2593   int cmd_size = sizeof(struct marshal_cmd_TexStorage2D);
2594   struct marshal_cmd_TexStorage2D *cmd;
2595   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TexStorage2D, cmd_size);
2596   cmd->target = target;
2597   cmd->levels = levels;
2598   cmd->internalFormat = internalFormat;
2599   cmd->width = width;
2600   cmd->height = height;
2601}
2602
2603
2604/* TexStorage3D: marshalled asynchronously */
2605struct marshal_cmd_TexStorage3D
2606{
2607   struct marshal_cmd_base cmd_base;
2608   GLenum target;
2609   GLsizei levels;
2610   GLenum internalFormat;
2611   GLsizei width;
2612   GLsizei height;
2613   GLsizei depth;
2614};
2615uint32_t
2616_mesa_unmarshal_TexStorage3D(struct gl_context *ctx, const struct marshal_cmd_TexStorage3D *cmd, const uint64_t *last)
2617{
2618   GLenum target = cmd->target;
2619   GLsizei levels = cmd->levels;
2620   GLenum internalFormat = cmd->internalFormat;
2621   GLsizei width = cmd->width;
2622   GLsizei height = cmd->height;
2623   GLsizei depth = cmd->depth;
2624   CALL_TexStorage3D(ctx->CurrentServerDispatch, (target, levels, internalFormat, width, height, depth));
2625   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TexStorage3D), 8) / 8);
2626   assert (cmd_size == cmd->cmd_base.cmd_size);
2627   return cmd_size;
2628}
2629void GLAPIENTRY
2630_mesa_marshal_TexStorage3D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth)
2631{
2632   GET_CURRENT_CONTEXT(ctx);
2633   int cmd_size = sizeof(struct marshal_cmd_TexStorage3D);
2634   struct marshal_cmd_TexStorage3D *cmd;
2635   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TexStorage3D, cmd_size);
2636   cmd->target = target;
2637   cmd->levels = levels;
2638   cmd->internalFormat = internalFormat;
2639   cmd->width = width;
2640   cmd->height = height;
2641   cmd->depth = depth;
2642}
2643
2644
2645/* TextureStorage1DEXT: marshalled asynchronously */
2646struct marshal_cmd_TextureStorage1DEXT
2647{
2648   struct marshal_cmd_base cmd_base;
2649   GLuint texture;
2650   GLenum target;
2651   GLsizei levels;
2652   GLenum internalFormat;
2653   GLsizei width;
2654};
2655uint32_t
2656_mesa_unmarshal_TextureStorage1DEXT(struct gl_context *ctx, const struct marshal_cmd_TextureStorage1DEXT *cmd, const uint64_t *last)
2657{
2658   GLuint texture = cmd->texture;
2659   GLenum target = cmd->target;
2660   GLsizei levels = cmd->levels;
2661   GLenum internalFormat = cmd->internalFormat;
2662   GLsizei width = cmd->width;
2663   CALL_TextureStorage1DEXT(ctx->CurrentServerDispatch, (texture, target, levels, internalFormat, width));
2664   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureStorage1DEXT), 8) / 8);
2665   assert (cmd_size == cmd->cmd_base.cmd_size);
2666   return cmd_size;
2667}
2668void GLAPIENTRY
2669_mesa_marshal_TextureStorage1DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width)
2670{
2671   GET_CURRENT_CONTEXT(ctx);
2672   int cmd_size = sizeof(struct marshal_cmd_TextureStorage1DEXT);
2673   struct marshal_cmd_TextureStorage1DEXT *cmd;
2674   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureStorage1DEXT, cmd_size);
2675   cmd->texture = texture;
2676   cmd->target = target;
2677   cmd->levels = levels;
2678   cmd->internalFormat = internalFormat;
2679   cmd->width = width;
2680}
2681
2682
2683/* TextureStorage2DEXT: marshalled asynchronously */
2684struct marshal_cmd_TextureStorage2DEXT
2685{
2686   struct marshal_cmd_base cmd_base;
2687   GLuint texture;
2688   GLenum target;
2689   GLsizei levels;
2690   GLenum internalFormat;
2691   GLsizei width;
2692   GLsizei height;
2693};
2694uint32_t
2695_mesa_unmarshal_TextureStorage2DEXT(struct gl_context *ctx, const struct marshal_cmd_TextureStorage2DEXT *cmd, const uint64_t *last)
2696{
2697   GLuint texture = cmd->texture;
2698   GLenum target = cmd->target;
2699   GLsizei levels = cmd->levels;
2700   GLenum internalFormat = cmd->internalFormat;
2701   GLsizei width = cmd->width;
2702   GLsizei height = cmd->height;
2703   CALL_TextureStorage2DEXT(ctx->CurrentServerDispatch, (texture, target, levels, internalFormat, width, height));
2704   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureStorage2DEXT), 8) / 8);
2705   assert (cmd_size == cmd->cmd_base.cmd_size);
2706   return cmd_size;
2707}
2708void GLAPIENTRY
2709_mesa_marshal_TextureStorage2DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height)
2710{
2711   GET_CURRENT_CONTEXT(ctx);
2712   int cmd_size = sizeof(struct marshal_cmd_TextureStorage2DEXT);
2713   struct marshal_cmd_TextureStorage2DEXT *cmd;
2714   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureStorage2DEXT, cmd_size);
2715   cmd->texture = texture;
2716   cmd->target = target;
2717   cmd->levels = levels;
2718   cmd->internalFormat = internalFormat;
2719   cmd->width = width;
2720   cmd->height = height;
2721}
2722
2723
2724/* TextureStorage3DEXT: marshalled asynchronously */
2725struct marshal_cmd_TextureStorage3DEXT
2726{
2727   struct marshal_cmd_base cmd_base;
2728   GLuint texture;
2729   GLenum target;
2730   GLsizei levels;
2731   GLenum internalFormat;
2732   GLsizei width;
2733   GLsizei height;
2734   GLsizei depth;
2735};
2736uint32_t
2737_mesa_unmarshal_TextureStorage3DEXT(struct gl_context *ctx, const struct marshal_cmd_TextureStorage3DEXT *cmd, const uint64_t *last)
2738{
2739   GLuint texture = cmd->texture;
2740   GLenum target = cmd->target;
2741   GLsizei levels = cmd->levels;
2742   GLenum internalFormat = cmd->internalFormat;
2743   GLsizei width = cmd->width;
2744   GLsizei height = cmd->height;
2745   GLsizei depth = cmd->depth;
2746   CALL_TextureStorage3DEXT(ctx->CurrentServerDispatch, (texture, target, levels, internalFormat, width, height, depth));
2747   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureStorage3DEXT), 8) / 8);
2748   assert (cmd_size == cmd->cmd_base.cmd_size);
2749   return cmd_size;
2750}
2751void GLAPIENTRY
2752_mesa_marshal_TextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth)
2753{
2754   GET_CURRENT_CONTEXT(ctx);
2755   int cmd_size = sizeof(struct marshal_cmd_TextureStorage3DEXT);
2756   struct marshal_cmd_TextureStorage3DEXT *cmd;
2757   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureStorage3DEXT, cmd_size);
2758   cmd->texture = texture;
2759   cmd->target = target;
2760   cmd->levels = levels;
2761   cmd->internalFormat = internalFormat;
2762   cmd->width = width;
2763   cmd->height = height;
2764   cmd->depth = depth;
2765}
2766
2767
2768/* PushDebugGroup: marshalled asynchronously */
2769struct marshal_cmd_PushDebugGroup
2770{
2771   struct marshal_cmd_base cmd_base;
2772   GLenum source;
2773   GLuint id;
2774   GLsizei length;
2775   /* Next length bytes are GLchar message[length] */
2776};
2777uint32_t
2778_mesa_unmarshal_PushDebugGroup(struct gl_context *ctx, const struct marshal_cmd_PushDebugGroup *cmd, const uint64_t *last)
2779{
2780   GLenum source = cmd->source;
2781   GLuint id = cmd->id;
2782   GLsizei length = cmd->length;
2783   GLchar * message;
2784   const char *variable_data = (const char *) (cmd + 1);
2785   message = (GLchar *) variable_data;
2786   CALL_PushDebugGroup(ctx->CurrentServerDispatch, (source, id, length, message));
2787   return cmd->cmd_base.cmd_size;
2788}
2789void GLAPIENTRY
2790_mesa_marshal_PushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar * message)
2791{
2792   GET_CURRENT_CONTEXT(ctx);
2793   int message_size = length;
2794   int cmd_size = sizeof(struct marshal_cmd_PushDebugGroup) + message_size;
2795   struct marshal_cmd_PushDebugGroup *cmd;
2796   if (unlikely(message_size < 0 || (message_size > 0 && !message) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
2797      _mesa_glthread_finish_before(ctx, "PushDebugGroup");
2798      CALL_PushDebugGroup(ctx->CurrentServerDispatch, (source, id, length, message));
2799      return;
2800   }
2801   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_PushDebugGroup, cmd_size);
2802   cmd->source = source;
2803   cmd->id = id;
2804   cmd->length = length;
2805   char *variable_data = (char *) (cmd + 1);
2806   memcpy(variable_data, message, message_size);
2807}
2808
2809
2810/* PopDebugGroup: marshalled asynchronously */
2811struct marshal_cmd_PopDebugGroup
2812{
2813   struct marshal_cmd_base cmd_base;
2814};
2815uint32_t
2816_mesa_unmarshal_PopDebugGroup(struct gl_context *ctx, const struct marshal_cmd_PopDebugGroup *cmd, const uint64_t *last)
2817{
2818   CALL_PopDebugGroup(ctx->CurrentServerDispatch, ());
2819   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_PopDebugGroup), 8) / 8);
2820   assert (cmd_size == cmd->cmd_base.cmd_size);
2821   return cmd_size;
2822}
2823void GLAPIENTRY
2824_mesa_marshal_PopDebugGroup(void)
2825{
2826   GET_CURRENT_CONTEXT(ctx);
2827   int cmd_size = sizeof(struct marshal_cmd_PopDebugGroup);
2828   struct marshal_cmd_PopDebugGroup *cmd;
2829   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_PopDebugGroup, cmd_size);
2830   (void) cmd;
2831}
2832
2833
2834/* ObjectLabel: marshalled asynchronously */
2835struct marshal_cmd_ObjectLabel
2836{
2837   struct marshal_cmd_base cmd_base;
2838   GLenum identifier;
2839   GLuint name;
2840   GLsizei length;
2841   /* Next length bytes are GLchar label[length] */
2842};
2843uint32_t
2844_mesa_unmarshal_ObjectLabel(struct gl_context *ctx, const struct marshal_cmd_ObjectLabel *cmd, const uint64_t *last)
2845{
2846   GLenum identifier = cmd->identifier;
2847   GLuint name = cmd->name;
2848   GLsizei length = cmd->length;
2849   GLchar * label;
2850   const char *variable_data = (const char *) (cmd + 1);
2851   label = (GLchar *) variable_data;
2852   CALL_ObjectLabel(ctx->CurrentServerDispatch, (identifier, name, length, label));
2853   return cmd->cmd_base.cmd_size;
2854}
2855void GLAPIENTRY
2856_mesa_marshal_ObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar * label)
2857{
2858   GET_CURRENT_CONTEXT(ctx);
2859   int label_size = length;
2860   int cmd_size = sizeof(struct marshal_cmd_ObjectLabel) + label_size;
2861   struct marshal_cmd_ObjectLabel *cmd;
2862   if (unlikely(label_size < 0 || (label_size > 0 && !label) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
2863      _mesa_glthread_finish_before(ctx, "ObjectLabel");
2864      CALL_ObjectLabel(ctx->CurrentServerDispatch, (identifier, name, length, label));
2865      return;
2866   }
2867   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ObjectLabel, cmd_size);
2868   cmd->identifier = identifier;
2869   cmd->name = name;
2870   cmd->length = length;
2871   char *variable_data = (char *) (cmd + 1);
2872   memcpy(variable_data, label, label_size);
2873}
2874
2875
2876/* GetObjectLabel: marshalled synchronously */
2877void GLAPIENTRY
2878_mesa_marshal_GetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei * length, GLchar * label)
2879{
2880   GET_CURRENT_CONTEXT(ctx);
2881   _mesa_glthread_finish_before(ctx, "GetObjectLabel");
2882   CALL_GetObjectLabel(ctx->CurrentServerDispatch, (identifier, name, bufSize, length, label));
2883}
2884
2885
2886/* ObjectPtrLabel: marshalled synchronously */
2887void GLAPIENTRY
2888_mesa_marshal_ObjectPtrLabel(const GLvoid * ptr, GLsizei length, const GLchar * label)
2889{
2890   GET_CURRENT_CONTEXT(ctx);
2891   _mesa_glthread_finish_before(ctx, "ObjectPtrLabel");
2892   CALL_ObjectPtrLabel(ctx->CurrentServerDispatch, (ptr, length, label));
2893}
2894
2895
2896/* GetObjectPtrLabel: marshalled synchronously */
2897void GLAPIENTRY
2898_mesa_marshal_GetObjectPtrLabel(const GLvoid * ptr, GLsizei bufSize, GLsizei * length, GLchar * label)
2899{
2900   GET_CURRENT_CONTEXT(ctx);
2901   _mesa_glthread_finish_before(ctx, "GetObjectPtrLabel");
2902   CALL_GetObjectPtrLabel(ctx->CurrentServerDispatch, (ptr, bufSize, length, label));
2903}
2904
2905
2906/* ClearBufferData: marshalled synchronously */
2907void GLAPIENTRY
2908_mesa_marshal_ClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const GLvoid * data)
2909{
2910   GET_CURRENT_CONTEXT(ctx);
2911   _mesa_glthread_finish_before(ctx, "ClearBufferData");
2912   CALL_ClearBufferData(ctx->CurrentServerDispatch, (target, internalformat, format, type, data));
2913}
2914
2915
2916/* ClearBufferSubData: marshalled synchronously */
2917void GLAPIENTRY
2918_mesa_marshal_ClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const GLvoid * data)
2919{
2920   GET_CURRENT_CONTEXT(ctx);
2921   _mesa_glthread_finish_before(ctx, "ClearBufferSubData");
2922   CALL_ClearBufferSubData(ctx->CurrentServerDispatch, (target, internalformat, offset, size, format, type, data));
2923}
2924
2925
2926/* ClearNamedBufferDataEXT: marshalled synchronously */
2927void GLAPIENTRY
2928_mesa_marshal_ClearNamedBufferDataEXT(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const GLvoid * data)
2929{
2930   GET_CURRENT_CONTEXT(ctx);
2931   _mesa_glthread_finish_before(ctx, "ClearNamedBufferDataEXT");
2932   CALL_ClearNamedBufferDataEXT(ctx->CurrentServerDispatch, (buffer, internalformat, format, type, data));
2933}
2934
2935
2936/* ClearNamedBufferSubDataEXT: marshalled synchronously */
2937void GLAPIENTRY
2938_mesa_marshal_ClearNamedBufferSubDataEXT(GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const GLvoid * data)
2939{
2940   GET_CURRENT_CONTEXT(ctx);
2941   _mesa_glthread_finish_before(ctx, "ClearNamedBufferSubDataEXT");
2942   CALL_ClearNamedBufferSubDataEXT(ctx->CurrentServerDispatch, (buffer, internalformat, offset, size, format, type, data));
2943}
2944
2945
2946/* DispatchCompute: marshalled asynchronously */
2947struct marshal_cmd_DispatchCompute
2948{
2949   struct marshal_cmd_base cmd_base;
2950   GLuint num_groups_x;
2951   GLuint num_groups_y;
2952   GLuint num_groups_z;
2953};
2954uint32_t
2955_mesa_unmarshal_DispatchCompute(struct gl_context *ctx, const struct marshal_cmd_DispatchCompute *cmd, const uint64_t *last)
2956{
2957   GLuint num_groups_x = cmd->num_groups_x;
2958   GLuint num_groups_y = cmd->num_groups_y;
2959   GLuint num_groups_z = cmd->num_groups_z;
2960   CALL_DispatchCompute(ctx->CurrentServerDispatch, (num_groups_x, num_groups_y, num_groups_z));
2961   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_DispatchCompute), 8) / 8);
2962   assert (cmd_size == cmd->cmd_base.cmd_size);
2963   return cmd_size;
2964}
2965void GLAPIENTRY
2966_mesa_marshal_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
2967{
2968   GET_CURRENT_CONTEXT(ctx);
2969   int cmd_size = sizeof(struct marshal_cmd_DispatchCompute);
2970   struct marshal_cmd_DispatchCompute *cmd;
2971   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DispatchCompute, cmd_size);
2972   cmd->num_groups_x = num_groups_x;
2973   cmd->num_groups_y = num_groups_y;
2974   cmd->num_groups_z = num_groups_z;
2975}
2976
2977
2978/* DispatchComputeIndirect: marshalled asynchronously */
2979struct marshal_cmd_DispatchComputeIndirect
2980{
2981   struct marshal_cmd_base cmd_base;
2982   GLintptr indirect;
2983};
2984uint32_t
2985_mesa_unmarshal_DispatchComputeIndirect(struct gl_context *ctx, const struct marshal_cmd_DispatchComputeIndirect *cmd, const uint64_t *last)
2986{
2987   GLintptr indirect = cmd->indirect;
2988   CALL_DispatchComputeIndirect(ctx->CurrentServerDispatch, (indirect));
2989   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_DispatchComputeIndirect), 8) / 8);
2990   assert (cmd_size == cmd->cmd_base.cmd_size);
2991   return cmd_size;
2992}
2993void GLAPIENTRY
2994_mesa_marshal_DispatchComputeIndirect(GLintptr indirect)
2995{
2996   GET_CURRENT_CONTEXT(ctx);
2997   int cmd_size = sizeof(struct marshal_cmd_DispatchComputeIndirect);
2998   struct marshal_cmd_DispatchComputeIndirect *cmd;
2999   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DispatchComputeIndirect, cmd_size);
3000   cmd->indirect = indirect;
3001}
3002
3003
3004/* CopyImageSubData: marshalled asynchronously */
3005struct marshal_cmd_CopyImageSubData
3006{
3007   struct marshal_cmd_base cmd_base;
3008   GLuint srcName;
3009   GLenum srcTarget;
3010   GLint srcLevel;
3011   GLint srcX;
3012   GLint srcY;
3013   GLint srcZ;
3014   GLuint dstName;
3015   GLenum dstTarget;
3016   GLint dstLevel;
3017   GLint dstX;
3018   GLint dstY;
3019   GLint dstZ;
3020   GLsizei srcWidth;
3021   GLsizei srcHeight;
3022   GLsizei srcDepth;
3023};
3024uint32_t
3025_mesa_unmarshal_CopyImageSubData(struct gl_context *ctx, const struct marshal_cmd_CopyImageSubData *cmd, const uint64_t *last)
3026{
3027   GLuint srcName = cmd->srcName;
3028   GLenum srcTarget = cmd->srcTarget;
3029   GLint srcLevel = cmd->srcLevel;
3030   GLint srcX = cmd->srcX;
3031   GLint srcY = cmd->srcY;
3032   GLint srcZ = cmd->srcZ;
3033   GLuint dstName = cmd->dstName;
3034   GLenum dstTarget = cmd->dstTarget;
3035   GLint dstLevel = cmd->dstLevel;
3036   GLint dstX = cmd->dstX;
3037   GLint dstY = cmd->dstY;
3038   GLint dstZ = cmd->dstZ;
3039   GLsizei srcWidth = cmd->srcWidth;
3040   GLsizei srcHeight = cmd->srcHeight;
3041   GLsizei srcDepth = cmd->srcDepth;
3042   CALL_CopyImageSubData(ctx->CurrentServerDispatch, (srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth));
3043   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_CopyImageSubData), 8) / 8);
3044   assert (cmd_size == cmd->cmd_base.cmd_size);
3045   return cmd_size;
3046}
3047void GLAPIENTRY
3048_mesa_marshal_CopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth)
3049{
3050   GET_CURRENT_CONTEXT(ctx);
3051   int cmd_size = sizeof(struct marshal_cmd_CopyImageSubData);
3052   struct marshal_cmd_CopyImageSubData *cmd;
3053   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_CopyImageSubData, cmd_size);
3054   cmd->srcName = srcName;
3055   cmd->srcTarget = srcTarget;
3056   cmd->srcLevel = srcLevel;
3057   cmd->srcX = srcX;
3058   cmd->srcY = srcY;
3059   cmd->srcZ = srcZ;
3060   cmd->dstName = dstName;
3061   cmd->dstTarget = dstTarget;
3062   cmd->dstLevel = dstLevel;
3063   cmd->dstX = dstX;
3064   cmd->dstY = dstY;
3065   cmd->dstZ = dstZ;
3066   cmd->srcWidth = srcWidth;
3067   cmd->srcHeight = srcHeight;
3068   cmd->srcDepth = srcDepth;
3069}
3070
3071
3072/* TextureView: marshalled asynchronously */
3073struct marshal_cmd_TextureView
3074{
3075   struct marshal_cmd_base cmd_base;
3076   GLuint texture;
3077   GLenum target;
3078   GLuint origtexture;
3079   GLenum internalformat;
3080   GLuint minlevel;
3081   GLuint numlevels;
3082   GLuint minlayer;
3083   GLuint numlayers;
3084};
3085uint32_t
3086_mesa_unmarshal_TextureView(struct gl_context *ctx, const struct marshal_cmd_TextureView *cmd, const uint64_t *last)
3087{
3088   GLuint texture = cmd->texture;
3089   GLenum target = cmd->target;
3090   GLuint origtexture = cmd->origtexture;
3091   GLenum internalformat = cmd->internalformat;
3092   GLuint minlevel = cmd->minlevel;
3093   GLuint numlevels = cmd->numlevels;
3094   GLuint minlayer = cmd->minlayer;
3095   GLuint numlayers = cmd->numlayers;
3096   CALL_TextureView(ctx->CurrentServerDispatch, (texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers));
3097   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureView), 8) / 8);
3098   assert (cmd_size == cmd->cmd_base.cmd_size);
3099   return cmd_size;
3100}
3101void GLAPIENTRY
3102_mesa_marshal_TextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers)
3103{
3104   GET_CURRENT_CONTEXT(ctx);
3105   int cmd_size = sizeof(struct marshal_cmd_TextureView);
3106   struct marshal_cmd_TextureView *cmd;
3107   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureView, cmd_size);
3108   cmd->texture = texture;
3109   cmd->target = target;
3110   cmd->origtexture = origtexture;
3111   cmd->internalformat = internalformat;
3112   cmd->minlevel = minlevel;
3113   cmd->numlevels = numlevels;
3114   cmd->minlayer = minlayer;
3115   cmd->numlayers = numlayers;
3116}
3117
3118
3119/* BindVertexBuffer: marshalled asynchronously */
3120struct marshal_cmd_BindVertexBuffer
3121{
3122   struct marshal_cmd_base cmd_base;
3123   GLuint bindingindex;
3124   GLuint buffer;
3125   GLsizei stride;
3126   GLintptr offset;
3127};
3128uint32_t
3129_mesa_unmarshal_BindVertexBuffer(struct gl_context *ctx, const struct marshal_cmd_BindVertexBuffer *cmd, const uint64_t *last)
3130{
3131   GLuint bindingindex = cmd->bindingindex;
3132   GLuint buffer = cmd->buffer;
3133   GLintptr offset = cmd->offset;
3134   GLsizei stride = cmd->stride;
3135   CALL_BindVertexBuffer(ctx->CurrentServerDispatch, (bindingindex, buffer, offset, stride));
3136   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_BindVertexBuffer), 8) / 8);
3137   assert (cmd_size == cmd->cmd_base.cmd_size);
3138   return cmd_size;
3139}
3140void GLAPIENTRY
3141_mesa_marshal_BindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)
3142{
3143   GET_CURRENT_CONTEXT(ctx);
3144   int cmd_size = sizeof(struct marshal_cmd_BindVertexBuffer);
3145   struct marshal_cmd_BindVertexBuffer *cmd;
3146   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_BindVertexBuffer, cmd_size);
3147   cmd->bindingindex = bindingindex;
3148   cmd->buffer = buffer;
3149   cmd->offset = offset;
3150   cmd->stride = stride;
3151   if (COMPAT) _mesa_glthread_VertexBuffer(ctx, bindingindex, buffer, offset, stride);
3152}
3153
3154
3155/* VertexAttribFormat: marshalled asynchronously */
3156struct marshal_cmd_VertexAttribFormat
3157{
3158   struct marshal_cmd_base cmd_base;
3159   GLboolean normalized;
3160   GLuint attribindex;
3161   GLint size;
3162   GLenum type;
3163   GLuint relativeoffset;
3164};
3165uint32_t
3166_mesa_unmarshal_VertexAttribFormat(struct gl_context *ctx, const struct marshal_cmd_VertexAttribFormat *cmd, const uint64_t *last)
3167{
3168   GLuint attribindex = cmd->attribindex;
3169   GLint size = cmd->size;
3170   GLenum type = cmd->type;
3171   GLboolean normalized = cmd->normalized;
3172   GLuint relativeoffset = cmd->relativeoffset;
3173   CALL_VertexAttribFormat(ctx->CurrentServerDispatch, (attribindex, size, type, normalized, relativeoffset));
3174   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribFormat), 8) / 8);
3175   assert (cmd_size == cmd->cmd_base.cmd_size);
3176   return cmd_size;
3177}
3178void GLAPIENTRY
3179_mesa_marshal_VertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
3180{
3181   GET_CURRENT_CONTEXT(ctx);
3182   int cmd_size = sizeof(struct marshal_cmd_VertexAttribFormat);
3183   struct marshal_cmd_VertexAttribFormat *cmd;
3184   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribFormat, cmd_size);
3185   cmd->attribindex = attribindex;
3186   cmd->size = size;
3187   cmd->type = type;
3188   cmd->normalized = normalized;
3189   cmd->relativeoffset = relativeoffset;
3190   if (COMPAT) _mesa_glthread_AttribFormat(ctx, attribindex, size, type, relativeoffset);
3191}
3192
3193
3194/* VertexAttribIFormat: marshalled asynchronously */
3195struct marshal_cmd_VertexAttribIFormat
3196{
3197   struct marshal_cmd_base cmd_base;
3198   GLuint attribindex;
3199   GLint size;
3200   GLenum type;
3201   GLuint relativeoffset;
3202};
3203uint32_t
3204_mesa_unmarshal_VertexAttribIFormat(struct gl_context *ctx, const struct marshal_cmd_VertexAttribIFormat *cmd, const uint64_t *last)
3205{
3206   GLuint attribindex = cmd->attribindex;
3207   GLint size = cmd->size;
3208   GLenum type = cmd->type;
3209   GLuint relativeoffset = cmd->relativeoffset;
3210   CALL_VertexAttribIFormat(ctx->CurrentServerDispatch, (attribindex, size, type, relativeoffset));
3211   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribIFormat), 8) / 8);
3212   assert (cmd_size == cmd->cmd_base.cmd_size);
3213   return cmd_size;
3214}
3215void GLAPIENTRY
3216_mesa_marshal_VertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
3217{
3218   GET_CURRENT_CONTEXT(ctx);
3219   int cmd_size = sizeof(struct marshal_cmd_VertexAttribIFormat);
3220   struct marshal_cmd_VertexAttribIFormat *cmd;
3221   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribIFormat, cmd_size);
3222   cmd->attribindex = attribindex;
3223   cmd->size = size;
3224   cmd->type = type;
3225   cmd->relativeoffset = relativeoffset;
3226   if (COMPAT) _mesa_glthread_AttribFormat(ctx, attribindex, size, type, relativeoffset);
3227}
3228
3229
3230/* VertexAttribLFormat: marshalled asynchronously */
3231struct marshal_cmd_VertexAttribLFormat
3232{
3233   struct marshal_cmd_base cmd_base;
3234   GLuint attribindex;
3235   GLint size;
3236   GLenum type;
3237   GLuint relativeoffset;
3238};
3239uint32_t
3240_mesa_unmarshal_VertexAttribLFormat(struct gl_context *ctx, const struct marshal_cmd_VertexAttribLFormat *cmd, const uint64_t *last)
3241{
3242   GLuint attribindex = cmd->attribindex;
3243   GLint size = cmd->size;
3244   GLenum type = cmd->type;
3245   GLuint relativeoffset = cmd->relativeoffset;
3246   CALL_VertexAttribLFormat(ctx->CurrentServerDispatch, (attribindex, size, type, relativeoffset));
3247   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribLFormat), 8) / 8);
3248   assert (cmd_size == cmd->cmd_base.cmd_size);
3249   return cmd_size;
3250}
3251void GLAPIENTRY
3252_mesa_marshal_VertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
3253{
3254   GET_CURRENT_CONTEXT(ctx);
3255   int cmd_size = sizeof(struct marshal_cmd_VertexAttribLFormat);
3256   struct marshal_cmd_VertexAttribLFormat *cmd;
3257   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribLFormat, cmd_size);
3258   cmd->attribindex = attribindex;
3259   cmd->size = size;
3260   cmd->type = type;
3261   cmd->relativeoffset = relativeoffset;
3262   if (COMPAT) _mesa_glthread_AttribFormat(ctx, attribindex, size, type, relativeoffset);
3263}
3264
3265
3266/* VertexAttribBinding: marshalled asynchronously */
3267struct marshal_cmd_VertexAttribBinding
3268{
3269   struct marshal_cmd_base cmd_base;
3270   GLuint attribindex;
3271   GLuint bindingindex;
3272};
3273uint32_t
3274_mesa_unmarshal_VertexAttribBinding(struct gl_context *ctx, const struct marshal_cmd_VertexAttribBinding *cmd, const uint64_t *last)
3275{
3276   GLuint attribindex = cmd->attribindex;
3277   GLuint bindingindex = cmd->bindingindex;
3278   CALL_VertexAttribBinding(ctx->CurrentServerDispatch, (attribindex, bindingindex));
3279   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribBinding), 8) / 8);
3280   assert (cmd_size == cmd->cmd_base.cmd_size);
3281   return cmd_size;
3282}
3283void GLAPIENTRY
3284_mesa_marshal_VertexAttribBinding(GLuint attribindex, GLuint bindingindex)
3285{
3286   GET_CURRENT_CONTEXT(ctx);
3287   int cmd_size = sizeof(struct marshal_cmd_VertexAttribBinding);
3288   struct marshal_cmd_VertexAttribBinding *cmd;
3289   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribBinding, cmd_size);
3290   cmd->attribindex = attribindex;
3291   cmd->bindingindex = bindingindex;
3292   if (COMPAT) _mesa_glthread_AttribBinding(ctx, attribindex, bindingindex);
3293}
3294
3295
3296/* VertexBindingDivisor: marshalled asynchronously */
3297struct marshal_cmd_VertexBindingDivisor
3298{
3299   struct marshal_cmd_base cmd_base;
3300   GLuint bindingindex;
3301   GLuint divisor;
3302};
3303uint32_t
3304_mesa_unmarshal_VertexBindingDivisor(struct gl_context *ctx, const struct marshal_cmd_VertexBindingDivisor *cmd, const uint64_t *last)
3305{
3306   GLuint bindingindex = cmd->bindingindex;
3307   GLuint divisor = cmd->divisor;
3308   CALL_VertexBindingDivisor(ctx->CurrentServerDispatch, (bindingindex, divisor));
3309   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexBindingDivisor), 8) / 8);
3310   assert (cmd_size == cmd->cmd_base.cmd_size);
3311   return cmd_size;
3312}
3313void GLAPIENTRY
3314_mesa_marshal_VertexBindingDivisor(GLuint bindingindex, GLuint divisor)
3315{
3316   GET_CURRENT_CONTEXT(ctx);
3317   int cmd_size = sizeof(struct marshal_cmd_VertexBindingDivisor);
3318   struct marshal_cmd_VertexBindingDivisor *cmd;
3319   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexBindingDivisor, cmd_size);
3320   cmd->bindingindex = bindingindex;
3321   cmd->divisor = divisor;
3322   if (COMPAT) _mesa_glthread_BindingDivisor(ctx, bindingindex, divisor);
3323}
3324
3325
3326/* VertexArrayBindVertexBufferEXT: marshalled asynchronously */
3327struct marshal_cmd_VertexArrayBindVertexBufferEXT
3328{
3329   struct marshal_cmd_base cmd_base;
3330   GLuint vaobj;
3331   GLuint bindingindex;
3332   GLuint buffer;
3333   GLsizei stride;
3334   GLintptr offset;
3335};
3336uint32_t
3337_mesa_unmarshal_VertexArrayBindVertexBufferEXT(struct gl_context *ctx, const struct marshal_cmd_VertexArrayBindVertexBufferEXT *cmd, const uint64_t *last)
3338{
3339   GLuint vaobj = cmd->vaobj;
3340   GLuint bindingindex = cmd->bindingindex;
3341   GLuint buffer = cmd->buffer;
3342   GLintptr offset = cmd->offset;
3343   GLsizei stride = cmd->stride;
3344   CALL_VertexArrayBindVertexBufferEXT(ctx->CurrentServerDispatch, (vaobj, bindingindex, buffer, offset, stride));
3345   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayBindVertexBufferEXT), 8) / 8);
3346   assert (cmd_size == cmd->cmd_base.cmd_size);
3347   return cmd_size;
3348}
3349void GLAPIENTRY
3350_mesa_marshal_VertexArrayBindVertexBufferEXT(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)
3351{
3352   GET_CURRENT_CONTEXT(ctx);
3353   int cmd_size = sizeof(struct marshal_cmd_VertexArrayBindVertexBufferEXT);
3354   struct marshal_cmd_VertexArrayBindVertexBufferEXT *cmd;
3355   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayBindVertexBufferEXT, cmd_size);
3356   cmd->vaobj = vaobj;
3357   cmd->bindingindex = bindingindex;
3358   cmd->buffer = buffer;
3359   cmd->offset = offset;
3360   cmd->stride = stride;
3361   if (COMPAT) _mesa_glthread_DSAVertexBuffer(ctx, vaobj, bindingindex, buffer, offset, stride);
3362}
3363
3364
3365/* VertexArrayVertexAttribFormatEXT: marshalled asynchronously */
3366struct marshal_cmd_VertexArrayVertexAttribFormatEXT
3367{
3368   struct marshal_cmd_base cmd_base;
3369   GLboolean normalized;
3370   GLuint vaobj;
3371   GLuint attribindex;
3372   GLint size;
3373   GLenum type;
3374   GLuint relativeoffset;
3375};
3376uint32_t
3377_mesa_unmarshal_VertexArrayVertexAttribFormatEXT(struct gl_context *ctx, const struct marshal_cmd_VertexArrayVertexAttribFormatEXT *cmd, const uint64_t *last)
3378{
3379   GLuint vaobj = cmd->vaobj;
3380   GLuint attribindex = cmd->attribindex;
3381   GLint size = cmd->size;
3382   GLenum type = cmd->type;
3383   GLboolean normalized = cmd->normalized;
3384   GLuint relativeoffset = cmd->relativeoffset;
3385   CALL_VertexArrayVertexAttribFormatEXT(ctx->CurrentServerDispatch, (vaobj, attribindex, size, type, normalized, relativeoffset));
3386   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayVertexAttribFormatEXT), 8) / 8);
3387   assert (cmd_size == cmd->cmd_base.cmd_size);
3388   return cmd_size;
3389}
3390void GLAPIENTRY
3391_mesa_marshal_VertexArrayVertexAttribFormatEXT(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
3392{
3393   GET_CURRENT_CONTEXT(ctx);
3394   int cmd_size = sizeof(struct marshal_cmd_VertexArrayVertexAttribFormatEXT);
3395   struct marshal_cmd_VertexArrayVertexAttribFormatEXT *cmd;
3396   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayVertexAttribFormatEXT, cmd_size);
3397   cmd->vaobj = vaobj;
3398   cmd->attribindex = attribindex;
3399   cmd->size = size;
3400   cmd->type = type;
3401   cmd->normalized = normalized;
3402   cmd->relativeoffset = relativeoffset;
3403   if (COMPAT) _mesa_glthread_DSAAttribFormat(ctx, vaobj, attribindex, size, type, relativeoffset);
3404}
3405
3406
3407/* VertexArrayVertexAttribIFormatEXT: marshalled asynchronously */
3408struct marshal_cmd_VertexArrayVertexAttribIFormatEXT
3409{
3410   struct marshal_cmd_base cmd_base;
3411   GLuint vaobj;
3412   GLuint attribindex;
3413   GLint size;
3414   GLenum type;
3415   GLuint relativeoffset;
3416};
3417uint32_t
3418_mesa_unmarshal_VertexArrayVertexAttribIFormatEXT(struct gl_context *ctx, const struct marshal_cmd_VertexArrayVertexAttribIFormatEXT *cmd, const uint64_t *last)
3419{
3420   GLuint vaobj = cmd->vaobj;
3421   GLuint attribindex = cmd->attribindex;
3422   GLint size = cmd->size;
3423   GLenum type = cmd->type;
3424   GLuint relativeoffset = cmd->relativeoffset;
3425   CALL_VertexArrayVertexAttribIFormatEXT(ctx->CurrentServerDispatch, (vaobj, attribindex, size, type, relativeoffset));
3426   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayVertexAttribIFormatEXT), 8) / 8);
3427   assert (cmd_size == cmd->cmd_base.cmd_size);
3428   return cmd_size;
3429}
3430void GLAPIENTRY
3431_mesa_marshal_VertexArrayVertexAttribIFormatEXT(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
3432{
3433   GET_CURRENT_CONTEXT(ctx);
3434   int cmd_size = sizeof(struct marshal_cmd_VertexArrayVertexAttribIFormatEXT);
3435   struct marshal_cmd_VertexArrayVertexAttribIFormatEXT *cmd;
3436   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayVertexAttribIFormatEXT, cmd_size);
3437   cmd->vaobj = vaobj;
3438   cmd->attribindex = attribindex;
3439   cmd->size = size;
3440   cmd->type = type;
3441   cmd->relativeoffset = relativeoffset;
3442   if (COMPAT) _mesa_glthread_DSAAttribFormat(ctx, vaobj, attribindex, size, type, relativeoffset);
3443}
3444
3445
3446/* VertexArrayVertexAttribLFormatEXT: marshalled asynchronously */
3447struct marshal_cmd_VertexArrayVertexAttribLFormatEXT
3448{
3449   struct marshal_cmd_base cmd_base;
3450   GLuint vaobj;
3451   GLuint attribindex;
3452   GLint size;
3453   GLenum type;
3454   GLuint relativeoffset;
3455};
3456uint32_t
3457_mesa_unmarshal_VertexArrayVertexAttribLFormatEXT(struct gl_context *ctx, const struct marshal_cmd_VertexArrayVertexAttribLFormatEXT *cmd, const uint64_t *last)
3458{
3459   GLuint vaobj = cmd->vaobj;
3460   GLuint attribindex = cmd->attribindex;
3461   GLint size = cmd->size;
3462   GLenum type = cmd->type;
3463   GLuint relativeoffset = cmd->relativeoffset;
3464   CALL_VertexArrayVertexAttribLFormatEXT(ctx->CurrentServerDispatch, (vaobj, attribindex, size, type, relativeoffset));
3465   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayVertexAttribLFormatEXT), 8) / 8);
3466   assert (cmd_size == cmd->cmd_base.cmd_size);
3467   return cmd_size;
3468}
3469void GLAPIENTRY
3470_mesa_marshal_VertexArrayVertexAttribLFormatEXT(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
3471{
3472   GET_CURRENT_CONTEXT(ctx);
3473   int cmd_size = sizeof(struct marshal_cmd_VertexArrayVertexAttribLFormatEXT);
3474   struct marshal_cmd_VertexArrayVertexAttribLFormatEXT *cmd;
3475   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayVertexAttribLFormatEXT, cmd_size);
3476   cmd->vaobj = vaobj;
3477   cmd->attribindex = attribindex;
3478   cmd->size = size;
3479   cmd->type = type;
3480   cmd->relativeoffset = relativeoffset;
3481   if (COMPAT) _mesa_glthread_DSAAttribFormat(ctx, vaobj, attribindex, size, type, relativeoffset);
3482}
3483
3484
3485/* VertexArrayVertexAttribBindingEXT: marshalled asynchronously */
3486struct marshal_cmd_VertexArrayVertexAttribBindingEXT
3487{
3488   struct marshal_cmd_base cmd_base;
3489   GLuint vaobj;
3490   GLuint attribindex;
3491   GLuint bindingindex;
3492};
3493uint32_t
3494_mesa_unmarshal_VertexArrayVertexAttribBindingEXT(struct gl_context *ctx, const struct marshal_cmd_VertexArrayVertexAttribBindingEXT *cmd, const uint64_t *last)
3495{
3496   GLuint vaobj = cmd->vaobj;
3497   GLuint attribindex = cmd->attribindex;
3498   GLuint bindingindex = cmd->bindingindex;
3499   CALL_VertexArrayVertexAttribBindingEXT(ctx->CurrentServerDispatch, (vaobj, attribindex, bindingindex));
3500   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayVertexAttribBindingEXT), 8) / 8);
3501   assert (cmd_size == cmd->cmd_base.cmd_size);
3502   return cmd_size;
3503}
3504void GLAPIENTRY
3505_mesa_marshal_VertexArrayVertexAttribBindingEXT(GLuint vaobj, GLuint attribindex, GLuint bindingindex)
3506{
3507   GET_CURRENT_CONTEXT(ctx);
3508   int cmd_size = sizeof(struct marshal_cmd_VertexArrayVertexAttribBindingEXT);
3509   struct marshal_cmd_VertexArrayVertexAttribBindingEXT *cmd;
3510   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayVertexAttribBindingEXT, cmd_size);
3511   cmd->vaobj = vaobj;
3512   cmd->attribindex = attribindex;
3513   cmd->bindingindex = bindingindex;
3514   if (COMPAT) _mesa_glthread_DSAAttribBinding(ctx, vaobj, attribindex, bindingindex);
3515}
3516
3517
3518/* VertexArrayVertexBindingDivisorEXT: marshalled asynchronously */
3519struct marshal_cmd_VertexArrayVertexBindingDivisorEXT
3520{
3521   struct marshal_cmd_base cmd_base;
3522   GLuint vaobj;
3523   GLuint bindingindex;
3524   GLuint divisor;
3525};
3526uint32_t
3527_mesa_unmarshal_VertexArrayVertexBindingDivisorEXT(struct gl_context *ctx, const struct marshal_cmd_VertexArrayVertexBindingDivisorEXT *cmd, const uint64_t *last)
3528{
3529   GLuint vaobj = cmd->vaobj;
3530   GLuint bindingindex = cmd->bindingindex;
3531   GLuint divisor = cmd->divisor;
3532   CALL_VertexArrayVertexBindingDivisorEXT(ctx->CurrentServerDispatch, (vaobj, bindingindex, divisor));
3533   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayVertexBindingDivisorEXT), 8) / 8);
3534   assert (cmd_size == cmd->cmd_base.cmd_size);
3535   return cmd_size;
3536}
3537void GLAPIENTRY
3538_mesa_marshal_VertexArrayVertexBindingDivisorEXT(GLuint vaobj, GLuint bindingindex, GLuint divisor)
3539{
3540   GET_CURRENT_CONTEXT(ctx);
3541   int cmd_size = sizeof(struct marshal_cmd_VertexArrayVertexBindingDivisorEXT);
3542   struct marshal_cmd_VertexArrayVertexBindingDivisorEXT *cmd;
3543   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayVertexBindingDivisorEXT, cmd_size);
3544   cmd->vaobj = vaobj;
3545   cmd->bindingindex = bindingindex;
3546   cmd->divisor = divisor;
3547   if (COMPAT) _mesa_glthread_DSABindingDivisor(ctx, vaobj, bindingindex, divisor);
3548}
3549
3550
3551/* FramebufferParameteri: marshalled asynchronously */
3552struct marshal_cmd_FramebufferParameteri
3553{
3554   struct marshal_cmd_base cmd_base;
3555   GLenum target;
3556   GLenum pname;
3557   GLint param;
3558};
3559uint32_t
3560_mesa_unmarshal_FramebufferParameteri(struct gl_context *ctx, const struct marshal_cmd_FramebufferParameteri *cmd, const uint64_t *last)
3561{
3562   GLenum target = cmd->target;
3563   GLenum pname = cmd->pname;
3564   GLint param = cmd->param;
3565   CALL_FramebufferParameteri(ctx->CurrentServerDispatch, (target, pname, param));
3566   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_FramebufferParameteri), 8) / 8);
3567   assert (cmd_size == cmd->cmd_base.cmd_size);
3568   return cmd_size;
3569}
3570void GLAPIENTRY
3571_mesa_marshal_FramebufferParameteri(GLenum target, GLenum pname, GLint param)
3572{
3573   GET_CURRENT_CONTEXT(ctx);
3574   int cmd_size = sizeof(struct marshal_cmd_FramebufferParameteri);
3575   struct marshal_cmd_FramebufferParameteri *cmd;
3576   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_FramebufferParameteri, cmd_size);
3577   cmd->target = target;
3578   cmd->pname = pname;
3579   cmd->param = param;
3580}
3581
3582
3583/* GetFramebufferParameteriv: marshalled synchronously */
3584void GLAPIENTRY
3585_mesa_marshal_GetFramebufferParameteriv(GLenum target, GLenum pname, GLint * params)
3586{
3587   GET_CURRENT_CONTEXT(ctx);
3588   _mesa_glthread_finish_before(ctx, "GetFramebufferParameteriv");
3589   CALL_GetFramebufferParameteriv(ctx->CurrentServerDispatch, (target, pname, params));
3590}
3591
3592
3593/* NamedFramebufferParameteriEXT: marshalled asynchronously */
3594struct marshal_cmd_NamedFramebufferParameteriEXT
3595{
3596   struct marshal_cmd_base cmd_base;
3597   GLuint framebuffer;
3598   GLenum pname;
3599   GLint param;
3600};
3601uint32_t
3602_mesa_unmarshal_NamedFramebufferParameteriEXT(struct gl_context *ctx, const struct marshal_cmd_NamedFramebufferParameteriEXT *cmd, const uint64_t *last)
3603{
3604   GLuint framebuffer = cmd->framebuffer;
3605   GLenum pname = cmd->pname;
3606   GLint param = cmd->param;
3607   CALL_NamedFramebufferParameteriEXT(ctx->CurrentServerDispatch, (framebuffer, pname, param));
3608   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_NamedFramebufferParameteriEXT), 8) / 8);
3609   assert (cmd_size == cmd->cmd_base.cmd_size);
3610   return cmd_size;
3611}
3612void GLAPIENTRY
3613_mesa_marshal_NamedFramebufferParameteriEXT(GLuint framebuffer, GLenum pname, GLint param)
3614{
3615   GET_CURRENT_CONTEXT(ctx);
3616   int cmd_size = sizeof(struct marshal_cmd_NamedFramebufferParameteriEXT);
3617   struct marshal_cmd_NamedFramebufferParameteriEXT *cmd;
3618   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_NamedFramebufferParameteriEXT, cmd_size);
3619   cmd->framebuffer = framebuffer;
3620   cmd->pname = pname;
3621   cmd->param = param;
3622}
3623
3624
3625/* GetNamedFramebufferParameterivEXT: marshalled synchronously */
3626void GLAPIENTRY
3627_mesa_marshal_GetNamedFramebufferParameterivEXT(GLuint framebuffer, GLenum pname, GLint* params)
3628{
3629   GET_CURRENT_CONTEXT(ctx);
3630   _mesa_glthread_finish_before(ctx, "GetNamedFramebufferParameterivEXT");
3631   CALL_GetNamedFramebufferParameterivEXT(ctx->CurrentServerDispatch, (framebuffer, pname, params));
3632}
3633
3634
3635/* GetInternalformati64v: marshalled synchronously */
3636void GLAPIENTRY
3637_mesa_marshal_GetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 * params)
3638{
3639   GET_CURRENT_CONTEXT(ctx);
3640   _mesa_glthread_finish_before(ctx, "GetInternalformati64v");
3641   CALL_GetInternalformati64v(ctx->CurrentServerDispatch, (target, internalformat, pname, bufSize, params));
3642}
3643
3644
3645/* InvalidateTexSubImage: marshalled asynchronously */
3646struct marshal_cmd_InvalidateTexSubImage
3647{
3648   struct marshal_cmd_base cmd_base;
3649   GLuint texture;
3650   GLint level;
3651   GLint xoffset;
3652   GLint yoffset;
3653   GLint zoffset;
3654   GLsizei width;
3655   GLsizei height;
3656   GLsizei depth;
3657};
3658uint32_t
3659_mesa_unmarshal_InvalidateTexSubImage(struct gl_context *ctx, const struct marshal_cmd_InvalidateTexSubImage *cmd, const uint64_t *last)
3660{
3661   GLuint texture = cmd->texture;
3662   GLint level = cmd->level;
3663   GLint xoffset = cmd->xoffset;
3664   GLint yoffset = cmd->yoffset;
3665   GLint zoffset = cmd->zoffset;
3666   GLsizei width = cmd->width;
3667   GLsizei height = cmd->height;
3668   GLsizei depth = cmd->depth;
3669   CALL_InvalidateTexSubImage(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, zoffset, width, height, depth));
3670   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_InvalidateTexSubImage), 8) / 8);
3671   assert (cmd_size == cmd->cmd_base.cmd_size);
3672   return cmd_size;
3673}
3674void GLAPIENTRY
3675_mesa_marshal_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)
3676{
3677   GET_CURRENT_CONTEXT(ctx);
3678   int cmd_size = sizeof(struct marshal_cmd_InvalidateTexSubImage);
3679   struct marshal_cmd_InvalidateTexSubImage *cmd;
3680   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_InvalidateTexSubImage, cmd_size);
3681   cmd->texture = texture;
3682   cmd->level = level;
3683   cmd->xoffset = xoffset;
3684   cmd->yoffset = yoffset;
3685   cmd->zoffset = zoffset;
3686   cmd->width = width;
3687   cmd->height = height;
3688   cmd->depth = depth;
3689}
3690
3691
3692/* InvalidateTexImage: marshalled asynchronously */
3693struct marshal_cmd_InvalidateTexImage
3694{
3695   struct marshal_cmd_base cmd_base;
3696   GLuint texture;
3697   GLint level;
3698};
3699uint32_t
3700_mesa_unmarshal_InvalidateTexImage(struct gl_context *ctx, const struct marshal_cmd_InvalidateTexImage *cmd, const uint64_t *last)
3701{
3702   GLuint texture = cmd->texture;
3703   GLint level = cmd->level;
3704   CALL_InvalidateTexImage(ctx->CurrentServerDispatch, (texture, level));
3705   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_InvalidateTexImage), 8) / 8);
3706   assert (cmd_size == cmd->cmd_base.cmd_size);
3707   return cmd_size;
3708}
3709void GLAPIENTRY
3710_mesa_marshal_InvalidateTexImage(GLuint texture, GLint level)
3711{
3712   GET_CURRENT_CONTEXT(ctx);
3713   int cmd_size = sizeof(struct marshal_cmd_InvalidateTexImage);
3714   struct marshal_cmd_InvalidateTexImage *cmd;
3715   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_InvalidateTexImage, cmd_size);
3716   cmd->texture = texture;
3717   cmd->level = level;
3718}
3719
3720
3721/* InvalidateBufferSubData: marshalled asynchronously */
3722struct marshal_cmd_InvalidateBufferSubData
3723{
3724   struct marshal_cmd_base cmd_base;
3725   GLuint buffer;
3726   GLintptr offset;
3727   GLsizeiptr length;
3728};
3729uint32_t
3730_mesa_unmarshal_InvalidateBufferSubData(struct gl_context *ctx, const struct marshal_cmd_InvalidateBufferSubData *cmd, const uint64_t *last)
3731{
3732   GLuint buffer = cmd->buffer;
3733   GLintptr offset = cmd->offset;
3734   GLsizeiptr length = cmd->length;
3735   CALL_InvalidateBufferSubData(ctx->CurrentServerDispatch, (buffer, offset, length));
3736   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_InvalidateBufferSubData), 8) / 8);
3737   assert (cmd_size == cmd->cmd_base.cmd_size);
3738   return cmd_size;
3739}
3740void GLAPIENTRY
3741_mesa_marshal_InvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length)
3742{
3743   GET_CURRENT_CONTEXT(ctx);
3744   int cmd_size = sizeof(struct marshal_cmd_InvalidateBufferSubData);
3745   struct marshal_cmd_InvalidateBufferSubData *cmd;
3746   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_InvalidateBufferSubData, cmd_size);
3747   cmd->buffer = buffer;
3748   cmd->offset = offset;
3749   cmd->length = length;
3750}
3751
3752
3753/* InvalidateBufferData: marshalled asynchronously */
3754struct marshal_cmd_InvalidateBufferData
3755{
3756   struct marshal_cmd_base cmd_base;
3757   GLuint buffer;
3758};
3759uint32_t
3760_mesa_unmarshal_InvalidateBufferData(struct gl_context *ctx, const struct marshal_cmd_InvalidateBufferData *cmd, const uint64_t *last)
3761{
3762   GLuint buffer = cmd->buffer;
3763   CALL_InvalidateBufferData(ctx->CurrentServerDispatch, (buffer));
3764   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_InvalidateBufferData), 8) / 8);
3765   assert (cmd_size == cmd->cmd_base.cmd_size);
3766   return cmd_size;
3767}
3768void GLAPIENTRY
3769_mesa_marshal_InvalidateBufferData(GLuint buffer)
3770{
3771   GET_CURRENT_CONTEXT(ctx);
3772   int cmd_size = sizeof(struct marshal_cmd_InvalidateBufferData);
3773   struct marshal_cmd_InvalidateBufferData *cmd;
3774   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_InvalidateBufferData, cmd_size);
3775   cmd->buffer = buffer;
3776}
3777
3778
3779/* InvalidateSubFramebuffer: marshalled asynchronously */
3780struct marshal_cmd_InvalidateSubFramebuffer
3781{
3782   struct marshal_cmd_base cmd_base;
3783   GLenum target;
3784   GLsizei numAttachments;
3785   GLint x;
3786   GLint y;
3787   GLsizei width;
3788   GLsizei height;
3789   /* Next safe_mul(numAttachments, 1 * sizeof(GLenum)) bytes are GLenum attachments[numAttachments] */
3790};
3791uint32_t
3792_mesa_unmarshal_InvalidateSubFramebuffer(struct gl_context *ctx, const struct marshal_cmd_InvalidateSubFramebuffer *cmd, const uint64_t *last)
3793{
3794   GLenum target = cmd->target;
3795   GLsizei numAttachments = cmd->numAttachments;
3796   GLint x = cmd->x;
3797   GLint y = cmd->y;
3798   GLsizei width = cmd->width;
3799   GLsizei height = cmd->height;
3800   GLenum * attachments;
3801   const char *variable_data = (const char *) (cmd + 1);
3802   attachments = (GLenum *) variable_data;
3803   CALL_InvalidateSubFramebuffer(ctx->CurrentServerDispatch, (target, numAttachments, attachments, x, y, width, height));
3804   return cmd->cmd_base.cmd_size;
3805}
3806void GLAPIENTRY
3807_mesa_marshal_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum * attachments, GLint x, GLint y, GLsizei width, GLsizei height)
3808{
3809   GET_CURRENT_CONTEXT(ctx);
3810   int attachments_size = safe_mul(numAttachments, 1 * sizeof(GLenum));
3811   int cmd_size = sizeof(struct marshal_cmd_InvalidateSubFramebuffer) + attachments_size;
3812   struct marshal_cmd_InvalidateSubFramebuffer *cmd;
3813   if (unlikely(attachments_size < 0 || (attachments_size > 0 && !attachments) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
3814      _mesa_glthread_finish_before(ctx, "InvalidateSubFramebuffer");
3815      CALL_InvalidateSubFramebuffer(ctx->CurrentServerDispatch, (target, numAttachments, attachments, x, y, width, height));
3816      return;
3817   }
3818   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_InvalidateSubFramebuffer, cmd_size);
3819   cmd->target = target;
3820   cmd->numAttachments = numAttachments;
3821   cmd->x = x;
3822   cmd->y = y;
3823   cmd->width = width;
3824   cmd->height = height;
3825   char *variable_data = (char *) (cmd + 1);
3826   memcpy(variable_data, attachments, attachments_size);
3827}
3828
3829
3830/* InvalidateFramebuffer: marshalled asynchronously */
3831struct marshal_cmd_InvalidateFramebuffer
3832{
3833   struct marshal_cmd_base cmd_base;
3834   GLenum target;
3835   GLsizei numAttachments;
3836   /* Next safe_mul(numAttachments, 1 * sizeof(GLenum)) bytes are GLenum attachments[numAttachments] */
3837};
3838uint32_t
3839_mesa_unmarshal_InvalidateFramebuffer(struct gl_context *ctx, const struct marshal_cmd_InvalidateFramebuffer *cmd, const uint64_t *last)
3840{
3841   GLenum target = cmd->target;
3842   GLsizei numAttachments = cmd->numAttachments;
3843   GLenum * attachments;
3844   const char *variable_data = (const char *) (cmd + 1);
3845   attachments = (GLenum *) variable_data;
3846   CALL_InvalidateFramebuffer(ctx->CurrentServerDispatch, (target, numAttachments, attachments));
3847   return cmd->cmd_base.cmd_size;
3848}
3849void GLAPIENTRY
3850_mesa_marshal_InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum * attachments)
3851{
3852   GET_CURRENT_CONTEXT(ctx);
3853   int attachments_size = safe_mul(numAttachments, 1 * sizeof(GLenum));
3854   int cmd_size = sizeof(struct marshal_cmd_InvalidateFramebuffer) + attachments_size;
3855   struct marshal_cmd_InvalidateFramebuffer *cmd;
3856   if (unlikely(attachments_size < 0 || (attachments_size > 0 && !attachments) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
3857      _mesa_glthread_finish_before(ctx, "InvalidateFramebuffer");
3858      CALL_InvalidateFramebuffer(ctx->CurrentServerDispatch, (target, numAttachments, attachments));
3859      return;
3860   }
3861   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_InvalidateFramebuffer, cmd_size);
3862   cmd->target = target;
3863   cmd->numAttachments = numAttachments;
3864   char *variable_data = (char *) (cmd + 1);
3865   memcpy(variable_data, attachments, attachments_size);
3866}
3867
3868
3869/* GetProgramInterfaceiv: marshalled synchronously */
3870void GLAPIENTRY
3871_mesa_marshal_GetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint * params)
3872{
3873   GET_CURRENT_CONTEXT(ctx);
3874   _mesa_glthread_finish_before(ctx, "GetProgramInterfaceiv");
3875   CALL_GetProgramInterfaceiv(ctx->CurrentServerDispatch, (program, programInterface, pname, params));
3876}
3877
3878
3879/* GetProgramResourceIndex: marshalled synchronously */
3880GLuint GLAPIENTRY
3881_mesa_marshal_GetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar * name)
3882{
3883   GET_CURRENT_CONTEXT(ctx);
3884   _mesa_glthread_finish_before(ctx, "GetProgramResourceIndex");
3885   return CALL_GetProgramResourceIndex(ctx->CurrentServerDispatch, (program, programInterface, name));
3886}
3887
3888
3889/* GetProgramResourceName: marshalled synchronously */
3890void GLAPIENTRY
3891_mesa_marshal_GetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei  bufSize, GLsizei * length, GLchar * name)
3892{
3893   GET_CURRENT_CONTEXT(ctx);
3894   _mesa_glthread_finish_before(ctx, "GetProgramResourceName");
3895   CALL_GetProgramResourceName(ctx->CurrentServerDispatch, (program, programInterface, index, bufSize, length, name));
3896}
3897
3898
3899/* GetProgramResourceiv: marshalled synchronously */
3900void GLAPIENTRY
3901_mesa_marshal_GetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei  propCount, const GLenum * props, GLsizei  bufSize, GLsizei * length, GLint * params)
3902{
3903   GET_CURRENT_CONTEXT(ctx);
3904   _mesa_glthread_finish_before(ctx, "GetProgramResourceiv");
3905   CALL_GetProgramResourceiv(ctx->CurrentServerDispatch, (program, programInterface, index, propCount, props, bufSize, length, params));
3906}
3907
3908
3909/* GetProgramResourceLocation: marshalled synchronously */
3910GLint GLAPIENTRY
3911_mesa_marshal_GetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar * name)
3912{
3913   GET_CURRENT_CONTEXT(ctx);
3914   _mesa_glthread_finish_before(ctx, "GetProgramResourceLocation");
3915   return CALL_GetProgramResourceLocation(ctx->CurrentServerDispatch, (program, programInterface, name));
3916}
3917
3918
3919/* GetProgramResourceLocationIndex: marshalled synchronously */
3920GLint GLAPIENTRY
3921_mesa_marshal_GetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar * name)
3922{
3923   GET_CURRENT_CONTEXT(ctx);
3924   _mesa_glthread_finish_before(ctx, "GetProgramResourceLocationIndex");
3925   return CALL_GetProgramResourceLocationIndex(ctx->CurrentServerDispatch, (program, programInterface, name));
3926}
3927
3928
3929/* ShaderStorageBlockBinding: marshalled asynchronously */
3930struct marshal_cmd_ShaderStorageBlockBinding
3931{
3932   struct marshal_cmd_base cmd_base;
3933   GLuint program;
3934   GLuint shaderStorageBlockIndex;
3935   GLuint shaderStorageBlockBinding;
3936};
3937uint32_t
3938_mesa_unmarshal_ShaderStorageBlockBinding(struct gl_context *ctx, const struct marshal_cmd_ShaderStorageBlockBinding *cmd, const uint64_t *last)
3939{
3940   GLuint program = cmd->program;
3941   GLuint shaderStorageBlockIndex = cmd->shaderStorageBlockIndex;
3942   GLuint shaderStorageBlockBinding = cmd->shaderStorageBlockBinding;
3943   CALL_ShaderStorageBlockBinding(ctx->CurrentServerDispatch, (program, shaderStorageBlockIndex, shaderStorageBlockBinding));
3944   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ShaderStorageBlockBinding), 8) / 8);
3945   assert (cmd_size == cmd->cmd_base.cmd_size);
3946   return cmd_size;
3947}
3948void GLAPIENTRY
3949_mesa_marshal_ShaderStorageBlockBinding(GLuint program, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding)
3950{
3951   GET_CURRENT_CONTEXT(ctx);
3952   int cmd_size = sizeof(struct marshal_cmd_ShaderStorageBlockBinding);
3953   struct marshal_cmd_ShaderStorageBlockBinding *cmd;
3954   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ShaderStorageBlockBinding, cmd_size);
3955   cmd->program = program;
3956   cmd->shaderStorageBlockIndex = shaderStorageBlockIndex;
3957   cmd->shaderStorageBlockBinding = shaderStorageBlockBinding;
3958}
3959
3960
3961/* TexBufferRange: marshalled asynchronously */
3962struct marshal_cmd_TexBufferRange
3963{
3964   struct marshal_cmd_base cmd_base;
3965   GLenum target;
3966   GLenum internalformat;
3967   GLuint buffer;
3968   GLintptr offset;
3969   GLsizeiptr size;
3970};
3971uint32_t
3972_mesa_unmarshal_TexBufferRange(struct gl_context *ctx, const struct marshal_cmd_TexBufferRange *cmd, const uint64_t *last)
3973{
3974   GLenum target = cmd->target;
3975   GLenum internalformat = cmd->internalformat;
3976   GLuint buffer = cmd->buffer;
3977   GLintptr offset = cmd->offset;
3978   GLsizeiptr size = cmd->size;
3979   CALL_TexBufferRange(ctx->CurrentServerDispatch, (target, internalformat, buffer, offset, size));
3980   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TexBufferRange), 8) / 8);
3981   assert (cmd_size == cmd->cmd_base.cmd_size);
3982   return cmd_size;
3983}
3984void GLAPIENTRY
3985_mesa_marshal_TexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size)
3986{
3987   GET_CURRENT_CONTEXT(ctx);
3988   int cmd_size = sizeof(struct marshal_cmd_TexBufferRange);
3989   struct marshal_cmd_TexBufferRange *cmd;
3990   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TexBufferRange, cmd_size);
3991   cmd->target = target;
3992   cmd->internalformat = internalformat;
3993   cmd->buffer = buffer;
3994   cmd->offset = offset;
3995   cmd->size = size;
3996}
3997
3998
3999/* TextureBufferRangeEXT: marshalled asynchronously */
4000struct marshal_cmd_TextureBufferRangeEXT
4001{
4002   struct marshal_cmd_base cmd_base;
4003   GLuint texture;
4004   GLenum target;
4005   GLenum internalformat;
4006   GLuint buffer;
4007   GLintptr offset;
4008   GLsizeiptr size;
4009};
4010uint32_t
4011_mesa_unmarshal_TextureBufferRangeEXT(struct gl_context *ctx, const struct marshal_cmd_TextureBufferRangeEXT *cmd, const uint64_t *last)
4012{
4013   GLuint texture = cmd->texture;
4014   GLenum target = cmd->target;
4015   GLenum internalformat = cmd->internalformat;
4016   GLuint buffer = cmd->buffer;
4017   GLintptr offset = cmd->offset;
4018   GLsizeiptr size = cmd->size;
4019   CALL_TextureBufferRangeEXT(ctx->CurrentServerDispatch, (texture, target, internalformat, buffer, offset, size));
4020   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureBufferRangeEXT), 8) / 8);
4021   assert (cmd_size == cmd->cmd_base.cmd_size);
4022   return cmd_size;
4023}
4024void GLAPIENTRY
4025_mesa_marshal_TextureBufferRangeEXT(GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size)
4026{
4027   GET_CURRENT_CONTEXT(ctx);
4028   int cmd_size = sizeof(struct marshal_cmd_TextureBufferRangeEXT);
4029   struct marshal_cmd_TextureBufferRangeEXT *cmd;
4030   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureBufferRangeEXT, cmd_size);
4031   cmd->texture = texture;
4032   cmd->target = target;
4033   cmd->internalformat = internalformat;
4034   cmd->buffer = buffer;
4035   cmd->offset = offset;
4036   cmd->size = size;
4037}
4038
4039
4040/* TexStorage2DMultisample: marshalled asynchronously */
4041struct marshal_cmd_TexStorage2DMultisample
4042{
4043   struct marshal_cmd_base cmd_base;
4044   GLboolean fixedsamplelocations;
4045   GLenum target;
4046   GLsizei samples;
4047   GLenum internalformat;
4048   GLsizei width;
4049   GLsizei height;
4050};
4051uint32_t
4052_mesa_unmarshal_TexStorage2DMultisample(struct gl_context *ctx, const struct marshal_cmd_TexStorage2DMultisample *cmd, const uint64_t *last)
4053{
4054   GLenum target = cmd->target;
4055   GLsizei samples = cmd->samples;
4056   GLenum internalformat = cmd->internalformat;
4057   GLsizei width = cmd->width;
4058   GLsizei height = cmd->height;
4059   GLboolean fixedsamplelocations = cmd->fixedsamplelocations;
4060   CALL_TexStorage2DMultisample(ctx->CurrentServerDispatch, (target, samples, internalformat, width, height, fixedsamplelocations));
4061   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TexStorage2DMultisample), 8) / 8);
4062   assert (cmd_size == cmd->cmd_base.cmd_size);
4063   return cmd_size;
4064}
4065void GLAPIENTRY
4066_mesa_marshal_TexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
4067{
4068   GET_CURRENT_CONTEXT(ctx);
4069   int cmd_size = sizeof(struct marshal_cmd_TexStorage2DMultisample);
4070   struct marshal_cmd_TexStorage2DMultisample *cmd;
4071   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TexStorage2DMultisample, cmd_size);
4072   cmd->target = target;
4073   cmd->samples = samples;
4074   cmd->internalformat = internalformat;
4075   cmd->width = width;
4076   cmd->height = height;
4077   cmd->fixedsamplelocations = fixedsamplelocations;
4078}
4079
4080
4081/* TexStorage3DMultisample: marshalled asynchronously */
4082struct marshal_cmd_TexStorage3DMultisample
4083{
4084   struct marshal_cmd_base cmd_base;
4085   GLboolean fixedsamplelocations;
4086   GLenum target;
4087   GLsizei samples;
4088   GLenum internalformat;
4089   GLsizei width;
4090   GLsizei height;
4091   GLsizei depth;
4092};
4093uint32_t
4094_mesa_unmarshal_TexStorage3DMultisample(struct gl_context *ctx, const struct marshal_cmd_TexStorage3DMultisample *cmd, const uint64_t *last)
4095{
4096   GLenum target = cmd->target;
4097   GLsizei samples = cmd->samples;
4098   GLenum internalformat = cmd->internalformat;
4099   GLsizei width = cmd->width;
4100   GLsizei height = cmd->height;
4101   GLsizei depth = cmd->depth;
4102   GLboolean fixedsamplelocations = cmd->fixedsamplelocations;
4103   CALL_TexStorage3DMultisample(ctx->CurrentServerDispatch, (target, samples, internalformat, width, height, depth, fixedsamplelocations));
4104   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TexStorage3DMultisample), 8) / 8);
4105   assert (cmd_size == cmd->cmd_base.cmd_size);
4106   return cmd_size;
4107}
4108void GLAPIENTRY
4109_mesa_marshal_TexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
4110{
4111   GET_CURRENT_CONTEXT(ctx);
4112   int cmd_size = sizeof(struct marshal_cmd_TexStorage3DMultisample);
4113   struct marshal_cmd_TexStorage3DMultisample *cmd;
4114   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TexStorage3DMultisample, cmd_size);
4115   cmd->target = target;
4116   cmd->samples = samples;
4117   cmd->internalformat = internalformat;
4118   cmd->width = width;
4119   cmd->height = height;
4120   cmd->depth = depth;
4121   cmd->fixedsamplelocations = fixedsamplelocations;
4122}
4123
4124
4125/* TextureStorage2DMultisampleEXT: marshalled asynchronously */
4126struct marshal_cmd_TextureStorage2DMultisampleEXT
4127{
4128   struct marshal_cmd_base cmd_base;
4129   GLboolean fixedsamplelocations;
4130   GLuint texture;
4131   GLenum target;
4132   GLsizei samples;
4133   GLenum internalformat;
4134   GLsizei width;
4135   GLsizei height;
4136};
4137uint32_t
4138_mesa_unmarshal_TextureStorage2DMultisampleEXT(struct gl_context *ctx, const struct marshal_cmd_TextureStorage2DMultisampleEXT *cmd, const uint64_t *last)
4139{
4140   GLuint texture = cmd->texture;
4141   GLenum target = cmd->target;
4142   GLsizei samples = cmd->samples;
4143   GLenum internalformat = cmd->internalformat;
4144   GLsizei width = cmd->width;
4145   GLsizei height = cmd->height;
4146   GLboolean fixedsamplelocations = cmd->fixedsamplelocations;
4147   CALL_TextureStorage2DMultisampleEXT(ctx->CurrentServerDispatch, (texture, target, samples, internalformat, width, height, fixedsamplelocations));
4148   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureStorage2DMultisampleEXT), 8) / 8);
4149   assert (cmd_size == cmd->cmd_base.cmd_size);
4150   return cmd_size;
4151}
4152void GLAPIENTRY
4153_mesa_marshal_TextureStorage2DMultisampleEXT(GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
4154{
4155   GET_CURRENT_CONTEXT(ctx);
4156   int cmd_size = sizeof(struct marshal_cmd_TextureStorage2DMultisampleEXT);
4157   struct marshal_cmd_TextureStorage2DMultisampleEXT *cmd;
4158   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureStorage2DMultisampleEXT, cmd_size);
4159   cmd->texture = texture;
4160   cmd->target = target;
4161   cmd->samples = samples;
4162   cmd->internalformat = internalformat;
4163   cmd->width = width;
4164   cmd->height = height;
4165   cmd->fixedsamplelocations = fixedsamplelocations;
4166}
4167
4168
4169/* TextureStorage3DMultisampleEXT: marshalled asynchronously */
4170struct marshal_cmd_TextureStorage3DMultisampleEXT
4171{
4172   struct marshal_cmd_base cmd_base;
4173   GLboolean fixedsamplelocations;
4174   GLuint texture;
4175   GLenum target;
4176   GLsizei samples;
4177   GLenum internalformat;
4178   GLsizei width;
4179   GLsizei height;
4180   GLsizei depth;
4181};
4182uint32_t
4183_mesa_unmarshal_TextureStorage3DMultisampleEXT(struct gl_context *ctx, const struct marshal_cmd_TextureStorage3DMultisampleEXT *cmd, const uint64_t *last)
4184{
4185   GLuint texture = cmd->texture;
4186   GLenum target = cmd->target;
4187   GLsizei samples = cmd->samples;
4188   GLenum internalformat = cmd->internalformat;
4189   GLsizei width = cmd->width;
4190   GLsizei height = cmd->height;
4191   GLsizei depth = cmd->depth;
4192   GLboolean fixedsamplelocations = cmd->fixedsamplelocations;
4193   CALL_TextureStorage3DMultisampleEXT(ctx->CurrentServerDispatch, (texture, target, samples, internalformat, width, height, depth, fixedsamplelocations));
4194   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureStorage3DMultisampleEXT), 8) / 8);
4195   assert (cmd_size == cmd->cmd_base.cmd_size);
4196   return cmd_size;
4197}
4198void GLAPIENTRY
4199_mesa_marshal_TextureStorage3DMultisampleEXT(GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
4200{
4201   GET_CURRENT_CONTEXT(ctx);
4202   int cmd_size = sizeof(struct marshal_cmd_TextureStorage3DMultisampleEXT);
4203   struct marshal_cmd_TextureStorage3DMultisampleEXT *cmd;
4204   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureStorage3DMultisampleEXT, cmd_size);
4205   cmd->texture = texture;
4206   cmd->target = target;
4207   cmd->samples = samples;
4208   cmd->internalformat = internalformat;
4209   cmd->width = width;
4210   cmd->height = height;
4211   cmd->depth = depth;
4212   cmd->fixedsamplelocations = fixedsamplelocations;
4213}
4214
4215
4216/* BufferStorage: marshalled synchronously */
4217void GLAPIENTRY
4218_mesa_marshal_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid * data, GLbitfield flags)
4219{
4220   GET_CURRENT_CONTEXT(ctx);
4221   _mesa_glthread_finish_before(ctx, "BufferStorage");
4222   CALL_BufferStorage(ctx->CurrentServerDispatch, (target, size, data, flags));
4223}
4224
4225
4226/* NamedBufferStorageEXT: marshalled synchronously */
4227void GLAPIENTRY
4228_mesa_marshal_NamedBufferStorageEXT(GLuint buffer, GLsizeiptr size, const GLvoid * data, GLbitfield flags)
4229{
4230   GET_CURRENT_CONTEXT(ctx);
4231   _mesa_glthread_finish_before(ctx, "NamedBufferStorageEXT");
4232   CALL_NamedBufferStorageEXT(ctx->CurrentServerDispatch, (buffer, size, data, flags));
4233}
4234
4235
4236/* ClearTexImage: marshalled synchronously */
4237void GLAPIENTRY
4238_mesa_marshal_ClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const GLvoid * data)
4239{
4240   GET_CURRENT_CONTEXT(ctx);
4241   _mesa_glthread_finish_before(ctx, "ClearTexImage");
4242   CALL_ClearTexImage(ctx->CurrentServerDispatch, (texture, level, format, type, data));
4243}
4244
4245
4246/* ClearTexSubImage: marshalled synchronously */
4247void GLAPIENTRY
4248_mesa_marshal_ClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * data)
4249{
4250   GET_CURRENT_CONTEXT(ctx);
4251   _mesa_glthread_finish_before(ctx, "ClearTexSubImage");
4252   CALL_ClearTexSubImage(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data));
4253}
4254
4255
4256/* BindBuffersBase: marshalled asynchronously */
4257struct marshal_cmd_BindBuffersBase
4258{
4259   struct marshal_cmd_base cmd_base;
4260   GLenum target;
4261   GLuint first;
4262   GLsizei count;
4263   /* Next safe_mul(count, 1 * sizeof(GLuint)) bytes are GLuint buffers[count] */
4264};
4265uint32_t
4266_mesa_unmarshal_BindBuffersBase(struct gl_context *ctx, const struct marshal_cmd_BindBuffersBase *cmd, const uint64_t *last)
4267{
4268   GLenum target = cmd->target;
4269   GLuint first = cmd->first;
4270   GLsizei count = cmd->count;
4271   GLuint * buffers;
4272   const char *variable_data = (const char *) (cmd + 1);
4273   buffers = (GLuint *) variable_data;
4274   CALL_BindBuffersBase(ctx->CurrentServerDispatch, (target, first, count, buffers));
4275   return cmd->cmd_base.cmd_size;
4276}
4277void GLAPIENTRY
4278_mesa_marshal_BindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint * buffers)
4279{
4280   GET_CURRENT_CONTEXT(ctx);
4281   int buffers_size = safe_mul(count, 1 * sizeof(GLuint));
4282   int cmd_size = sizeof(struct marshal_cmd_BindBuffersBase) + buffers_size;
4283   struct marshal_cmd_BindBuffersBase *cmd;
4284   if (unlikely(buffers_size < 0 || (buffers_size > 0 && !buffers) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
4285      _mesa_glthread_finish_before(ctx, "BindBuffersBase");
4286      CALL_BindBuffersBase(ctx->CurrentServerDispatch, (target, first, count, buffers));
4287      return;
4288   }
4289   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_BindBuffersBase, cmd_size);
4290   cmd->target = target;
4291   cmd->first = first;
4292   cmd->count = count;
4293   char *variable_data = (char *) (cmd + 1);
4294   memcpy(variable_data, buffers, buffers_size);
4295}
4296
4297
4298/* BindBuffersRange: marshalled asynchronously */
4299struct marshal_cmd_BindBuffersRange
4300{
4301   struct marshal_cmd_base cmd_base;
4302   GLenum target;
4303   GLuint first;
4304   GLsizei count;
4305   /* Next safe_mul(count, 1 * sizeof(GLuint)) bytes are GLuint buffers[count] */
4306   /* Next safe_mul(count, 1 * sizeof(GLintptr)) bytes are GLintptr offsets[count] */
4307   /* Next safe_mul(count, 1 * sizeof(GLsizeiptr)) bytes are GLsizeiptr sizes[count] */
4308};
4309uint32_t
4310_mesa_unmarshal_BindBuffersRange(struct gl_context *ctx, const struct marshal_cmd_BindBuffersRange *cmd, const uint64_t *last)
4311{
4312   GLenum target = cmd->target;
4313   GLuint first = cmd->first;
4314   GLsizei count = cmd->count;
4315   GLuint * buffers;
4316   GLintptr * offsets;
4317   GLsizeiptr * sizes;
4318   const char *variable_data = (const char *) (cmd + 1);
4319   buffers = (GLuint *) variable_data;
4320   variable_data += count * 1 * sizeof(GLuint);
4321   offsets = (GLintptr *) variable_data;
4322   variable_data += count * 1 * sizeof(GLintptr);
4323   sizes = (GLsizeiptr *) variable_data;
4324   CALL_BindBuffersRange(ctx->CurrentServerDispatch, (target, first, count, buffers, offsets, sizes));
4325   return cmd->cmd_base.cmd_size;
4326}
4327void GLAPIENTRY
4328_mesa_marshal_BindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint * buffers, const GLintptr * offsets, const GLsizeiptr * sizes)
4329{
4330   GET_CURRENT_CONTEXT(ctx);
4331   int buffers_size = safe_mul(count, 1 * sizeof(GLuint));
4332   int offsets_size = safe_mul(count, 1 * sizeof(GLintptr));
4333   int sizes_size = safe_mul(count, 1 * sizeof(GLsizeiptr));
4334   int cmd_size = sizeof(struct marshal_cmd_BindBuffersRange) + buffers_size + offsets_size + sizes_size;
4335   struct marshal_cmd_BindBuffersRange *cmd;
4336   if (unlikely(buffers_size < 0 || (buffers_size > 0 && !buffers) || offsets_size < 0 || (offsets_size > 0 && !offsets) || sizes_size < 0 || (sizes_size > 0 && !sizes) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
4337      _mesa_glthread_finish_before(ctx, "BindBuffersRange");
4338      CALL_BindBuffersRange(ctx->CurrentServerDispatch, (target, first, count, buffers, offsets, sizes));
4339      return;
4340   }
4341   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_BindBuffersRange, cmd_size);
4342   cmd->target = target;
4343   cmd->first = first;
4344   cmd->count = count;
4345   char *variable_data = (char *) (cmd + 1);
4346   memcpy(variable_data, buffers, buffers_size);
4347   variable_data += buffers_size;
4348   memcpy(variable_data, offsets, offsets_size);
4349   variable_data += offsets_size;
4350   memcpy(variable_data, sizes, sizes_size);
4351}
4352
4353
4354/* BindTextures: marshalled asynchronously */
4355struct marshal_cmd_BindTextures
4356{
4357   struct marshal_cmd_base cmd_base;
4358   GLuint first;
4359   GLsizei count;
4360   /* Next safe_mul(count, 1 * sizeof(GLuint)) bytes are GLuint textures[count] */
4361};
4362uint32_t
4363_mesa_unmarshal_BindTextures(struct gl_context *ctx, const struct marshal_cmd_BindTextures *cmd, const uint64_t *last)
4364{
4365   GLuint first = cmd->first;
4366   GLsizei count = cmd->count;
4367   GLuint * textures;
4368   const char *variable_data = (const char *) (cmd + 1);
4369   textures = (GLuint *) variable_data;
4370   CALL_BindTextures(ctx->CurrentServerDispatch, (first, count, textures));
4371   return cmd->cmd_base.cmd_size;
4372}
4373void GLAPIENTRY
4374_mesa_marshal_BindTextures(GLuint first, GLsizei count, const GLuint * textures)
4375{
4376   GET_CURRENT_CONTEXT(ctx);
4377   int textures_size = safe_mul(count, 1 * sizeof(GLuint));
4378   int cmd_size = sizeof(struct marshal_cmd_BindTextures) + textures_size;
4379   struct marshal_cmd_BindTextures *cmd;
4380   if (unlikely(textures_size < 0 || (textures_size > 0 && !textures) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
4381      _mesa_glthread_finish_before(ctx, "BindTextures");
4382      CALL_BindTextures(ctx->CurrentServerDispatch, (first, count, textures));
4383      return;
4384   }
4385   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_BindTextures, cmd_size);
4386   cmd->first = first;
4387   cmd->count = count;
4388   char *variable_data = (char *) (cmd + 1);
4389   memcpy(variable_data, textures, textures_size);
4390}
4391
4392
4393/* BindSamplers: marshalled asynchronously */
4394struct marshal_cmd_BindSamplers
4395{
4396   struct marshal_cmd_base cmd_base;
4397   GLuint first;
4398   GLsizei count;
4399   /* Next safe_mul(count, 1 * sizeof(GLuint)) bytes are GLuint samplers[count] */
4400};
4401uint32_t
4402_mesa_unmarshal_BindSamplers(struct gl_context *ctx, const struct marshal_cmd_BindSamplers *cmd, const uint64_t *last)
4403{
4404   GLuint first = cmd->first;
4405   GLsizei count = cmd->count;
4406   GLuint * samplers;
4407   const char *variable_data = (const char *) (cmd + 1);
4408   samplers = (GLuint *) variable_data;
4409   CALL_BindSamplers(ctx->CurrentServerDispatch, (first, count, samplers));
4410   return cmd->cmd_base.cmd_size;
4411}
4412void GLAPIENTRY
4413_mesa_marshal_BindSamplers(GLuint first, GLsizei count, const GLuint * samplers)
4414{
4415   GET_CURRENT_CONTEXT(ctx);
4416   int samplers_size = safe_mul(count, 1 * sizeof(GLuint));
4417   int cmd_size = sizeof(struct marshal_cmd_BindSamplers) + samplers_size;
4418   struct marshal_cmd_BindSamplers *cmd;
4419   if (unlikely(samplers_size < 0 || (samplers_size > 0 && !samplers) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
4420      _mesa_glthread_finish_before(ctx, "BindSamplers");
4421      CALL_BindSamplers(ctx->CurrentServerDispatch, (first, count, samplers));
4422      return;
4423   }
4424   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_BindSamplers, cmd_size);
4425   cmd->first = first;
4426   cmd->count = count;
4427   char *variable_data = (char *) (cmd + 1);
4428   memcpy(variable_data, samplers, samplers_size);
4429}
4430
4431
4432/* BindImageTextures: marshalled asynchronously */
4433struct marshal_cmd_BindImageTextures
4434{
4435   struct marshal_cmd_base cmd_base;
4436   GLuint first;
4437   GLsizei count;
4438   /* Next safe_mul(count, 1 * sizeof(GLuint)) bytes are GLuint textures[count] */
4439};
4440uint32_t
4441_mesa_unmarshal_BindImageTextures(struct gl_context *ctx, const struct marshal_cmd_BindImageTextures *cmd, const uint64_t *last)
4442{
4443   GLuint first = cmd->first;
4444   GLsizei count = cmd->count;
4445   GLuint * textures;
4446   const char *variable_data = (const char *) (cmd + 1);
4447   textures = (GLuint *) variable_data;
4448   CALL_BindImageTextures(ctx->CurrentServerDispatch, (first, count, textures));
4449   return cmd->cmd_base.cmd_size;
4450}
4451void GLAPIENTRY
4452_mesa_marshal_BindImageTextures(GLuint first, GLsizei count, const GLuint * textures)
4453{
4454   GET_CURRENT_CONTEXT(ctx);
4455   int textures_size = safe_mul(count, 1 * sizeof(GLuint));
4456   int cmd_size = sizeof(struct marshal_cmd_BindImageTextures) + textures_size;
4457   struct marshal_cmd_BindImageTextures *cmd;
4458   if (unlikely(textures_size < 0 || (textures_size > 0 && !textures) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
4459      _mesa_glthread_finish_before(ctx, "BindImageTextures");
4460      CALL_BindImageTextures(ctx->CurrentServerDispatch, (first, count, textures));
4461      return;
4462   }
4463   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_BindImageTextures, cmd_size);
4464   cmd->first = first;
4465   cmd->count = count;
4466   char *variable_data = (char *) (cmd + 1);
4467   memcpy(variable_data, textures, textures_size);
4468}
4469
4470
4471/* BindVertexBuffers: marshalled asynchronously */
4472struct marshal_cmd_BindVertexBuffers
4473{
4474   struct marshal_cmd_base cmd_base;
4475   GLuint first;
4476   GLsizei count;
4477   /* Next safe_mul(count, 1 * sizeof(GLuint)) bytes are GLuint buffers[count] */
4478   /* Next safe_mul(count, 1 * sizeof(GLintptr)) bytes are GLintptr offsets[count] */
4479   /* Next safe_mul(count, 1 * sizeof(GLsizei)) bytes are GLsizei strides[count] */
4480};
4481uint32_t
4482_mesa_unmarshal_BindVertexBuffers(struct gl_context *ctx, const struct marshal_cmd_BindVertexBuffers *cmd, const uint64_t *last)
4483{
4484   GLuint first = cmd->first;
4485   GLsizei count = cmd->count;
4486   GLuint * buffers;
4487   GLintptr * offsets;
4488   GLsizei * strides;
4489   const char *variable_data = (const char *) (cmd + 1);
4490   buffers = (GLuint *) variable_data;
4491   variable_data += count * 1 * sizeof(GLuint);
4492   offsets = (GLintptr *) variable_data;
4493   variable_data += count * 1 * sizeof(GLintptr);
4494   strides = (GLsizei *) variable_data;
4495   CALL_BindVertexBuffers(ctx->CurrentServerDispatch, (first, count, buffers, offsets, strides));
4496   return cmd->cmd_base.cmd_size;
4497}
4498void GLAPIENTRY
4499_mesa_marshal_BindVertexBuffers(GLuint first, GLsizei count, const GLuint * buffers, const GLintptr * offsets, const GLsizei * strides)
4500{
4501   GET_CURRENT_CONTEXT(ctx);
4502   int buffers_size = safe_mul(count, 1 * sizeof(GLuint));
4503   int offsets_size = safe_mul(count, 1 * sizeof(GLintptr));
4504   int strides_size = safe_mul(count, 1 * sizeof(GLsizei));
4505   int cmd_size = sizeof(struct marshal_cmd_BindVertexBuffers) + buffers_size + offsets_size + strides_size;
4506   struct marshal_cmd_BindVertexBuffers *cmd;
4507   if (unlikely(buffers_size < 0 || (buffers_size > 0 && !buffers) || offsets_size < 0 || (offsets_size > 0 && !offsets) || strides_size < 0 || (strides_size > 0 && !strides) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
4508      _mesa_glthread_finish_before(ctx, "BindVertexBuffers");
4509      CALL_BindVertexBuffers(ctx->CurrentServerDispatch, (first, count, buffers, offsets, strides));
4510      return;
4511   }
4512   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_BindVertexBuffers, cmd_size);
4513   cmd->first = first;
4514   cmd->count = count;
4515   char *variable_data = (char *) (cmd + 1);
4516   memcpy(variable_data, buffers, buffers_size);
4517   variable_data += buffers_size;
4518   memcpy(variable_data, offsets, offsets_size);
4519   variable_data += offsets_size;
4520   memcpy(variable_data, strides, strides_size);
4521}
4522
4523
4524/* GetTextureHandleARB: marshalled synchronously */
4525GLuint64 GLAPIENTRY
4526_mesa_marshal_GetTextureHandleARB(GLuint texture)
4527{
4528   GET_CURRENT_CONTEXT(ctx);
4529   _mesa_glthread_finish_before(ctx, "GetTextureHandleARB");
4530   return CALL_GetTextureHandleARB(ctx->CurrentServerDispatch, (texture));
4531}
4532
4533
4534/* GetTextureSamplerHandleARB: marshalled synchronously */
4535GLuint64 GLAPIENTRY
4536_mesa_marshal_GetTextureSamplerHandleARB(GLuint texture, GLuint sampler)
4537{
4538   GET_CURRENT_CONTEXT(ctx);
4539   _mesa_glthread_finish_before(ctx, "GetTextureSamplerHandleARB");
4540   return CALL_GetTextureSamplerHandleARB(ctx->CurrentServerDispatch, (texture, sampler));
4541}
4542
4543
4544/* MakeTextureHandleResidentARB: marshalled asynchronously */
4545struct marshal_cmd_MakeTextureHandleResidentARB
4546{
4547   struct marshal_cmd_base cmd_base;
4548   GLuint64 handle;
4549};
4550uint32_t
4551_mesa_unmarshal_MakeTextureHandleResidentARB(struct gl_context *ctx, const struct marshal_cmd_MakeTextureHandleResidentARB *cmd, const uint64_t *last)
4552{
4553   GLuint64 handle = cmd->handle;
4554   CALL_MakeTextureHandleResidentARB(ctx->CurrentServerDispatch, (handle));
4555   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_MakeTextureHandleResidentARB), 8) / 8);
4556   assert (cmd_size == cmd->cmd_base.cmd_size);
4557   return cmd_size;
4558}
4559void GLAPIENTRY
4560_mesa_marshal_MakeTextureHandleResidentARB(GLuint64 handle)
4561{
4562   GET_CURRENT_CONTEXT(ctx);
4563   int cmd_size = sizeof(struct marshal_cmd_MakeTextureHandleResidentARB);
4564   struct marshal_cmd_MakeTextureHandleResidentARB *cmd;
4565   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_MakeTextureHandleResidentARB, cmd_size);
4566   cmd->handle = handle;
4567}
4568
4569
4570/* MakeTextureHandleNonResidentARB: marshalled asynchronously */
4571struct marshal_cmd_MakeTextureHandleNonResidentARB
4572{
4573   struct marshal_cmd_base cmd_base;
4574   GLuint64 handle;
4575};
4576uint32_t
4577_mesa_unmarshal_MakeTextureHandleNonResidentARB(struct gl_context *ctx, const struct marshal_cmd_MakeTextureHandleNonResidentARB *cmd, const uint64_t *last)
4578{
4579   GLuint64 handle = cmd->handle;
4580   CALL_MakeTextureHandleNonResidentARB(ctx->CurrentServerDispatch, (handle));
4581   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_MakeTextureHandleNonResidentARB), 8) / 8);
4582   assert (cmd_size == cmd->cmd_base.cmd_size);
4583   return cmd_size;
4584}
4585void GLAPIENTRY
4586_mesa_marshal_MakeTextureHandleNonResidentARB(GLuint64 handle)
4587{
4588   GET_CURRENT_CONTEXT(ctx);
4589   int cmd_size = sizeof(struct marshal_cmd_MakeTextureHandleNonResidentARB);
4590   struct marshal_cmd_MakeTextureHandleNonResidentARB *cmd;
4591   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_MakeTextureHandleNonResidentARB, cmd_size);
4592   cmd->handle = handle;
4593}
4594
4595
4596/* GetImageHandleARB: marshalled synchronously */
4597GLuint64 GLAPIENTRY
4598_mesa_marshal_GetImageHandleARB(GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format)
4599{
4600   GET_CURRENT_CONTEXT(ctx);
4601   _mesa_glthread_finish_before(ctx, "GetImageHandleARB");
4602   return CALL_GetImageHandleARB(ctx->CurrentServerDispatch, (texture, level, layered, layer, format));
4603}
4604
4605
4606/* MakeImageHandleResidentARB: marshalled asynchronously */
4607struct marshal_cmd_MakeImageHandleResidentARB
4608{
4609   struct marshal_cmd_base cmd_base;
4610   GLenum access;
4611   GLuint64 handle;
4612};
4613uint32_t
4614_mesa_unmarshal_MakeImageHandleResidentARB(struct gl_context *ctx, const struct marshal_cmd_MakeImageHandleResidentARB *cmd, const uint64_t *last)
4615{
4616   GLuint64 handle = cmd->handle;
4617   GLenum access = cmd->access;
4618   CALL_MakeImageHandleResidentARB(ctx->CurrentServerDispatch, (handle, access));
4619   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_MakeImageHandleResidentARB), 8) / 8);
4620   assert (cmd_size == cmd->cmd_base.cmd_size);
4621   return cmd_size;
4622}
4623void GLAPIENTRY
4624_mesa_marshal_MakeImageHandleResidentARB(GLuint64 handle, GLenum access)
4625{
4626   GET_CURRENT_CONTEXT(ctx);
4627   int cmd_size = sizeof(struct marshal_cmd_MakeImageHandleResidentARB);
4628   struct marshal_cmd_MakeImageHandleResidentARB *cmd;
4629   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_MakeImageHandleResidentARB, cmd_size);
4630   cmd->handle = handle;
4631   cmd->access = access;
4632}
4633
4634
4635/* MakeImageHandleNonResidentARB: marshalled asynchronously */
4636struct marshal_cmd_MakeImageHandleNonResidentARB
4637{
4638   struct marshal_cmd_base cmd_base;
4639   GLuint64 handle;
4640};
4641uint32_t
4642_mesa_unmarshal_MakeImageHandleNonResidentARB(struct gl_context *ctx, const struct marshal_cmd_MakeImageHandleNonResidentARB *cmd, const uint64_t *last)
4643{
4644   GLuint64 handle = cmd->handle;
4645   CALL_MakeImageHandleNonResidentARB(ctx->CurrentServerDispatch, (handle));
4646   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_MakeImageHandleNonResidentARB), 8) / 8);
4647   assert (cmd_size == cmd->cmd_base.cmd_size);
4648   return cmd_size;
4649}
4650void GLAPIENTRY
4651_mesa_marshal_MakeImageHandleNonResidentARB(GLuint64 handle)
4652{
4653   GET_CURRENT_CONTEXT(ctx);
4654   int cmd_size = sizeof(struct marshal_cmd_MakeImageHandleNonResidentARB);
4655   struct marshal_cmd_MakeImageHandleNonResidentARB *cmd;
4656   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_MakeImageHandleNonResidentARB, cmd_size);
4657   cmd->handle = handle;
4658}
4659
4660
4661/* UniformHandleui64ARB: marshalled asynchronously */
4662struct marshal_cmd_UniformHandleui64ARB
4663{
4664   struct marshal_cmd_base cmd_base;
4665   GLint location;
4666   GLuint64 value;
4667};
4668uint32_t
4669_mesa_unmarshal_UniformHandleui64ARB(struct gl_context *ctx, const struct marshal_cmd_UniformHandleui64ARB *cmd, const uint64_t *last)
4670{
4671   GLint location = cmd->location;
4672   GLuint64 value = cmd->value;
4673   CALL_UniformHandleui64ARB(ctx->CurrentServerDispatch, (location, value));
4674   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_UniformHandleui64ARB), 8) / 8);
4675   assert (cmd_size == cmd->cmd_base.cmd_size);
4676   return cmd_size;
4677}
4678void GLAPIENTRY
4679_mesa_marshal_UniformHandleui64ARB(GLint location, GLuint64 value)
4680{
4681   GET_CURRENT_CONTEXT(ctx);
4682   int cmd_size = sizeof(struct marshal_cmd_UniformHandleui64ARB);
4683   struct marshal_cmd_UniformHandleui64ARB *cmd;
4684   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_UniformHandleui64ARB, cmd_size);
4685   cmd->location = location;
4686   cmd->value = value;
4687}
4688
4689
4690/* UniformHandleui64vARB: marshalled asynchronously */
4691struct marshal_cmd_UniformHandleui64vARB
4692{
4693   struct marshal_cmd_base cmd_base;
4694   GLint location;
4695   GLsizei count;
4696   /* Next safe_mul(count, 1 * sizeof(GLuint64)) bytes are GLuint64 value[count] */
4697};
4698uint32_t
4699_mesa_unmarshal_UniformHandleui64vARB(struct gl_context *ctx, const struct marshal_cmd_UniformHandleui64vARB *cmd, const uint64_t *last)
4700{
4701   GLint location = cmd->location;
4702   GLsizei count = cmd->count;
4703   GLuint64 * value;
4704   const char *variable_data = (const char *) (cmd + 1);
4705   value = (GLuint64 *) variable_data;
4706   CALL_UniformHandleui64vARB(ctx->CurrentServerDispatch, (location, count, value));
4707   return cmd->cmd_base.cmd_size;
4708}
4709void GLAPIENTRY
4710_mesa_marshal_UniformHandleui64vARB(GLint location, GLsizei count, const GLuint64 * value)
4711{
4712   GET_CURRENT_CONTEXT(ctx);
4713   int value_size = safe_mul(count, 1 * sizeof(GLuint64));
4714   int cmd_size = sizeof(struct marshal_cmd_UniformHandleui64vARB) + value_size;
4715   struct marshal_cmd_UniformHandleui64vARB *cmd;
4716   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
4717      _mesa_glthread_finish_before(ctx, "UniformHandleui64vARB");
4718      CALL_UniformHandleui64vARB(ctx->CurrentServerDispatch, (location, count, value));
4719      return;
4720   }
4721   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_UniformHandleui64vARB, cmd_size);
4722   cmd->location = location;
4723   cmd->count = count;
4724   char *variable_data = (char *) (cmd + 1);
4725   memcpy(variable_data, value, value_size);
4726}
4727
4728
4729/* ProgramUniformHandleui64ARB: marshalled asynchronously */
4730struct marshal_cmd_ProgramUniformHandleui64ARB
4731{
4732   struct marshal_cmd_base cmd_base;
4733   GLuint program;
4734   GLint location;
4735   GLuint64 value;
4736};
4737uint32_t
4738_mesa_unmarshal_ProgramUniformHandleui64ARB(struct gl_context *ctx, const struct marshal_cmd_ProgramUniformHandleui64ARB *cmd, const uint64_t *last)
4739{
4740   GLuint program = cmd->program;
4741   GLint location = cmd->location;
4742   GLuint64 value = cmd->value;
4743   CALL_ProgramUniformHandleui64ARB(ctx->CurrentServerDispatch, (program, location, value));
4744   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ProgramUniformHandleui64ARB), 8) / 8);
4745   assert (cmd_size == cmd->cmd_base.cmd_size);
4746   return cmd_size;
4747}
4748void GLAPIENTRY
4749_mesa_marshal_ProgramUniformHandleui64ARB(GLuint program, GLint location, GLuint64 value)
4750{
4751   GET_CURRENT_CONTEXT(ctx);
4752   int cmd_size = sizeof(struct marshal_cmd_ProgramUniformHandleui64ARB);
4753   struct marshal_cmd_ProgramUniformHandleui64ARB *cmd;
4754   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniformHandleui64ARB, cmd_size);
4755   cmd->program = program;
4756   cmd->location = location;
4757   cmd->value = value;
4758}
4759
4760
4761/* ProgramUniformHandleui64vARB: marshalled asynchronously */
4762struct marshal_cmd_ProgramUniformHandleui64vARB
4763{
4764   struct marshal_cmd_base cmd_base;
4765   GLuint program;
4766   GLint location;
4767   GLsizei count;
4768   /* Next safe_mul(count, 1 * sizeof(GLuint64)) bytes are GLuint64 value[count] */
4769};
4770uint32_t
4771_mesa_unmarshal_ProgramUniformHandleui64vARB(struct gl_context *ctx, const struct marshal_cmd_ProgramUniformHandleui64vARB *cmd, const uint64_t *last)
4772{
4773   GLuint program = cmd->program;
4774   GLint location = cmd->location;
4775   GLsizei count = cmd->count;
4776   GLuint64 * value;
4777   const char *variable_data = (const char *) (cmd + 1);
4778   value = (GLuint64 *) variable_data;
4779   CALL_ProgramUniformHandleui64vARB(ctx->CurrentServerDispatch, (program, location, count, value));
4780   return cmd->cmd_base.cmd_size;
4781}
4782void GLAPIENTRY
4783_mesa_marshal_ProgramUniformHandleui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64 * value)
4784{
4785   GET_CURRENT_CONTEXT(ctx);
4786   int value_size = safe_mul(count, 1 * sizeof(GLuint64));
4787   int cmd_size = sizeof(struct marshal_cmd_ProgramUniformHandleui64vARB) + value_size;
4788   struct marshal_cmd_ProgramUniformHandleui64vARB *cmd;
4789   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
4790      _mesa_glthread_finish_before(ctx, "ProgramUniformHandleui64vARB");
4791      CALL_ProgramUniformHandleui64vARB(ctx->CurrentServerDispatch, (program, location, count, value));
4792      return;
4793   }
4794   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ProgramUniformHandleui64vARB, cmd_size);
4795   cmd->program = program;
4796   cmd->location = location;
4797   cmd->count = count;
4798   char *variable_data = (char *) (cmd + 1);
4799   memcpy(variable_data, value, value_size);
4800}
4801
4802
4803/* IsTextureHandleResidentARB: marshalled synchronously */
4804GLboolean GLAPIENTRY
4805_mesa_marshal_IsTextureHandleResidentARB(GLuint64 handle)
4806{
4807   GET_CURRENT_CONTEXT(ctx);
4808   _mesa_glthread_finish_before(ctx, "IsTextureHandleResidentARB");
4809   return CALL_IsTextureHandleResidentARB(ctx->CurrentServerDispatch, (handle));
4810}
4811
4812
4813/* IsImageHandleResidentARB: marshalled synchronously */
4814GLboolean GLAPIENTRY
4815_mesa_marshal_IsImageHandleResidentARB(GLuint64 handle)
4816{
4817   GET_CURRENT_CONTEXT(ctx);
4818   _mesa_glthread_finish_before(ctx, "IsImageHandleResidentARB");
4819   return CALL_IsImageHandleResidentARB(ctx->CurrentServerDispatch, (handle));
4820}
4821
4822
4823/* VertexAttribL1ui64ARB: marshalled asynchronously */
4824struct marshal_cmd_VertexAttribL1ui64ARB
4825{
4826   struct marshal_cmd_base cmd_base;
4827   GLuint index;
4828   GLuint64EXT x;
4829};
4830uint32_t
4831_mesa_unmarshal_VertexAttribL1ui64ARB(struct gl_context *ctx, const struct marshal_cmd_VertexAttribL1ui64ARB *cmd, const uint64_t *last)
4832{
4833   GLuint index = cmd->index;
4834   GLuint64EXT x = cmd->x;
4835   CALL_VertexAttribL1ui64ARB(ctx->CurrentServerDispatch, (index, x));
4836   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribL1ui64ARB), 8) / 8);
4837   assert (cmd_size == cmd->cmd_base.cmd_size);
4838   return cmd_size;
4839}
4840void GLAPIENTRY
4841_mesa_marshal_VertexAttribL1ui64ARB(GLuint index, GLuint64EXT x)
4842{
4843   GET_CURRENT_CONTEXT(ctx);
4844   int cmd_size = sizeof(struct marshal_cmd_VertexAttribL1ui64ARB);
4845   struct marshal_cmd_VertexAttribL1ui64ARB *cmd;
4846   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribL1ui64ARB, cmd_size);
4847   cmd->index = index;
4848   cmd->x = x;
4849}
4850
4851
4852/* VertexAttribL1ui64vARB: marshalled asynchronously */
4853struct marshal_cmd_VertexAttribL1ui64vARB
4854{
4855   struct marshal_cmd_base cmd_base;
4856   GLuint index;
4857   GLuint64EXT v[1];
4858};
4859uint32_t
4860_mesa_unmarshal_VertexAttribL1ui64vARB(struct gl_context *ctx, const struct marshal_cmd_VertexAttribL1ui64vARB *cmd, const uint64_t *last)
4861{
4862   GLuint index = cmd->index;
4863   const GLuint64EXT * v = cmd->v;
4864   CALL_VertexAttribL1ui64vARB(ctx->CurrentServerDispatch, (index, v));
4865   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexAttribL1ui64vARB), 8) / 8);
4866   assert (cmd_size == cmd->cmd_base.cmd_size);
4867   return cmd_size;
4868}
4869void GLAPIENTRY
4870_mesa_marshal_VertexAttribL1ui64vARB(GLuint index, const GLuint64EXT * v)
4871{
4872   GET_CURRENT_CONTEXT(ctx);
4873   int cmd_size = sizeof(struct marshal_cmd_VertexAttribL1ui64vARB);
4874   struct marshal_cmd_VertexAttribL1ui64vARB *cmd;
4875   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexAttribL1ui64vARB, cmd_size);
4876   cmd->index = index;
4877   memcpy(cmd->v, v, 1 * sizeof(GLuint64EXT));
4878}
4879
4880
4881/* GetVertexAttribLui64vARB: marshalled synchronously */
4882void GLAPIENTRY
4883_mesa_marshal_GetVertexAttribLui64vARB(GLuint index, GLenum pname, GLuint64EXT * params)
4884{
4885   GET_CURRENT_CONTEXT(ctx);
4886   _mesa_glthread_finish_before(ctx, "GetVertexAttribLui64vARB");
4887   CALL_GetVertexAttribLui64vARB(ctx->CurrentServerDispatch, (index, pname, params));
4888}
4889
4890
4891/* DispatchComputeGroupSizeARB: marshalled asynchronously */
4892struct marshal_cmd_DispatchComputeGroupSizeARB
4893{
4894   struct marshal_cmd_base cmd_base;
4895   GLuint num_groups_x;
4896   GLuint num_groups_y;
4897   GLuint num_groups_z;
4898   GLuint group_size_x;
4899   GLuint group_size_y;
4900   GLuint group_size_z;
4901};
4902uint32_t
4903_mesa_unmarshal_DispatchComputeGroupSizeARB(struct gl_context *ctx, const struct marshal_cmd_DispatchComputeGroupSizeARB *cmd, const uint64_t *last)
4904{
4905   GLuint num_groups_x = cmd->num_groups_x;
4906   GLuint num_groups_y = cmd->num_groups_y;
4907   GLuint num_groups_z = cmd->num_groups_z;
4908   GLuint group_size_x = cmd->group_size_x;
4909   GLuint group_size_y = cmd->group_size_y;
4910   GLuint group_size_z = cmd->group_size_z;
4911   CALL_DispatchComputeGroupSizeARB(ctx->CurrentServerDispatch, (num_groups_x, num_groups_y, num_groups_z, group_size_x, group_size_y, group_size_z));
4912   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_DispatchComputeGroupSizeARB), 8) / 8);
4913   assert (cmd_size == cmd->cmd_base.cmd_size);
4914   return cmd_size;
4915}
4916void GLAPIENTRY
4917_mesa_marshal_DispatchComputeGroupSizeARB(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z)
4918{
4919   GET_CURRENT_CONTEXT(ctx);
4920   int cmd_size = sizeof(struct marshal_cmd_DispatchComputeGroupSizeARB);
4921   struct marshal_cmd_DispatchComputeGroupSizeARB *cmd;
4922   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DispatchComputeGroupSizeARB, cmd_size);
4923   cmd->num_groups_x = num_groups_x;
4924   cmd->num_groups_y = num_groups_y;
4925   cmd->num_groups_z = num_groups_z;
4926   cmd->group_size_x = group_size_x;
4927   cmd->group_size_y = group_size_y;
4928   cmd->group_size_z = group_size_z;
4929}
4930
4931
4932/* MultiDrawArraysIndirectCountARB: marshalled asynchronously */
4933struct marshal_cmd_MultiDrawArraysIndirectCountARB
4934{
4935   struct marshal_cmd_base cmd_base;
4936   GLenum mode;
4937   GLsizei maxdrawcount;
4938   GLsizei stride;
4939   GLintptr indirect;
4940   GLintptr drawcount;
4941};
4942uint32_t
4943_mesa_unmarshal_MultiDrawArraysIndirectCountARB(struct gl_context *ctx, const struct marshal_cmd_MultiDrawArraysIndirectCountARB *cmd, const uint64_t *last)
4944{
4945   GLenum mode = cmd->mode;
4946   GLintptr indirect = cmd->indirect;
4947   GLintptr drawcount = cmd->drawcount;
4948   GLsizei maxdrawcount = cmd->maxdrawcount;
4949   GLsizei stride = cmd->stride;
4950   CALL_MultiDrawArraysIndirectCountARB(ctx->CurrentServerDispatch, (mode, indirect, drawcount, maxdrawcount, stride));
4951   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_MultiDrawArraysIndirectCountARB), 8) / 8);
4952   assert (cmd_size == cmd->cmd_base.cmd_size);
4953   return cmd_size;
4954}
4955void GLAPIENTRY
4956_mesa_marshal_MultiDrawArraysIndirectCountARB(GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride)
4957{
4958   GET_CURRENT_CONTEXT(ctx);
4959   int cmd_size = sizeof(struct marshal_cmd_MultiDrawArraysIndirectCountARB);
4960   struct marshal_cmd_MultiDrawArraysIndirectCountARB *cmd;
4961   if (_mesa_glthread_has_non_vbo_vertices(ctx)) {
4962      _mesa_glthread_finish_before(ctx, "MultiDrawArraysIndirectCountARB");
4963      CALL_MultiDrawArraysIndirectCountARB(ctx->CurrentServerDispatch, (mode, indirect, drawcount, maxdrawcount, stride));
4964      return;
4965   }
4966   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_MultiDrawArraysIndirectCountARB, cmd_size);
4967   cmd->mode = mode;
4968   cmd->indirect = indirect;
4969   cmd->drawcount = drawcount;
4970   cmd->maxdrawcount = maxdrawcount;
4971   cmd->stride = stride;
4972}
4973
4974
4975/* MultiDrawElementsIndirectCountARB: marshalled asynchronously */
4976struct marshal_cmd_MultiDrawElementsIndirectCountARB
4977{
4978   struct marshal_cmd_base cmd_base;
4979   GLenum mode;
4980   GLenum type;
4981   GLsizei maxdrawcount;
4982   GLsizei stride;
4983   GLintptr indirect;
4984   GLintptr drawcount;
4985};
4986uint32_t
4987_mesa_unmarshal_MultiDrawElementsIndirectCountARB(struct gl_context *ctx, const struct marshal_cmd_MultiDrawElementsIndirectCountARB *cmd, const uint64_t *last)
4988{
4989   GLenum mode = cmd->mode;
4990   GLenum type = cmd->type;
4991   GLintptr indirect = cmd->indirect;
4992   GLintptr drawcount = cmd->drawcount;
4993   GLsizei maxdrawcount = cmd->maxdrawcount;
4994   GLsizei stride = cmd->stride;
4995   CALL_MultiDrawElementsIndirectCountARB(ctx->CurrentServerDispatch, (mode, type, indirect, drawcount, maxdrawcount, stride));
4996   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_MultiDrawElementsIndirectCountARB), 8) / 8);
4997   assert (cmd_size == cmd->cmd_base.cmd_size);
4998   return cmd_size;
4999}
5000void GLAPIENTRY
5001_mesa_marshal_MultiDrawElementsIndirectCountARB(GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride)
5002{
5003   GET_CURRENT_CONTEXT(ctx);
5004   int cmd_size = sizeof(struct marshal_cmd_MultiDrawElementsIndirectCountARB);
5005   struct marshal_cmd_MultiDrawElementsIndirectCountARB *cmd;
5006   if (_mesa_glthread_has_non_vbo_vertices(ctx)) {
5007      _mesa_glthread_finish_before(ctx, "MultiDrawElementsIndirectCountARB");
5008      CALL_MultiDrawElementsIndirectCountARB(ctx->CurrentServerDispatch, (mode, type, indirect, drawcount, maxdrawcount, stride));
5009      return;
5010   }
5011   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_MultiDrawElementsIndirectCountARB, cmd_size);
5012   cmd->mode = mode;
5013   cmd->type = type;
5014   cmd->indirect = indirect;
5015   cmd->drawcount = drawcount;
5016   cmd->maxdrawcount = maxdrawcount;
5017   cmd->stride = stride;
5018}
5019
5020
5021/* ClipControl: marshalled asynchronously */
5022struct marshal_cmd_ClipControl
5023{
5024   struct marshal_cmd_base cmd_base;
5025   GLenum origin;
5026   GLenum depth;
5027};
5028uint32_t
5029_mesa_unmarshal_ClipControl(struct gl_context *ctx, const struct marshal_cmd_ClipControl *cmd, const uint64_t *last)
5030{
5031   GLenum origin = cmd->origin;
5032   GLenum depth = cmd->depth;
5033   CALL_ClipControl(ctx->CurrentServerDispatch, (origin, depth));
5034   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ClipControl), 8) / 8);
5035   assert (cmd_size == cmd->cmd_base.cmd_size);
5036   return cmd_size;
5037}
5038void GLAPIENTRY
5039_mesa_marshal_ClipControl(GLenum origin, GLenum depth)
5040{
5041   GET_CURRENT_CONTEXT(ctx);
5042   int cmd_size = sizeof(struct marshal_cmd_ClipControl);
5043   struct marshal_cmd_ClipControl *cmd;
5044   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ClipControl, cmd_size);
5045   cmd->origin = origin;
5046   cmd->depth = depth;
5047}
5048
5049
5050/* CreateTransformFeedbacks: marshalled synchronously */
5051void GLAPIENTRY
5052_mesa_marshal_CreateTransformFeedbacks(GLsizei n, GLuint * ids)
5053{
5054   GET_CURRENT_CONTEXT(ctx);
5055   _mesa_glthread_finish_before(ctx, "CreateTransformFeedbacks");
5056   CALL_CreateTransformFeedbacks(ctx->CurrentServerDispatch, (n, ids));
5057}
5058
5059
5060/* TransformFeedbackBufferBase: marshalled asynchronously */
5061struct marshal_cmd_TransformFeedbackBufferBase
5062{
5063   struct marshal_cmd_base cmd_base;
5064   GLuint xfb;
5065   GLuint index;
5066   GLuint buffer;
5067};
5068uint32_t
5069_mesa_unmarshal_TransformFeedbackBufferBase(struct gl_context *ctx, const struct marshal_cmd_TransformFeedbackBufferBase *cmd, const uint64_t *last)
5070{
5071   GLuint xfb = cmd->xfb;
5072   GLuint index = cmd->index;
5073   GLuint buffer = cmd->buffer;
5074   CALL_TransformFeedbackBufferBase(ctx->CurrentServerDispatch, (xfb, index, buffer));
5075   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TransformFeedbackBufferBase), 8) / 8);
5076   assert (cmd_size == cmd->cmd_base.cmd_size);
5077   return cmd_size;
5078}
5079void GLAPIENTRY
5080_mesa_marshal_TransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer)
5081{
5082   GET_CURRENT_CONTEXT(ctx);
5083   int cmd_size = sizeof(struct marshal_cmd_TransformFeedbackBufferBase);
5084   struct marshal_cmd_TransformFeedbackBufferBase *cmd;
5085   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TransformFeedbackBufferBase, cmd_size);
5086   cmd->xfb = xfb;
5087   cmd->index = index;
5088   cmd->buffer = buffer;
5089}
5090
5091
5092/* TransformFeedbackBufferRange: marshalled asynchronously */
5093struct marshal_cmd_TransformFeedbackBufferRange
5094{
5095   struct marshal_cmd_base cmd_base;
5096   GLuint xfb;
5097   GLuint index;
5098   GLuint buffer;
5099   GLintptr offset;
5100   GLsizeiptr size;
5101};
5102uint32_t
5103_mesa_unmarshal_TransformFeedbackBufferRange(struct gl_context *ctx, const struct marshal_cmd_TransformFeedbackBufferRange *cmd, const uint64_t *last)
5104{
5105   GLuint xfb = cmd->xfb;
5106   GLuint index = cmd->index;
5107   GLuint buffer = cmd->buffer;
5108   GLintptr offset = cmd->offset;
5109   GLsizeiptr size = cmd->size;
5110   CALL_TransformFeedbackBufferRange(ctx->CurrentServerDispatch, (xfb, index, buffer, offset, size));
5111   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TransformFeedbackBufferRange), 8) / 8);
5112   assert (cmd_size == cmd->cmd_base.cmd_size);
5113   return cmd_size;
5114}
5115void GLAPIENTRY
5116_mesa_marshal_TransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
5117{
5118   GET_CURRENT_CONTEXT(ctx);
5119   int cmd_size = sizeof(struct marshal_cmd_TransformFeedbackBufferRange);
5120   struct marshal_cmd_TransformFeedbackBufferRange *cmd;
5121   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TransformFeedbackBufferRange, cmd_size);
5122   cmd->xfb = xfb;
5123   cmd->index = index;
5124   cmd->buffer = buffer;
5125   cmd->offset = offset;
5126   cmd->size = size;
5127}
5128
5129
5130/* GetTransformFeedbackiv: marshalled synchronously */
5131void GLAPIENTRY
5132_mesa_marshal_GetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint * param)
5133{
5134   GET_CURRENT_CONTEXT(ctx);
5135   _mesa_glthread_finish_before(ctx, "GetTransformFeedbackiv");
5136   CALL_GetTransformFeedbackiv(ctx->CurrentServerDispatch, (xfb, pname, param));
5137}
5138
5139
5140/* GetTransformFeedbacki_v: marshalled synchronously */
5141void GLAPIENTRY
5142_mesa_marshal_GetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint * param)
5143{
5144   GET_CURRENT_CONTEXT(ctx);
5145   _mesa_glthread_finish_before(ctx, "GetTransformFeedbacki_v");
5146   CALL_GetTransformFeedbacki_v(ctx->CurrentServerDispatch, (xfb, pname, index, param));
5147}
5148
5149
5150/* GetTransformFeedbacki64_v: marshalled synchronously */
5151void GLAPIENTRY
5152_mesa_marshal_GetTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, GLint64 * param)
5153{
5154   GET_CURRENT_CONTEXT(ctx);
5155   _mesa_glthread_finish_before(ctx, "GetTransformFeedbacki64_v");
5156   CALL_GetTransformFeedbacki64_v(ctx->CurrentServerDispatch, (xfb, pname, index, param));
5157}
5158
5159
5160/* CreateBuffers: marshalled synchronously */
5161void GLAPIENTRY
5162_mesa_marshal_CreateBuffers(GLsizei n, GLuint * buffers)
5163{
5164   GET_CURRENT_CONTEXT(ctx);
5165   _mesa_glthread_finish_before(ctx, "CreateBuffers");
5166   CALL_CreateBuffers(ctx->CurrentServerDispatch, (n, buffers));
5167}
5168
5169
5170/* NamedBufferStorage: marshalled synchronously */
5171void GLAPIENTRY
5172_mesa_marshal_NamedBufferStorage(GLuint buffer, GLsizeiptr size, const GLvoid * data, GLbitfield flags)
5173{
5174   GET_CURRENT_CONTEXT(ctx);
5175   _mesa_glthread_finish_before(ctx, "NamedBufferStorage");
5176   CALL_NamedBufferStorage(ctx->CurrentServerDispatch, (buffer, size, data, flags));
5177}
5178
5179
5180/* CopyNamedBufferSubData: marshalled asynchronously */
5181struct marshal_cmd_CopyNamedBufferSubData
5182{
5183   struct marshal_cmd_base cmd_base;
5184   GLuint readBuffer;
5185   GLuint writeBuffer;
5186   GLintptr readOffset;
5187   GLintptr writeOffset;
5188   GLsizeiptr size;
5189};
5190uint32_t
5191_mesa_unmarshal_CopyNamedBufferSubData(struct gl_context *ctx, const struct marshal_cmd_CopyNamedBufferSubData *cmd, const uint64_t *last)
5192{
5193   GLuint readBuffer = cmd->readBuffer;
5194   GLuint writeBuffer = cmd->writeBuffer;
5195   GLintptr readOffset = cmd->readOffset;
5196   GLintptr writeOffset = cmd->writeOffset;
5197   GLsizeiptr size = cmd->size;
5198   CALL_CopyNamedBufferSubData(ctx->CurrentServerDispatch, (readBuffer, writeBuffer, readOffset, writeOffset, size));
5199   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_CopyNamedBufferSubData), 8) / 8);
5200   assert (cmd_size == cmd->cmd_base.cmd_size);
5201   return cmd_size;
5202}
5203void GLAPIENTRY
5204_mesa_marshal_CopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
5205{
5206   GET_CURRENT_CONTEXT(ctx);
5207   int cmd_size = sizeof(struct marshal_cmd_CopyNamedBufferSubData);
5208   struct marshal_cmd_CopyNamedBufferSubData *cmd;
5209   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_CopyNamedBufferSubData, cmd_size);
5210   cmd->readBuffer = readBuffer;
5211   cmd->writeBuffer = writeBuffer;
5212   cmd->readOffset = readOffset;
5213   cmd->writeOffset = writeOffset;
5214   cmd->size = size;
5215}
5216
5217
5218/* ClearNamedBufferData: marshalled synchronously */
5219void GLAPIENTRY
5220_mesa_marshal_ClearNamedBufferData(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const GLvoid * data)
5221{
5222   GET_CURRENT_CONTEXT(ctx);
5223   _mesa_glthread_finish_before(ctx, "ClearNamedBufferData");
5224   CALL_ClearNamedBufferData(ctx->CurrentServerDispatch, (buffer, internalformat, format, type, data));
5225}
5226
5227
5228/* ClearNamedBufferSubData: marshalled synchronously */
5229void GLAPIENTRY
5230_mesa_marshal_ClearNamedBufferSubData(GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const GLvoid * data)
5231{
5232   GET_CURRENT_CONTEXT(ctx);
5233   _mesa_glthread_finish_before(ctx, "ClearNamedBufferSubData");
5234   CALL_ClearNamedBufferSubData(ctx->CurrentServerDispatch, (buffer, internalformat, offset, size, format, type, data));
5235}
5236
5237
5238/* MapNamedBuffer: marshalled synchronously */
5239GLvoid * GLAPIENTRY
5240_mesa_marshal_MapNamedBuffer(GLuint buffer, GLenum access)
5241{
5242   GET_CURRENT_CONTEXT(ctx);
5243   _mesa_glthread_finish_before(ctx, "MapNamedBuffer");
5244   return CALL_MapNamedBuffer(ctx->CurrentServerDispatch, (buffer, access));
5245}
5246
5247
5248/* MapNamedBufferRange: marshalled synchronously */
5249GLvoid * GLAPIENTRY
5250_mesa_marshal_MapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access)
5251{
5252   GET_CURRENT_CONTEXT(ctx);
5253   _mesa_glthread_finish_before(ctx, "MapNamedBufferRange");
5254   return CALL_MapNamedBufferRange(ctx->CurrentServerDispatch, (buffer, offset, length, access));
5255}
5256
5257
5258/* UnmapNamedBufferEXT: marshalled asynchronously */
5259struct marshal_cmd_UnmapNamedBufferEXT
5260{
5261   struct marshal_cmd_base cmd_base;
5262   GLuint buffer;
5263};
5264uint32_t
5265_mesa_unmarshal_UnmapNamedBufferEXT(struct gl_context *ctx, const struct marshal_cmd_UnmapNamedBufferEXT *cmd, const uint64_t *last)
5266{
5267   GLuint buffer = cmd->buffer;
5268   CALL_UnmapNamedBufferEXT(ctx->CurrentServerDispatch, (buffer));
5269   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_UnmapNamedBufferEXT), 8) / 8);
5270   assert (cmd_size == cmd->cmd_base.cmd_size);
5271   return cmd_size;
5272}
5273GLboolean GLAPIENTRY
5274_mesa_marshal_UnmapNamedBufferEXT(GLuint buffer)
5275{
5276   GET_CURRENT_CONTEXT(ctx);
5277   int cmd_size = sizeof(struct marshal_cmd_UnmapNamedBufferEXT);
5278   struct marshal_cmd_UnmapNamedBufferEXT *cmd;
5279   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_UnmapNamedBufferEXT, cmd_size);
5280   cmd->buffer = buffer;
5281   return GL_TRUE;
5282}
5283
5284
5285/* FlushMappedNamedBufferRange: marshalled asynchronously */
5286struct marshal_cmd_FlushMappedNamedBufferRange
5287{
5288   struct marshal_cmd_base cmd_base;
5289   GLuint buffer;
5290   GLintptr offset;
5291   GLsizeiptr length;
5292};
5293uint32_t
5294_mesa_unmarshal_FlushMappedNamedBufferRange(struct gl_context *ctx, const struct marshal_cmd_FlushMappedNamedBufferRange *cmd, const uint64_t *last)
5295{
5296   GLuint buffer = cmd->buffer;
5297   GLintptr offset = cmd->offset;
5298   GLsizeiptr length = cmd->length;
5299   CALL_FlushMappedNamedBufferRange(ctx->CurrentServerDispatch, (buffer, offset, length));
5300   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_FlushMappedNamedBufferRange), 8) / 8);
5301   assert (cmd_size == cmd->cmd_base.cmd_size);
5302   return cmd_size;
5303}
5304void GLAPIENTRY
5305_mesa_marshal_FlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length)
5306{
5307   GET_CURRENT_CONTEXT(ctx);
5308   int cmd_size = sizeof(struct marshal_cmd_FlushMappedNamedBufferRange);
5309   struct marshal_cmd_FlushMappedNamedBufferRange *cmd;
5310   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_FlushMappedNamedBufferRange, cmd_size);
5311   cmd->buffer = buffer;
5312   cmd->offset = offset;
5313   cmd->length = length;
5314}
5315
5316
5317/* GetNamedBufferParameteriv: marshalled synchronously */
5318void GLAPIENTRY
5319_mesa_marshal_GetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint * params)
5320{
5321   GET_CURRENT_CONTEXT(ctx);
5322   _mesa_glthread_finish_before(ctx, "GetNamedBufferParameteriv");
5323   CALL_GetNamedBufferParameteriv(ctx->CurrentServerDispatch, (buffer, pname, params));
5324}
5325
5326
5327/* GetNamedBufferParameteri64v: marshalled synchronously */
5328void GLAPIENTRY
5329_mesa_marshal_GetNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 * params)
5330{
5331   GET_CURRENT_CONTEXT(ctx);
5332   _mesa_glthread_finish_before(ctx, "GetNamedBufferParameteri64v");
5333   CALL_GetNamedBufferParameteri64v(ctx->CurrentServerDispatch, (buffer, pname, params));
5334}
5335
5336
5337/* GetNamedBufferPointerv: marshalled synchronously */
5338void GLAPIENTRY
5339_mesa_marshal_GetNamedBufferPointerv(GLuint buffer, GLenum pname, GLvoid ** params)
5340{
5341   GET_CURRENT_CONTEXT(ctx);
5342   _mesa_glthread_finish_before(ctx, "GetNamedBufferPointerv");
5343   CALL_GetNamedBufferPointerv(ctx->CurrentServerDispatch, (buffer, pname, params));
5344}
5345
5346
5347/* GetNamedBufferSubData: marshalled synchronously */
5348void GLAPIENTRY
5349_mesa_marshal_GetNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid * data)
5350{
5351   GET_CURRENT_CONTEXT(ctx);
5352   _mesa_glthread_finish_before(ctx, "GetNamedBufferSubData");
5353   CALL_GetNamedBufferSubData(ctx->CurrentServerDispatch, (buffer, offset, size, data));
5354}
5355
5356
5357/* CreateFramebuffers: marshalled synchronously */
5358void GLAPIENTRY
5359_mesa_marshal_CreateFramebuffers(GLsizei n, GLuint * framebuffers)
5360{
5361   GET_CURRENT_CONTEXT(ctx);
5362   _mesa_glthread_finish_before(ctx, "CreateFramebuffers");
5363   CALL_CreateFramebuffers(ctx->CurrentServerDispatch, (n, framebuffers));
5364}
5365
5366
5367/* NamedFramebufferRenderbuffer: marshalled asynchronously */
5368struct marshal_cmd_NamedFramebufferRenderbuffer
5369{
5370   struct marshal_cmd_base cmd_base;
5371   GLuint framebuffer;
5372   GLenum attachment;
5373   GLenum renderbuffertarget;
5374   GLuint renderbuffer;
5375};
5376uint32_t
5377_mesa_unmarshal_NamedFramebufferRenderbuffer(struct gl_context *ctx, const struct marshal_cmd_NamedFramebufferRenderbuffer *cmd, const uint64_t *last)
5378{
5379   GLuint framebuffer = cmd->framebuffer;
5380   GLenum attachment = cmd->attachment;
5381   GLenum renderbuffertarget = cmd->renderbuffertarget;
5382   GLuint renderbuffer = cmd->renderbuffer;
5383   CALL_NamedFramebufferRenderbuffer(ctx->CurrentServerDispatch, (framebuffer, attachment, renderbuffertarget, renderbuffer));
5384   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_NamedFramebufferRenderbuffer), 8) / 8);
5385   assert (cmd_size == cmd->cmd_base.cmd_size);
5386   return cmd_size;
5387}
5388void GLAPIENTRY
5389_mesa_marshal_NamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
5390{
5391   GET_CURRENT_CONTEXT(ctx);
5392   int cmd_size = sizeof(struct marshal_cmd_NamedFramebufferRenderbuffer);
5393   struct marshal_cmd_NamedFramebufferRenderbuffer *cmd;
5394   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_NamedFramebufferRenderbuffer, cmd_size);
5395   cmd->framebuffer = framebuffer;
5396   cmd->attachment = attachment;
5397   cmd->renderbuffertarget = renderbuffertarget;
5398   cmd->renderbuffer = renderbuffer;
5399}
5400
5401
5402/* NamedFramebufferParameteri: marshalled asynchronously */
5403struct marshal_cmd_NamedFramebufferParameteri
5404{
5405   struct marshal_cmd_base cmd_base;
5406   GLuint framebuffer;
5407   GLenum pname;
5408   GLint param;
5409};
5410uint32_t
5411_mesa_unmarshal_NamedFramebufferParameteri(struct gl_context *ctx, const struct marshal_cmd_NamedFramebufferParameteri *cmd, const uint64_t *last)
5412{
5413   GLuint framebuffer = cmd->framebuffer;
5414   GLenum pname = cmd->pname;
5415   GLint param = cmd->param;
5416   CALL_NamedFramebufferParameteri(ctx->CurrentServerDispatch, (framebuffer, pname, param));
5417   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_NamedFramebufferParameteri), 8) / 8);
5418   assert (cmd_size == cmd->cmd_base.cmd_size);
5419   return cmd_size;
5420}
5421void GLAPIENTRY
5422_mesa_marshal_NamedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param)
5423{
5424   GET_CURRENT_CONTEXT(ctx);
5425   int cmd_size = sizeof(struct marshal_cmd_NamedFramebufferParameteri);
5426   struct marshal_cmd_NamedFramebufferParameteri *cmd;
5427   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_NamedFramebufferParameteri, cmd_size);
5428   cmd->framebuffer = framebuffer;
5429   cmd->pname = pname;
5430   cmd->param = param;
5431}
5432
5433
5434/* NamedFramebufferTexture: marshalled asynchronously */
5435struct marshal_cmd_NamedFramebufferTexture
5436{
5437   struct marshal_cmd_base cmd_base;
5438   GLuint framebuffer;
5439   GLenum attachment;
5440   GLuint texture;
5441   GLint level;
5442};
5443uint32_t
5444_mesa_unmarshal_NamedFramebufferTexture(struct gl_context *ctx, const struct marshal_cmd_NamedFramebufferTexture *cmd, const uint64_t *last)
5445{
5446   GLuint framebuffer = cmd->framebuffer;
5447   GLenum attachment = cmd->attachment;
5448   GLuint texture = cmd->texture;
5449   GLint level = cmd->level;
5450   CALL_NamedFramebufferTexture(ctx->CurrentServerDispatch, (framebuffer, attachment, texture, level));
5451   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_NamedFramebufferTexture), 8) / 8);
5452   assert (cmd_size == cmd->cmd_base.cmd_size);
5453   return cmd_size;
5454}
5455void GLAPIENTRY
5456_mesa_marshal_NamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level)
5457{
5458   GET_CURRENT_CONTEXT(ctx);
5459   int cmd_size = sizeof(struct marshal_cmd_NamedFramebufferTexture);
5460   struct marshal_cmd_NamedFramebufferTexture *cmd;
5461   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_NamedFramebufferTexture, cmd_size);
5462   cmd->framebuffer = framebuffer;
5463   cmd->attachment = attachment;
5464   cmd->texture = texture;
5465   cmd->level = level;
5466}
5467
5468
5469/* NamedFramebufferTextureLayer: marshalled asynchronously */
5470struct marshal_cmd_NamedFramebufferTextureLayer
5471{
5472   struct marshal_cmd_base cmd_base;
5473   GLuint framebuffer;
5474   GLenum attachment;
5475   GLuint texture;
5476   GLint level;
5477   GLint layer;
5478};
5479uint32_t
5480_mesa_unmarshal_NamedFramebufferTextureLayer(struct gl_context *ctx, const struct marshal_cmd_NamedFramebufferTextureLayer *cmd, const uint64_t *last)
5481{
5482   GLuint framebuffer = cmd->framebuffer;
5483   GLenum attachment = cmd->attachment;
5484   GLuint texture = cmd->texture;
5485   GLint level = cmd->level;
5486   GLint layer = cmd->layer;
5487   CALL_NamedFramebufferTextureLayer(ctx->CurrentServerDispatch, (framebuffer, attachment, texture, level, layer));
5488   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_NamedFramebufferTextureLayer), 8) / 8);
5489   assert (cmd_size == cmd->cmd_base.cmd_size);
5490   return cmd_size;
5491}
5492void GLAPIENTRY
5493_mesa_marshal_NamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer)
5494{
5495   GET_CURRENT_CONTEXT(ctx);
5496   int cmd_size = sizeof(struct marshal_cmd_NamedFramebufferTextureLayer);
5497   struct marshal_cmd_NamedFramebufferTextureLayer *cmd;
5498   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_NamedFramebufferTextureLayer, cmd_size);
5499   cmd->framebuffer = framebuffer;
5500   cmd->attachment = attachment;
5501   cmd->texture = texture;
5502   cmd->level = level;
5503   cmd->layer = layer;
5504}
5505
5506
5507/* NamedFramebufferDrawBuffer: marshalled asynchronously */
5508struct marshal_cmd_NamedFramebufferDrawBuffer
5509{
5510   struct marshal_cmd_base cmd_base;
5511   GLuint framebuffer;
5512   GLenum buf;
5513};
5514uint32_t
5515_mesa_unmarshal_NamedFramebufferDrawBuffer(struct gl_context *ctx, const struct marshal_cmd_NamedFramebufferDrawBuffer *cmd, const uint64_t *last)
5516{
5517   GLuint framebuffer = cmd->framebuffer;
5518   GLenum buf = cmd->buf;
5519   CALL_NamedFramebufferDrawBuffer(ctx->CurrentServerDispatch, (framebuffer, buf));
5520   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_NamedFramebufferDrawBuffer), 8) / 8);
5521   assert (cmd_size == cmd->cmd_base.cmd_size);
5522   return cmd_size;
5523}
5524void GLAPIENTRY
5525_mesa_marshal_NamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf)
5526{
5527   GET_CURRENT_CONTEXT(ctx);
5528   int cmd_size = sizeof(struct marshal_cmd_NamedFramebufferDrawBuffer);
5529   struct marshal_cmd_NamedFramebufferDrawBuffer *cmd;
5530   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_NamedFramebufferDrawBuffer, cmd_size);
5531   cmd->framebuffer = framebuffer;
5532   cmd->buf = buf;
5533}
5534
5535
5536/* NamedFramebufferDrawBuffers: marshalled asynchronously */
5537struct marshal_cmd_NamedFramebufferDrawBuffers
5538{
5539   struct marshal_cmd_base cmd_base;
5540   GLuint framebuffer;
5541   GLsizei n;
5542   /* Next safe_mul(n, 1 * sizeof(GLenum)) bytes are GLenum bufs[n] */
5543};
5544uint32_t
5545_mesa_unmarshal_NamedFramebufferDrawBuffers(struct gl_context *ctx, const struct marshal_cmd_NamedFramebufferDrawBuffers *cmd, const uint64_t *last)
5546{
5547   GLuint framebuffer = cmd->framebuffer;
5548   GLsizei n = cmd->n;
5549   GLenum * bufs;
5550   const char *variable_data = (const char *) (cmd + 1);
5551   bufs = (GLenum *) variable_data;
5552   CALL_NamedFramebufferDrawBuffers(ctx->CurrentServerDispatch, (framebuffer, n, bufs));
5553   return cmd->cmd_base.cmd_size;
5554}
5555void GLAPIENTRY
5556_mesa_marshal_NamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum * bufs)
5557{
5558   GET_CURRENT_CONTEXT(ctx);
5559   int bufs_size = safe_mul(n, 1 * sizeof(GLenum));
5560   int cmd_size = sizeof(struct marshal_cmd_NamedFramebufferDrawBuffers) + bufs_size;
5561   struct marshal_cmd_NamedFramebufferDrawBuffers *cmd;
5562   if (unlikely(bufs_size < 0 || (bufs_size > 0 && !bufs) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
5563      _mesa_glthread_finish_before(ctx, "NamedFramebufferDrawBuffers");
5564      CALL_NamedFramebufferDrawBuffers(ctx->CurrentServerDispatch, (framebuffer, n, bufs));
5565      return;
5566   }
5567   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_NamedFramebufferDrawBuffers, cmd_size);
5568   cmd->framebuffer = framebuffer;
5569   cmd->n = n;
5570   char *variable_data = (char *) (cmd + 1);
5571   memcpy(variable_data, bufs, bufs_size);
5572}
5573
5574
5575/* NamedFramebufferReadBuffer: marshalled asynchronously */
5576struct marshal_cmd_NamedFramebufferReadBuffer
5577{
5578   struct marshal_cmd_base cmd_base;
5579   GLuint framebuffer;
5580   GLenum buf;
5581};
5582uint32_t
5583_mesa_unmarshal_NamedFramebufferReadBuffer(struct gl_context *ctx, const struct marshal_cmd_NamedFramebufferReadBuffer *cmd, const uint64_t *last)
5584{
5585   GLuint framebuffer = cmd->framebuffer;
5586   GLenum buf = cmd->buf;
5587   CALL_NamedFramebufferReadBuffer(ctx->CurrentServerDispatch, (framebuffer, buf));
5588   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_NamedFramebufferReadBuffer), 8) / 8);
5589   assert (cmd_size == cmd->cmd_base.cmd_size);
5590   return cmd_size;
5591}
5592void GLAPIENTRY
5593_mesa_marshal_NamedFramebufferReadBuffer(GLuint framebuffer, GLenum buf)
5594{
5595   GET_CURRENT_CONTEXT(ctx);
5596   int cmd_size = sizeof(struct marshal_cmd_NamedFramebufferReadBuffer);
5597   struct marshal_cmd_NamedFramebufferReadBuffer *cmd;
5598   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_NamedFramebufferReadBuffer, cmd_size);
5599   cmd->framebuffer = framebuffer;
5600   cmd->buf = buf;
5601}
5602
5603
5604/* InvalidateNamedFramebufferData: marshalled asynchronously */
5605struct marshal_cmd_InvalidateNamedFramebufferData
5606{
5607   struct marshal_cmd_base cmd_base;
5608   GLuint framebuffer;
5609   GLsizei numAttachments;
5610   /* Next safe_mul(numAttachments, 1 * sizeof(GLenum)) bytes are GLenum attachments[numAttachments] */
5611};
5612uint32_t
5613_mesa_unmarshal_InvalidateNamedFramebufferData(struct gl_context *ctx, const struct marshal_cmd_InvalidateNamedFramebufferData *cmd, const uint64_t *last)
5614{
5615   GLuint framebuffer = cmd->framebuffer;
5616   GLsizei numAttachments = cmd->numAttachments;
5617   GLenum * attachments;
5618   const char *variable_data = (const char *) (cmd + 1);
5619   attachments = (GLenum *) variable_data;
5620   CALL_InvalidateNamedFramebufferData(ctx->CurrentServerDispatch, (framebuffer, numAttachments, attachments));
5621   return cmd->cmd_base.cmd_size;
5622}
5623void GLAPIENTRY
5624_mesa_marshal_InvalidateNamedFramebufferData(GLuint framebuffer, GLsizei numAttachments, const GLenum * attachments)
5625{
5626   GET_CURRENT_CONTEXT(ctx);
5627   int attachments_size = safe_mul(numAttachments, 1 * sizeof(GLenum));
5628   int cmd_size = sizeof(struct marshal_cmd_InvalidateNamedFramebufferData) + attachments_size;
5629   struct marshal_cmd_InvalidateNamedFramebufferData *cmd;
5630   if (unlikely(attachments_size < 0 || (attachments_size > 0 && !attachments) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
5631      _mesa_glthread_finish_before(ctx, "InvalidateNamedFramebufferData");
5632      CALL_InvalidateNamedFramebufferData(ctx->CurrentServerDispatch, (framebuffer, numAttachments, attachments));
5633      return;
5634   }
5635   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_InvalidateNamedFramebufferData, cmd_size);
5636   cmd->framebuffer = framebuffer;
5637   cmd->numAttachments = numAttachments;
5638   char *variable_data = (char *) (cmd + 1);
5639   memcpy(variable_data, attachments, attachments_size);
5640}
5641
5642
5643/* InvalidateNamedFramebufferSubData: marshalled asynchronously */
5644struct marshal_cmd_InvalidateNamedFramebufferSubData
5645{
5646   struct marshal_cmd_base cmd_base;
5647   GLuint framebuffer;
5648   GLsizei numAttachments;
5649   GLint x;
5650   GLint y;
5651   GLsizei width;
5652   GLsizei height;
5653   /* Next safe_mul(numAttachments, 1 * sizeof(GLenum)) bytes are GLenum attachments[numAttachments] */
5654};
5655uint32_t
5656_mesa_unmarshal_InvalidateNamedFramebufferSubData(struct gl_context *ctx, const struct marshal_cmd_InvalidateNamedFramebufferSubData *cmd, const uint64_t *last)
5657{
5658   GLuint framebuffer = cmd->framebuffer;
5659   GLsizei numAttachments = cmd->numAttachments;
5660   GLint x = cmd->x;
5661   GLint y = cmd->y;
5662   GLsizei width = cmd->width;
5663   GLsizei height = cmd->height;
5664   GLenum * attachments;
5665   const char *variable_data = (const char *) (cmd + 1);
5666   attachments = (GLenum *) variable_data;
5667   CALL_InvalidateNamedFramebufferSubData(ctx->CurrentServerDispatch, (framebuffer, numAttachments, attachments, x, y, width, height));
5668   return cmd->cmd_base.cmd_size;
5669}
5670void GLAPIENTRY
5671_mesa_marshal_InvalidateNamedFramebufferSubData(GLuint framebuffer, GLsizei numAttachments, const GLenum * attachments, GLint x, GLint y, GLsizei width, GLsizei height)
5672{
5673   GET_CURRENT_CONTEXT(ctx);
5674   int attachments_size = safe_mul(numAttachments, 1 * sizeof(GLenum));
5675   int cmd_size = sizeof(struct marshal_cmd_InvalidateNamedFramebufferSubData) + attachments_size;
5676   struct marshal_cmd_InvalidateNamedFramebufferSubData *cmd;
5677   if (unlikely(attachments_size < 0 || (attachments_size > 0 && !attachments) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
5678      _mesa_glthread_finish_before(ctx, "InvalidateNamedFramebufferSubData");
5679      CALL_InvalidateNamedFramebufferSubData(ctx->CurrentServerDispatch, (framebuffer, numAttachments, attachments, x, y, width, height));
5680      return;
5681   }
5682   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_InvalidateNamedFramebufferSubData, cmd_size);
5683   cmd->framebuffer = framebuffer;
5684   cmd->numAttachments = numAttachments;
5685   cmd->x = x;
5686   cmd->y = y;
5687   cmd->width = width;
5688   cmd->height = height;
5689   char *variable_data = (char *) (cmd + 1);
5690   memcpy(variable_data, attachments, attachments_size);
5691}
5692
5693
5694/* ClearNamedFramebufferiv: marshalled asynchronously */
5695struct marshal_cmd_ClearNamedFramebufferiv
5696{
5697   struct marshal_cmd_base cmd_base;
5698   GLuint framebuffer;
5699   GLenum buffer;
5700   GLint drawbuffer;
5701   /* Next safe_mul(_mesa_buffer_enum_to_count(buffer), 1 * sizeof(GLint)) bytes are GLint value[_mesa_buffer_enum_to_count(buffer)] */
5702};
5703uint32_t
5704_mesa_unmarshal_ClearNamedFramebufferiv(struct gl_context *ctx, const struct marshal_cmd_ClearNamedFramebufferiv *cmd, const uint64_t *last)
5705{
5706   GLuint framebuffer = cmd->framebuffer;
5707   GLenum buffer = cmd->buffer;
5708   GLint drawbuffer = cmd->drawbuffer;
5709   GLint * value;
5710   const char *variable_data = (const char *) (cmd + 1);
5711   value = (GLint *) variable_data;
5712   CALL_ClearNamedFramebufferiv(ctx->CurrentServerDispatch, (framebuffer, buffer, drawbuffer, value));
5713   return cmd->cmd_base.cmd_size;
5714}
5715void GLAPIENTRY
5716_mesa_marshal_ClearNamedFramebufferiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint * value)
5717{
5718   GET_CURRENT_CONTEXT(ctx);
5719   int value_size = safe_mul(_mesa_buffer_enum_to_count(buffer), 1 * sizeof(GLint));
5720   int cmd_size = sizeof(struct marshal_cmd_ClearNamedFramebufferiv) + value_size;
5721   struct marshal_cmd_ClearNamedFramebufferiv *cmd;
5722   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
5723      _mesa_glthread_finish_before(ctx, "ClearNamedFramebufferiv");
5724      CALL_ClearNamedFramebufferiv(ctx->CurrentServerDispatch, (framebuffer, buffer, drawbuffer, value));
5725      return;
5726   }
5727   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ClearNamedFramebufferiv, cmd_size);
5728   cmd->framebuffer = framebuffer;
5729   cmd->buffer = buffer;
5730   cmd->drawbuffer = drawbuffer;
5731   char *variable_data = (char *) (cmd + 1);
5732   memcpy(variable_data, value, value_size);
5733}
5734
5735
5736/* ClearNamedFramebufferuiv: marshalled asynchronously */
5737struct marshal_cmd_ClearNamedFramebufferuiv
5738{
5739   struct marshal_cmd_base cmd_base;
5740   GLuint framebuffer;
5741   GLenum buffer;
5742   GLint drawbuffer;
5743   /* Next safe_mul(_mesa_buffer_enum_to_count(buffer), 1 * sizeof(GLuint)) bytes are GLuint value[_mesa_buffer_enum_to_count(buffer)] */
5744};
5745uint32_t
5746_mesa_unmarshal_ClearNamedFramebufferuiv(struct gl_context *ctx, const struct marshal_cmd_ClearNamedFramebufferuiv *cmd, const uint64_t *last)
5747{
5748   GLuint framebuffer = cmd->framebuffer;
5749   GLenum buffer = cmd->buffer;
5750   GLint drawbuffer = cmd->drawbuffer;
5751   GLuint * value;
5752   const char *variable_data = (const char *) (cmd + 1);
5753   value = (GLuint *) variable_data;
5754   CALL_ClearNamedFramebufferuiv(ctx->CurrentServerDispatch, (framebuffer, buffer, drawbuffer, value));
5755   return cmd->cmd_base.cmd_size;
5756}
5757void GLAPIENTRY
5758_mesa_marshal_ClearNamedFramebufferuiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint * value)
5759{
5760   GET_CURRENT_CONTEXT(ctx);
5761   int value_size = safe_mul(_mesa_buffer_enum_to_count(buffer), 1 * sizeof(GLuint));
5762   int cmd_size = sizeof(struct marshal_cmd_ClearNamedFramebufferuiv) + value_size;
5763   struct marshal_cmd_ClearNamedFramebufferuiv *cmd;
5764   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
5765      _mesa_glthread_finish_before(ctx, "ClearNamedFramebufferuiv");
5766      CALL_ClearNamedFramebufferuiv(ctx->CurrentServerDispatch, (framebuffer, buffer, drawbuffer, value));
5767      return;
5768   }
5769   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ClearNamedFramebufferuiv, cmd_size);
5770   cmd->framebuffer = framebuffer;
5771   cmd->buffer = buffer;
5772   cmd->drawbuffer = drawbuffer;
5773   char *variable_data = (char *) (cmd + 1);
5774   memcpy(variable_data, value, value_size);
5775}
5776
5777
5778/* ClearNamedFramebufferfv: marshalled asynchronously */
5779struct marshal_cmd_ClearNamedFramebufferfv
5780{
5781   struct marshal_cmd_base cmd_base;
5782   GLuint framebuffer;
5783   GLenum buffer;
5784   GLint drawbuffer;
5785   /* Next safe_mul(_mesa_buffer_enum_to_count(buffer), 1 * sizeof(GLfloat)) bytes are GLfloat value[_mesa_buffer_enum_to_count(buffer)] */
5786};
5787uint32_t
5788_mesa_unmarshal_ClearNamedFramebufferfv(struct gl_context *ctx, const struct marshal_cmd_ClearNamedFramebufferfv *cmd, const uint64_t *last)
5789{
5790   GLuint framebuffer = cmd->framebuffer;
5791   GLenum buffer = cmd->buffer;
5792   GLint drawbuffer = cmd->drawbuffer;
5793   GLfloat * value;
5794   const char *variable_data = (const char *) (cmd + 1);
5795   value = (GLfloat *) variable_data;
5796   CALL_ClearNamedFramebufferfv(ctx->CurrentServerDispatch, (framebuffer, buffer, drawbuffer, value));
5797   return cmd->cmd_base.cmd_size;
5798}
5799void GLAPIENTRY
5800_mesa_marshal_ClearNamedFramebufferfv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat * value)
5801{
5802   GET_CURRENT_CONTEXT(ctx);
5803   int value_size = safe_mul(_mesa_buffer_enum_to_count(buffer), 1 * sizeof(GLfloat));
5804   int cmd_size = sizeof(struct marshal_cmd_ClearNamedFramebufferfv) + value_size;
5805   struct marshal_cmd_ClearNamedFramebufferfv *cmd;
5806   if (unlikely(value_size < 0 || (value_size > 0 && !value) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
5807      _mesa_glthread_finish_before(ctx, "ClearNamedFramebufferfv");
5808      CALL_ClearNamedFramebufferfv(ctx->CurrentServerDispatch, (framebuffer, buffer, drawbuffer, value));
5809      return;
5810   }
5811   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ClearNamedFramebufferfv, cmd_size);
5812   cmd->framebuffer = framebuffer;
5813   cmd->buffer = buffer;
5814   cmd->drawbuffer = drawbuffer;
5815   char *variable_data = (char *) (cmd + 1);
5816   memcpy(variable_data, value, value_size);
5817}
5818
5819
5820/* ClearNamedFramebufferfi: marshalled asynchronously */
5821struct marshal_cmd_ClearNamedFramebufferfi
5822{
5823   struct marshal_cmd_base cmd_base;
5824   GLuint framebuffer;
5825   GLenum buffer;
5826   GLint drawbuffer;
5827   GLfloat depth;
5828   GLint stencil;
5829};
5830uint32_t
5831_mesa_unmarshal_ClearNamedFramebufferfi(struct gl_context *ctx, const struct marshal_cmd_ClearNamedFramebufferfi *cmd, const uint64_t *last)
5832{
5833   GLuint framebuffer = cmd->framebuffer;
5834   GLenum buffer = cmd->buffer;
5835   GLint drawbuffer = cmd->drawbuffer;
5836   GLfloat depth = cmd->depth;
5837   GLint stencil = cmd->stencil;
5838   CALL_ClearNamedFramebufferfi(ctx->CurrentServerDispatch, (framebuffer, buffer, drawbuffer, depth, stencil));
5839   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_ClearNamedFramebufferfi), 8) / 8);
5840   assert (cmd_size == cmd->cmd_base.cmd_size);
5841   return cmd_size;
5842}
5843void GLAPIENTRY
5844_mesa_marshal_ClearNamedFramebufferfi(GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
5845{
5846   GET_CURRENT_CONTEXT(ctx);
5847   int cmd_size = sizeof(struct marshal_cmd_ClearNamedFramebufferfi);
5848   struct marshal_cmd_ClearNamedFramebufferfi *cmd;
5849   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_ClearNamedFramebufferfi, cmd_size);
5850   cmd->framebuffer = framebuffer;
5851   cmd->buffer = buffer;
5852   cmd->drawbuffer = drawbuffer;
5853   cmd->depth = depth;
5854   cmd->stencil = stencil;
5855}
5856
5857
5858/* BlitNamedFramebuffer: marshalled asynchronously */
5859struct marshal_cmd_BlitNamedFramebuffer
5860{
5861   struct marshal_cmd_base cmd_base;
5862   GLuint readFramebuffer;
5863   GLuint drawFramebuffer;
5864   GLint srcX0;
5865   GLint srcY0;
5866   GLint srcX1;
5867   GLint srcY1;
5868   GLint dstX0;
5869   GLint dstY0;
5870   GLint dstX1;
5871   GLint dstY1;
5872   GLbitfield mask;
5873   GLenum filter;
5874};
5875uint32_t
5876_mesa_unmarshal_BlitNamedFramebuffer(struct gl_context *ctx, const struct marshal_cmd_BlitNamedFramebuffer *cmd, const uint64_t *last)
5877{
5878   GLuint readFramebuffer = cmd->readFramebuffer;
5879   GLuint drawFramebuffer = cmd->drawFramebuffer;
5880   GLint srcX0 = cmd->srcX0;
5881   GLint srcY0 = cmd->srcY0;
5882   GLint srcX1 = cmd->srcX1;
5883   GLint srcY1 = cmd->srcY1;
5884   GLint dstX0 = cmd->dstX0;
5885   GLint dstY0 = cmd->dstY0;
5886   GLint dstX1 = cmd->dstX1;
5887   GLint dstY1 = cmd->dstY1;
5888   GLbitfield mask = cmd->mask;
5889   GLenum filter = cmd->filter;
5890   CALL_BlitNamedFramebuffer(ctx->CurrentServerDispatch, (readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter));
5891   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_BlitNamedFramebuffer), 8) / 8);
5892   assert (cmd_size == cmd->cmd_base.cmd_size);
5893   return cmd_size;
5894}
5895void GLAPIENTRY
5896_mesa_marshal_BlitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
5897{
5898   GET_CURRENT_CONTEXT(ctx);
5899   int cmd_size = sizeof(struct marshal_cmd_BlitNamedFramebuffer);
5900   struct marshal_cmd_BlitNamedFramebuffer *cmd;
5901   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_BlitNamedFramebuffer, cmd_size);
5902   cmd->readFramebuffer = readFramebuffer;
5903   cmd->drawFramebuffer = drawFramebuffer;
5904   cmd->srcX0 = srcX0;
5905   cmd->srcY0 = srcY0;
5906   cmd->srcX1 = srcX1;
5907   cmd->srcY1 = srcY1;
5908   cmd->dstX0 = dstX0;
5909   cmd->dstY0 = dstY0;
5910   cmd->dstX1 = dstX1;
5911   cmd->dstY1 = dstY1;
5912   cmd->mask = mask;
5913   cmd->filter = filter;
5914}
5915
5916
5917/* CheckNamedFramebufferStatus: marshalled synchronously */
5918GLenum GLAPIENTRY
5919_mesa_marshal_CheckNamedFramebufferStatus(GLuint framebuffer, GLenum target)
5920{
5921   GET_CURRENT_CONTEXT(ctx);
5922   _mesa_glthread_finish_before(ctx, "CheckNamedFramebufferStatus");
5923   return CALL_CheckNamedFramebufferStatus(ctx->CurrentServerDispatch, (framebuffer, target));
5924}
5925
5926
5927/* GetNamedFramebufferParameteriv: marshalled synchronously */
5928void GLAPIENTRY
5929_mesa_marshal_GetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint * param)
5930{
5931   GET_CURRENT_CONTEXT(ctx);
5932   _mesa_glthread_finish_before(ctx, "GetNamedFramebufferParameteriv");
5933   CALL_GetNamedFramebufferParameteriv(ctx->CurrentServerDispatch, (framebuffer, pname, param));
5934}
5935
5936
5937/* GetNamedFramebufferAttachmentParameteriv: marshalled synchronously */
5938void GLAPIENTRY
5939_mesa_marshal_GetNamedFramebufferAttachmentParameteriv(GLuint framebuffer, GLenum attachment, GLenum pname, GLint * params)
5940{
5941   GET_CURRENT_CONTEXT(ctx);
5942   _mesa_glthread_finish_before(ctx, "GetNamedFramebufferAttachmentParameteriv");
5943   CALL_GetNamedFramebufferAttachmentParameteriv(ctx->CurrentServerDispatch, (framebuffer, attachment, pname, params));
5944}
5945
5946
5947/* CreateRenderbuffers: marshalled synchronously */
5948void GLAPIENTRY
5949_mesa_marshal_CreateRenderbuffers(GLsizei n, GLuint * renderbuffers)
5950{
5951   GET_CURRENT_CONTEXT(ctx);
5952   _mesa_glthread_finish_before(ctx, "CreateRenderbuffers");
5953   CALL_CreateRenderbuffers(ctx->CurrentServerDispatch, (n, renderbuffers));
5954}
5955
5956
5957/* NamedRenderbufferStorage: marshalled asynchronously */
5958struct marshal_cmd_NamedRenderbufferStorage
5959{
5960   struct marshal_cmd_base cmd_base;
5961   GLuint renderbuffer;
5962   GLenum internalformat;
5963   GLsizei width;
5964   GLsizei height;
5965};
5966uint32_t
5967_mesa_unmarshal_NamedRenderbufferStorage(struct gl_context *ctx, const struct marshal_cmd_NamedRenderbufferStorage *cmd, const uint64_t *last)
5968{
5969   GLuint renderbuffer = cmd->renderbuffer;
5970   GLenum internalformat = cmd->internalformat;
5971   GLsizei width = cmd->width;
5972   GLsizei height = cmd->height;
5973   CALL_NamedRenderbufferStorage(ctx->CurrentServerDispatch, (renderbuffer, internalformat, width, height));
5974   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_NamedRenderbufferStorage), 8) / 8);
5975   assert (cmd_size == cmd->cmd_base.cmd_size);
5976   return cmd_size;
5977}
5978void GLAPIENTRY
5979_mesa_marshal_NamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height)
5980{
5981   GET_CURRENT_CONTEXT(ctx);
5982   int cmd_size = sizeof(struct marshal_cmd_NamedRenderbufferStorage);
5983   struct marshal_cmd_NamedRenderbufferStorage *cmd;
5984   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_NamedRenderbufferStorage, cmd_size);
5985   cmd->renderbuffer = renderbuffer;
5986   cmd->internalformat = internalformat;
5987   cmd->width = width;
5988   cmd->height = height;
5989}
5990
5991
5992/* NamedRenderbufferStorageMultisample: marshalled asynchronously */
5993struct marshal_cmd_NamedRenderbufferStorageMultisample
5994{
5995   struct marshal_cmd_base cmd_base;
5996   GLuint renderbuffer;
5997   GLsizei samples;
5998   GLenum internalformat;
5999   GLsizei width;
6000   GLsizei height;
6001};
6002uint32_t
6003_mesa_unmarshal_NamedRenderbufferStorageMultisample(struct gl_context *ctx, const struct marshal_cmd_NamedRenderbufferStorageMultisample *cmd, const uint64_t *last)
6004{
6005   GLuint renderbuffer = cmd->renderbuffer;
6006   GLsizei samples = cmd->samples;
6007   GLenum internalformat = cmd->internalformat;
6008   GLsizei width = cmd->width;
6009   GLsizei height = cmd->height;
6010   CALL_NamedRenderbufferStorageMultisample(ctx->CurrentServerDispatch, (renderbuffer, samples, internalformat, width, height));
6011   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_NamedRenderbufferStorageMultisample), 8) / 8);
6012   assert (cmd_size == cmd->cmd_base.cmd_size);
6013   return cmd_size;
6014}
6015void GLAPIENTRY
6016_mesa_marshal_NamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
6017{
6018   GET_CURRENT_CONTEXT(ctx);
6019   int cmd_size = sizeof(struct marshal_cmd_NamedRenderbufferStorageMultisample);
6020   struct marshal_cmd_NamedRenderbufferStorageMultisample *cmd;
6021   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_NamedRenderbufferStorageMultisample, cmd_size);
6022   cmd->renderbuffer = renderbuffer;
6023   cmd->samples = samples;
6024   cmd->internalformat = internalformat;
6025   cmd->width = width;
6026   cmd->height = height;
6027}
6028
6029
6030/* GetNamedRenderbufferParameteriv: marshalled synchronously */
6031void GLAPIENTRY
6032_mesa_marshal_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, GLint * params)
6033{
6034   GET_CURRENT_CONTEXT(ctx);
6035   _mesa_glthread_finish_before(ctx, "GetNamedRenderbufferParameteriv");
6036   CALL_GetNamedRenderbufferParameteriv(ctx->CurrentServerDispatch, (renderbuffer, pname, params));
6037}
6038
6039
6040/* CreateTextures: marshalled synchronously */
6041void GLAPIENTRY
6042_mesa_marshal_CreateTextures(GLenum target, GLsizei n, GLuint * textures)
6043{
6044   GET_CURRENT_CONTEXT(ctx);
6045   _mesa_glthread_finish_before(ctx, "CreateTextures");
6046   CALL_CreateTextures(ctx->CurrentServerDispatch, (target, n, textures));
6047}
6048
6049
6050/* TextureBuffer: marshalled asynchronously */
6051struct marshal_cmd_TextureBuffer
6052{
6053   struct marshal_cmd_base cmd_base;
6054   GLuint texture;
6055   GLenum internalformat;
6056   GLuint buffer;
6057};
6058uint32_t
6059_mesa_unmarshal_TextureBuffer(struct gl_context *ctx, const struct marshal_cmd_TextureBuffer *cmd, const uint64_t *last)
6060{
6061   GLuint texture = cmd->texture;
6062   GLenum internalformat = cmd->internalformat;
6063   GLuint buffer = cmd->buffer;
6064   CALL_TextureBuffer(ctx->CurrentServerDispatch, (texture, internalformat, buffer));
6065   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureBuffer), 8) / 8);
6066   assert (cmd_size == cmd->cmd_base.cmd_size);
6067   return cmd_size;
6068}
6069void GLAPIENTRY
6070_mesa_marshal_TextureBuffer(GLuint texture, GLenum internalformat, GLuint buffer)
6071{
6072   GET_CURRENT_CONTEXT(ctx);
6073   int cmd_size = sizeof(struct marshal_cmd_TextureBuffer);
6074   struct marshal_cmd_TextureBuffer *cmd;
6075   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureBuffer, cmd_size);
6076   cmd->texture = texture;
6077   cmd->internalformat = internalformat;
6078   cmd->buffer = buffer;
6079}
6080
6081
6082/* TextureBufferRange: marshalled asynchronously */
6083struct marshal_cmd_TextureBufferRange
6084{
6085   struct marshal_cmd_base cmd_base;
6086   GLuint texture;
6087   GLenum internalformat;
6088   GLuint buffer;
6089   GLintptr offset;
6090   GLsizeiptr size;
6091};
6092uint32_t
6093_mesa_unmarshal_TextureBufferRange(struct gl_context *ctx, const struct marshal_cmd_TextureBufferRange *cmd, const uint64_t *last)
6094{
6095   GLuint texture = cmd->texture;
6096   GLenum internalformat = cmd->internalformat;
6097   GLuint buffer = cmd->buffer;
6098   GLintptr offset = cmd->offset;
6099   GLsizeiptr size = cmd->size;
6100   CALL_TextureBufferRange(ctx->CurrentServerDispatch, (texture, internalformat, buffer, offset, size));
6101   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureBufferRange), 8) / 8);
6102   assert (cmd_size == cmd->cmd_base.cmd_size);
6103   return cmd_size;
6104}
6105void GLAPIENTRY
6106_mesa_marshal_TextureBufferRange(GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size)
6107{
6108   GET_CURRENT_CONTEXT(ctx);
6109   int cmd_size = sizeof(struct marshal_cmd_TextureBufferRange);
6110   struct marshal_cmd_TextureBufferRange *cmd;
6111   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureBufferRange, cmd_size);
6112   cmd->texture = texture;
6113   cmd->internalformat = internalformat;
6114   cmd->buffer = buffer;
6115   cmd->offset = offset;
6116   cmd->size = size;
6117}
6118
6119
6120/* TextureStorage1D: marshalled asynchronously */
6121struct marshal_cmd_TextureStorage1D
6122{
6123   struct marshal_cmd_base cmd_base;
6124   GLuint texture;
6125   GLsizei levels;
6126   GLenum internalformat;
6127   GLsizei width;
6128};
6129uint32_t
6130_mesa_unmarshal_TextureStorage1D(struct gl_context *ctx, const struct marshal_cmd_TextureStorage1D *cmd, const uint64_t *last)
6131{
6132   GLuint texture = cmd->texture;
6133   GLsizei levels = cmd->levels;
6134   GLenum internalformat = cmd->internalformat;
6135   GLsizei width = cmd->width;
6136   CALL_TextureStorage1D(ctx->CurrentServerDispatch, (texture, levels, internalformat, width));
6137   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureStorage1D), 8) / 8);
6138   assert (cmd_size == cmd->cmd_base.cmd_size);
6139   return cmd_size;
6140}
6141void GLAPIENTRY
6142_mesa_marshal_TextureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width)
6143{
6144   GET_CURRENT_CONTEXT(ctx);
6145   int cmd_size = sizeof(struct marshal_cmd_TextureStorage1D);
6146   struct marshal_cmd_TextureStorage1D *cmd;
6147   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureStorage1D, cmd_size);
6148   cmd->texture = texture;
6149   cmd->levels = levels;
6150   cmd->internalformat = internalformat;
6151   cmd->width = width;
6152}
6153
6154
6155/* TextureStorage2D: marshalled asynchronously */
6156struct marshal_cmd_TextureStorage2D
6157{
6158   struct marshal_cmd_base cmd_base;
6159   GLuint texture;
6160   GLsizei levels;
6161   GLenum internalformat;
6162   GLsizei width;
6163   GLsizei height;
6164};
6165uint32_t
6166_mesa_unmarshal_TextureStorage2D(struct gl_context *ctx, const struct marshal_cmd_TextureStorage2D *cmd, const uint64_t *last)
6167{
6168   GLuint texture = cmd->texture;
6169   GLsizei levels = cmd->levels;
6170   GLenum internalformat = cmd->internalformat;
6171   GLsizei width = cmd->width;
6172   GLsizei height = cmd->height;
6173   CALL_TextureStorage2D(ctx->CurrentServerDispatch, (texture, levels, internalformat, width, height));
6174   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureStorage2D), 8) / 8);
6175   assert (cmd_size == cmd->cmd_base.cmd_size);
6176   return cmd_size;
6177}
6178void GLAPIENTRY
6179_mesa_marshal_TextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
6180{
6181   GET_CURRENT_CONTEXT(ctx);
6182   int cmd_size = sizeof(struct marshal_cmd_TextureStorage2D);
6183   struct marshal_cmd_TextureStorage2D *cmd;
6184   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureStorage2D, cmd_size);
6185   cmd->texture = texture;
6186   cmd->levels = levels;
6187   cmd->internalformat = internalformat;
6188   cmd->width = width;
6189   cmd->height = height;
6190}
6191
6192
6193/* TextureStorage3D: marshalled asynchronously */
6194struct marshal_cmd_TextureStorage3D
6195{
6196   struct marshal_cmd_base cmd_base;
6197   GLuint texture;
6198   GLsizei levels;
6199   GLenum internalformat;
6200   GLsizei width;
6201   GLsizei height;
6202   GLsizei depth;
6203};
6204uint32_t
6205_mesa_unmarshal_TextureStorage3D(struct gl_context *ctx, const struct marshal_cmd_TextureStorage3D *cmd, const uint64_t *last)
6206{
6207   GLuint texture = cmd->texture;
6208   GLsizei levels = cmd->levels;
6209   GLenum internalformat = cmd->internalformat;
6210   GLsizei width = cmd->width;
6211   GLsizei height = cmd->height;
6212   GLsizei depth = cmd->depth;
6213   CALL_TextureStorage3D(ctx->CurrentServerDispatch, (texture, levels, internalformat, width, height, depth));
6214   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureStorage3D), 8) / 8);
6215   assert (cmd_size == cmd->cmd_base.cmd_size);
6216   return cmd_size;
6217}
6218void GLAPIENTRY
6219_mesa_marshal_TextureStorage3D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
6220{
6221   GET_CURRENT_CONTEXT(ctx);
6222   int cmd_size = sizeof(struct marshal_cmd_TextureStorage3D);
6223   struct marshal_cmd_TextureStorage3D *cmd;
6224   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureStorage3D, cmd_size);
6225   cmd->texture = texture;
6226   cmd->levels = levels;
6227   cmd->internalformat = internalformat;
6228   cmd->width = width;
6229   cmd->height = height;
6230   cmd->depth = depth;
6231}
6232
6233
6234/* TextureStorage2DMultisample: marshalled asynchronously */
6235struct marshal_cmd_TextureStorage2DMultisample
6236{
6237   struct marshal_cmd_base cmd_base;
6238   GLboolean fixedsamplelocations;
6239   GLuint texture;
6240   GLsizei samples;
6241   GLenum internalformat;
6242   GLsizei width;
6243   GLsizei height;
6244};
6245uint32_t
6246_mesa_unmarshal_TextureStorage2DMultisample(struct gl_context *ctx, const struct marshal_cmd_TextureStorage2DMultisample *cmd, const uint64_t *last)
6247{
6248   GLuint texture = cmd->texture;
6249   GLsizei samples = cmd->samples;
6250   GLenum internalformat = cmd->internalformat;
6251   GLsizei width = cmd->width;
6252   GLsizei height = cmd->height;
6253   GLboolean fixedsamplelocations = cmd->fixedsamplelocations;
6254   CALL_TextureStorage2DMultisample(ctx->CurrentServerDispatch, (texture, samples, internalformat, width, height, fixedsamplelocations));
6255   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureStorage2DMultisample), 8) / 8);
6256   assert (cmd_size == cmd->cmd_base.cmd_size);
6257   return cmd_size;
6258}
6259void GLAPIENTRY
6260_mesa_marshal_TextureStorage2DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
6261{
6262   GET_CURRENT_CONTEXT(ctx);
6263   int cmd_size = sizeof(struct marshal_cmd_TextureStorage2DMultisample);
6264   struct marshal_cmd_TextureStorage2DMultisample *cmd;
6265   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureStorage2DMultisample, cmd_size);
6266   cmd->texture = texture;
6267   cmd->samples = samples;
6268   cmd->internalformat = internalformat;
6269   cmd->width = width;
6270   cmd->height = height;
6271   cmd->fixedsamplelocations = fixedsamplelocations;
6272}
6273
6274
6275/* TextureStorage3DMultisample: marshalled asynchronously */
6276struct marshal_cmd_TextureStorage3DMultisample
6277{
6278   struct marshal_cmd_base cmd_base;
6279   GLboolean fixedsamplelocations;
6280   GLuint texture;
6281   GLsizei samples;
6282   GLenum internalformat;
6283   GLsizei width;
6284   GLsizei height;
6285   GLsizei depth;
6286};
6287uint32_t
6288_mesa_unmarshal_TextureStorage3DMultisample(struct gl_context *ctx, const struct marshal_cmd_TextureStorage3DMultisample *cmd, const uint64_t *last)
6289{
6290   GLuint texture = cmd->texture;
6291   GLsizei samples = cmd->samples;
6292   GLenum internalformat = cmd->internalformat;
6293   GLsizei width = cmd->width;
6294   GLsizei height = cmd->height;
6295   GLsizei depth = cmd->depth;
6296   GLboolean fixedsamplelocations = cmd->fixedsamplelocations;
6297   CALL_TextureStorage3DMultisample(ctx->CurrentServerDispatch, (texture, samples, internalformat, width, height, depth, fixedsamplelocations));
6298   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureStorage3DMultisample), 8) / 8);
6299   assert (cmd_size == cmd->cmd_base.cmd_size);
6300   return cmd_size;
6301}
6302void GLAPIENTRY
6303_mesa_marshal_TextureStorage3DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)
6304{
6305   GET_CURRENT_CONTEXT(ctx);
6306   int cmd_size = sizeof(struct marshal_cmd_TextureStorage3DMultisample);
6307   struct marshal_cmd_TextureStorage3DMultisample *cmd;
6308   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureStorage3DMultisample, cmd_size);
6309   cmd->texture = texture;
6310   cmd->samples = samples;
6311   cmd->internalformat = internalformat;
6312   cmd->width = width;
6313   cmd->height = height;
6314   cmd->depth = depth;
6315   cmd->fixedsamplelocations = fixedsamplelocations;
6316}
6317
6318
6319/* TextureSubImage1D: marshalled asynchronously */
6320struct marshal_cmd_TextureSubImage1D
6321{
6322   struct marshal_cmd_base cmd_base;
6323   GLuint texture;
6324   GLint level;
6325   GLint xoffset;
6326   GLsizei width;
6327   GLenum format;
6328   GLenum type;
6329   const GLvoid * pixels;
6330};
6331uint32_t
6332_mesa_unmarshal_TextureSubImage1D(struct gl_context *ctx, const struct marshal_cmd_TextureSubImage1D *cmd, const uint64_t *last)
6333{
6334   GLuint texture = cmd->texture;
6335   GLint level = cmd->level;
6336   GLint xoffset = cmd->xoffset;
6337   GLsizei width = cmd->width;
6338   GLenum format = cmd->format;
6339   GLenum type = cmd->type;
6340   const GLvoid * pixels = cmd->pixels;
6341   CALL_TextureSubImage1D(ctx->CurrentServerDispatch, (texture, level, xoffset, width, format, type, pixels));
6342   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureSubImage1D), 8) / 8);
6343   assert (cmd_size == cmd->cmd_base.cmd_size);
6344   return cmd_size;
6345}
6346void GLAPIENTRY
6347_mesa_marshal_TextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels)
6348{
6349   GET_CURRENT_CONTEXT(ctx);
6350   int cmd_size = sizeof(struct marshal_cmd_TextureSubImage1D);
6351   struct marshal_cmd_TextureSubImage1D *cmd;
6352   if (_mesa_glthread_has_no_unpack_buffer(ctx)) {
6353      _mesa_glthread_finish_before(ctx, "TextureSubImage1D");
6354      CALL_TextureSubImage1D(ctx->CurrentServerDispatch, (texture, level, xoffset, width, format, type, pixels));
6355      return;
6356   }
6357   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureSubImage1D, cmd_size);
6358   cmd->texture = texture;
6359   cmd->level = level;
6360   cmd->xoffset = xoffset;
6361   cmd->width = width;
6362   cmd->format = format;
6363   cmd->type = type;
6364   cmd->pixels = pixels;
6365}
6366
6367
6368/* TextureSubImage2D: marshalled asynchronously */
6369struct marshal_cmd_TextureSubImage2D
6370{
6371   struct marshal_cmd_base cmd_base;
6372   GLuint texture;
6373   GLint level;
6374   GLint xoffset;
6375   GLint yoffset;
6376   GLsizei width;
6377   GLsizei height;
6378   GLenum format;
6379   GLenum type;
6380   const GLvoid * pixels;
6381};
6382uint32_t
6383_mesa_unmarshal_TextureSubImage2D(struct gl_context *ctx, const struct marshal_cmd_TextureSubImage2D *cmd, const uint64_t *last)
6384{
6385   GLuint texture = cmd->texture;
6386   GLint level = cmd->level;
6387   GLint xoffset = cmd->xoffset;
6388   GLint yoffset = cmd->yoffset;
6389   GLsizei width = cmd->width;
6390   GLsizei height = cmd->height;
6391   GLenum format = cmd->format;
6392   GLenum type = cmd->type;
6393   const GLvoid * pixels = cmd->pixels;
6394   CALL_TextureSubImage2D(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, width, height, format, type, pixels));
6395   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureSubImage2D), 8) / 8);
6396   assert (cmd_size == cmd->cmd_base.cmd_size);
6397   return cmd_size;
6398}
6399void GLAPIENTRY
6400_mesa_marshal_TextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels)
6401{
6402   GET_CURRENT_CONTEXT(ctx);
6403   int cmd_size = sizeof(struct marshal_cmd_TextureSubImage2D);
6404   struct marshal_cmd_TextureSubImage2D *cmd;
6405   if (_mesa_glthread_has_no_unpack_buffer(ctx)) {
6406      _mesa_glthread_finish_before(ctx, "TextureSubImage2D");
6407      CALL_TextureSubImage2D(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, width, height, format, type, pixels));
6408      return;
6409   }
6410   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureSubImage2D, cmd_size);
6411   cmd->texture = texture;
6412   cmd->level = level;
6413   cmd->xoffset = xoffset;
6414   cmd->yoffset = yoffset;
6415   cmd->width = width;
6416   cmd->height = height;
6417   cmd->format = format;
6418   cmd->type = type;
6419   cmd->pixels = pixels;
6420}
6421
6422
6423/* TextureSubImage3D: marshalled asynchronously */
6424struct marshal_cmd_TextureSubImage3D
6425{
6426   struct marshal_cmd_base cmd_base;
6427   GLuint texture;
6428   GLint level;
6429   GLint xoffset;
6430   GLint yoffset;
6431   GLint zoffset;
6432   GLsizei width;
6433   GLsizei height;
6434   GLsizei depth;
6435   GLenum format;
6436   GLenum type;
6437   const GLvoid * pixels;
6438};
6439uint32_t
6440_mesa_unmarshal_TextureSubImage3D(struct gl_context *ctx, const struct marshal_cmd_TextureSubImage3D *cmd, const uint64_t *last)
6441{
6442   GLuint texture = cmd->texture;
6443   GLint level = cmd->level;
6444   GLint xoffset = cmd->xoffset;
6445   GLint yoffset = cmd->yoffset;
6446   GLint zoffset = cmd->zoffset;
6447   GLsizei width = cmd->width;
6448   GLsizei height = cmd->height;
6449   GLsizei depth = cmd->depth;
6450   GLenum format = cmd->format;
6451   GLenum type = cmd->type;
6452   const GLvoid * pixels = cmd->pixels;
6453   CALL_TextureSubImage3D(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels));
6454   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureSubImage3D), 8) / 8);
6455   assert (cmd_size == cmd->cmd_base.cmd_size);
6456   return cmd_size;
6457}
6458void GLAPIENTRY
6459_mesa_marshal_TextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels)
6460{
6461   GET_CURRENT_CONTEXT(ctx);
6462   int cmd_size = sizeof(struct marshal_cmd_TextureSubImage3D);
6463   struct marshal_cmd_TextureSubImage3D *cmd;
6464   if (_mesa_glthread_has_no_unpack_buffer(ctx)) {
6465      _mesa_glthread_finish_before(ctx, "TextureSubImage3D");
6466      CALL_TextureSubImage3D(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels));
6467      return;
6468   }
6469   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureSubImage3D, cmd_size);
6470   cmd->texture = texture;
6471   cmd->level = level;
6472   cmd->xoffset = xoffset;
6473   cmd->yoffset = yoffset;
6474   cmd->zoffset = zoffset;
6475   cmd->width = width;
6476   cmd->height = height;
6477   cmd->depth = depth;
6478   cmd->format = format;
6479   cmd->type = type;
6480   cmd->pixels = pixels;
6481}
6482
6483
6484/* CompressedTextureSubImage1D: marshalled asynchronously */
6485struct marshal_cmd_CompressedTextureSubImage1D
6486{
6487   struct marshal_cmd_base cmd_base;
6488   GLuint texture;
6489   GLint level;
6490   GLint xoffset;
6491   GLsizei width;
6492   GLenum format;
6493   GLsizei imageSize;
6494   const GLvoid * data;
6495};
6496uint32_t
6497_mesa_unmarshal_CompressedTextureSubImage1D(struct gl_context *ctx, const struct marshal_cmd_CompressedTextureSubImage1D *cmd, const uint64_t *last)
6498{
6499   GLuint texture = cmd->texture;
6500   GLint level = cmd->level;
6501   GLint xoffset = cmd->xoffset;
6502   GLsizei width = cmd->width;
6503   GLenum format = cmd->format;
6504   GLsizei imageSize = cmd->imageSize;
6505   const GLvoid * data = cmd->data;
6506   CALL_CompressedTextureSubImage1D(ctx->CurrentServerDispatch, (texture, level, xoffset, width, format, imageSize, data));
6507   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_CompressedTextureSubImage1D), 8) / 8);
6508   assert (cmd_size == cmd->cmd_base.cmd_size);
6509   return cmd_size;
6510}
6511void GLAPIENTRY
6512_mesa_marshal_CompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data)
6513{
6514   GET_CURRENT_CONTEXT(ctx);
6515   int cmd_size = sizeof(struct marshal_cmd_CompressedTextureSubImage1D);
6516   struct marshal_cmd_CompressedTextureSubImage1D *cmd;
6517   if (_mesa_glthread_has_no_unpack_buffer(ctx)) {
6518      _mesa_glthread_finish_before(ctx, "CompressedTextureSubImage1D");
6519      CALL_CompressedTextureSubImage1D(ctx->CurrentServerDispatch, (texture, level, xoffset, width, format, imageSize, data));
6520      return;
6521   }
6522   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_CompressedTextureSubImage1D, cmd_size);
6523   cmd->texture = texture;
6524   cmd->level = level;
6525   cmd->xoffset = xoffset;
6526   cmd->width = width;
6527   cmd->format = format;
6528   cmd->imageSize = imageSize;
6529   cmd->data = data;
6530}
6531
6532
6533/* CompressedTextureSubImage2D: marshalled asynchronously */
6534struct marshal_cmd_CompressedTextureSubImage2D
6535{
6536   struct marshal_cmd_base cmd_base;
6537   GLuint texture;
6538   GLint level;
6539   GLint xoffset;
6540   GLint yoffset;
6541   GLsizei width;
6542   GLsizei height;
6543   GLenum format;
6544   GLsizei imageSize;
6545   const GLvoid * data;
6546};
6547uint32_t
6548_mesa_unmarshal_CompressedTextureSubImage2D(struct gl_context *ctx, const struct marshal_cmd_CompressedTextureSubImage2D *cmd, const uint64_t *last)
6549{
6550   GLuint texture = cmd->texture;
6551   GLint level = cmd->level;
6552   GLint xoffset = cmd->xoffset;
6553   GLint yoffset = cmd->yoffset;
6554   GLsizei width = cmd->width;
6555   GLsizei height = cmd->height;
6556   GLenum format = cmd->format;
6557   GLsizei imageSize = cmd->imageSize;
6558   const GLvoid * data = cmd->data;
6559   CALL_CompressedTextureSubImage2D(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, width, height, format, imageSize, data));
6560   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_CompressedTextureSubImage2D), 8) / 8);
6561   assert (cmd_size == cmd->cmd_base.cmd_size);
6562   return cmd_size;
6563}
6564void GLAPIENTRY
6565_mesa_marshal_CompressedTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data)
6566{
6567   GET_CURRENT_CONTEXT(ctx);
6568   int cmd_size = sizeof(struct marshal_cmd_CompressedTextureSubImage2D);
6569   struct marshal_cmd_CompressedTextureSubImage2D *cmd;
6570   if (_mesa_glthread_has_no_unpack_buffer(ctx)) {
6571      _mesa_glthread_finish_before(ctx, "CompressedTextureSubImage2D");
6572      CALL_CompressedTextureSubImage2D(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, width, height, format, imageSize, data));
6573      return;
6574   }
6575   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_CompressedTextureSubImage2D, cmd_size);
6576   cmd->texture = texture;
6577   cmd->level = level;
6578   cmd->xoffset = xoffset;
6579   cmd->yoffset = yoffset;
6580   cmd->width = width;
6581   cmd->height = height;
6582   cmd->format = format;
6583   cmd->imageSize = imageSize;
6584   cmd->data = data;
6585}
6586
6587
6588/* CompressedTextureSubImage3D: marshalled asynchronously */
6589struct marshal_cmd_CompressedTextureSubImage3D
6590{
6591   struct marshal_cmd_base cmd_base;
6592   GLuint texture;
6593   GLint level;
6594   GLint xoffset;
6595   GLint yoffset;
6596   GLint zoffset;
6597   GLsizei width;
6598   GLsizei height;
6599   GLsizei depth;
6600   GLenum format;
6601   GLsizei imageSize;
6602   const GLvoid * data;
6603};
6604uint32_t
6605_mesa_unmarshal_CompressedTextureSubImage3D(struct gl_context *ctx, const struct marshal_cmd_CompressedTextureSubImage3D *cmd, const uint64_t *last)
6606{
6607   GLuint texture = cmd->texture;
6608   GLint level = cmd->level;
6609   GLint xoffset = cmd->xoffset;
6610   GLint yoffset = cmd->yoffset;
6611   GLint zoffset = cmd->zoffset;
6612   GLsizei width = cmd->width;
6613   GLsizei height = cmd->height;
6614   GLsizei depth = cmd->depth;
6615   GLenum format = cmd->format;
6616   GLsizei imageSize = cmd->imageSize;
6617   const GLvoid * data = cmd->data;
6618   CALL_CompressedTextureSubImage3D(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data));
6619   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_CompressedTextureSubImage3D), 8) / 8);
6620   assert (cmd_size == cmd->cmd_base.cmd_size);
6621   return cmd_size;
6622}
6623void GLAPIENTRY
6624_mesa_marshal_CompressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data)
6625{
6626   GET_CURRENT_CONTEXT(ctx);
6627   int cmd_size = sizeof(struct marshal_cmd_CompressedTextureSubImage3D);
6628   struct marshal_cmd_CompressedTextureSubImage3D *cmd;
6629   if (_mesa_glthread_has_no_unpack_buffer(ctx)) {
6630      _mesa_glthread_finish_before(ctx, "CompressedTextureSubImage3D");
6631      CALL_CompressedTextureSubImage3D(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data));
6632      return;
6633   }
6634   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_CompressedTextureSubImage3D, cmd_size);
6635   cmd->texture = texture;
6636   cmd->level = level;
6637   cmd->xoffset = xoffset;
6638   cmd->yoffset = yoffset;
6639   cmd->zoffset = zoffset;
6640   cmd->width = width;
6641   cmd->height = height;
6642   cmd->depth = depth;
6643   cmd->format = format;
6644   cmd->imageSize = imageSize;
6645   cmd->data = data;
6646}
6647
6648
6649/* CopyTextureSubImage1D: marshalled asynchronously */
6650struct marshal_cmd_CopyTextureSubImage1D
6651{
6652   struct marshal_cmd_base cmd_base;
6653   GLuint texture;
6654   GLint level;
6655   GLint xoffset;
6656   GLint x;
6657   GLint y;
6658   GLsizei width;
6659};
6660uint32_t
6661_mesa_unmarshal_CopyTextureSubImage1D(struct gl_context *ctx, const struct marshal_cmd_CopyTextureSubImage1D *cmd, const uint64_t *last)
6662{
6663   GLuint texture = cmd->texture;
6664   GLint level = cmd->level;
6665   GLint xoffset = cmd->xoffset;
6666   GLint x = cmd->x;
6667   GLint y = cmd->y;
6668   GLsizei width = cmd->width;
6669   CALL_CopyTextureSubImage1D(ctx->CurrentServerDispatch, (texture, level, xoffset, x, y, width));
6670   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_CopyTextureSubImage1D), 8) / 8);
6671   assert (cmd_size == cmd->cmd_base.cmd_size);
6672   return cmd_size;
6673}
6674void GLAPIENTRY
6675_mesa_marshal_CopyTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
6676{
6677   GET_CURRENT_CONTEXT(ctx);
6678   int cmd_size = sizeof(struct marshal_cmd_CopyTextureSubImage1D);
6679   struct marshal_cmd_CopyTextureSubImage1D *cmd;
6680   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_CopyTextureSubImage1D, cmd_size);
6681   cmd->texture = texture;
6682   cmd->level = level;
6683   cmd->xoffset = xoffset;
6684   cmd->x = x;
6685   cmd->y = y;
6686   cmd->width = width;
6687}
6688
6689
6690/* CopyTextureSubImage2D: marshalled asynchronously */
6691struct marshal_cmd_CopyTextureSubImage2D
6692{
6693   struct marshal_cmd_base cmd_base;
6694   GLuint texture;
6695   GLint level;
6696   GLint xoffset;
6697   GLint yoffset;
6698   GLint x;
6699   GLint y;
6700   GLsizei width;
6701   GLsizei height;
6702};
6703uint32_t
6704_mesa_unmarshal_CopyTextureSubImage2D(struct gl_context *ctx, const struct marshal_cmd_CopyTextureSubImage2D *cmd, const uint64_t *last)
6705{
6706   GLuint texture = cmd->texture;
6707   GLint level = cmd->level;
6708   GLint xoffset = cmd->xoffset;
6709   GLint yoffset = cmd->yoffset;
6710   GLint x = cmd->x;
6711   GLint y = cmd->y;
6712   GLsizei width = cmd->width;
6713   GLsizei height = cmd->height;
6714   CALL_CopyTextureSubImage2D(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, x, y, width, height));
6715   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_CopyTextureSubImage2D), 8) / 8);
6716   assert (cmd_size == cmd->cmd_base.cmd_size);
6717   return cmd_size;
6718}
6719void GLAPIENTRY
6720_mesa_marshal_CopyTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
6721{
6722   GET_CURRENT_CONTEXT(ctx);
6723   int cmd_size = sizeof(struct marshal_cmd_CopyTextureSubImage2D);
6724   struct marshal_cmd_CopyTextureSubImage2D *cmd;
6725   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_CopyTextureSubImage2D, cmd_size);
6726   cmd->texture = texture;
6727   cmd->level = level;
6728   cmd->xoffset = xoffset;
6729   cmd->yoffset = yoffset;
6730   cmd->x = x;
6731   cmd->y = y;
6732   cmd->width = width;
6733   cmd->height = height;
6734}
6735
6736
6737/* CopyTextureSubImage3D: marshalled asynchronously */
6738struct marshal_cmd_CopyTextureSubImage3D
6739{
6740   struct marshal_cmd_base cmd_base;
6741   GLuint texture;
6742   GLint level;
6743   GLint xoffset;
6744   GLint yoffset;
6745   GLint zoffset;
6746   GLint x;
6747   GLint y;
6748   GLsizei width;
6749   GLsizei height;
6750};
6751uint32_t
6752_mesa_unmarshal_CopyTextureSubImage3D(struct gl_context *ctx, const struct marshal_cmd_CopyTextureSubImage3D *cmd, const uint64_t *last)
6753{
6754   GLuint texture = cmd->texture;
6755   GLint level = cmd->level;
6756   GLint xoffset = cmd->xoffset;
6757   GLint yoffset = cmd->yoffset;
6758   GLint zoffset = cmd->zoffset;
6759   GLint x = cmd->x;
6760   GLint y = cmd->y;
6761   GLsizei width = cmd->width;
6762   GLsizei height = cmd->height;
6763   CALL_CopyTextureSubImage3D(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, zoffset, x, y, width, height));
6764   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_CopyTextureSubImage3D), 8) / 8);
6765   assert (cmd_size == cmd->cmd_base.cmd_size);
6766   return cmd_size;
6767}
6768void GLAPIENTRY
6769_mesa_marshal_CopyTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
6770{
6771   GET_CURRENT_CONTEXT(ctx);
6772   int cmd_size = sizeof(struct marshal_cmd_CopyTextureSubImage3D);
6773   struct marshal_cmd_CopyTextureSubImage3D *cmd;
6774   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_CopyTextureSubImage3D, cmd_size);
6775   cmd->texture = texture;
6776   cmd->level = level;
6777   cmd->xoffset = xoffset;
6778   cmd->yoffset = yoffset;
6779   cmd->zoffset = zoffset;
6780   cmd->x = x;
6781   cmd->y = y;
6782   cmd->width = width;
6783   cmd->height = height;
6784}
6785
6786
6787/* TextureParameterf: marshalled asynchronously */
6788struct marshal_cmd_TextureParameterf
6789{
6790   struct marshal_cmd_base cmd_base;
6791   GLuint texture;
6792   GLenum pname;
6793   GLfloat param;
6794};
6795uint32_t
6796_mesa_unmarshal_TextureParameterf(struct gl_context *ctx, const struct marshal_cmd_TextureParameterf *cmd, const uint64_t *last)
6797{
6798   GLuint texture = cmd->texture;
6799   GLenum pname = cmd->pname;
6800   GLfloat param = cmd->param;
6801   CALL_TextureParameterf(ctx->CurrentServerDispatch, (texture, pname, param));
6802   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureParameterf), 8) / 8);
6803   assert (cmd_size == cmd->cmd_base.cmd_size);
6804   return cmd_size;
6805}
6806void GLAPIENTRY
6807_mesa_marshal_TextureParameterf(GLuint texture, GLenum pname, GLfloat param)
6808{
6809   GET_CURRENT_CONTEXT(ctx);
6810   int cmd_size = sizeof(struct marshal_cmd_TextureParameterf);
6811   struct marshal_cmd_TextureParameterf *cmd;
6812   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureParameterf, cmd_size);
6813   cmd->texture = texture;
6814   cmd->pname = pname;
6815   cmd->param = param;
6816}
6817
6818
6819/* TextureParameterfv: marshalled asynchronously */
6820struct marshal_cmd_TextureParameterfv
6821{
6822   struct marshal_cmd_base cmd_base;
6823   GLuint texture;
6824   GLenum pname;
6825   /* Next safe_mul(_mesa_tex_param_enum_to_count(pname), 1 * sizeof(GLfloat)) bytes are GLfloat param[_mesa_tex_param_enum_to_count(pname)] */
6826};
6827uint32_t
6828_mesa_unmarshal_TextureParameterfv(struct gl_context *ctx, const struct marshal_cmd_TextureParameterfv *cmd, const uint64_t *last)
6829{
6830   GLuint texture = cmd->texture;
6831   GLenum pname = cmd->pname;
6832   GLfloat * param;
6833   const char *variable_data = (const char *) (cmd + 1);
6834   param = (GLfloat *) variable_data;
6835   CALL_TextureParameterfv(ctx->CurrentServerDispatch, (texture, pname, param));
6836   return cmd->cmd_base.cmd_size;
6837}
6838void GLAPIENTRY
6839_mesa_marshal_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat * param)
6840{
6841   GET_CURRENT_CONTEXT(ctx);
6842   int param_size = safe_mul(_mesa_tex_param_enum_to_count(pname), 1 * sizeof(GLfloat));
6843   int cmd_size = sizeof(struct marshal_cmd_TextureParameterfv) + param_size;
6844   struct marshal_cmd_TextureParameterfv *cmd;
6845   if (unlikely(param_size < 0 || (param_size > 0 && !param) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
6846      _mesa_glthread_finish_before(ctx, "TextureParameterfv");
6847      CALL_TextureParameterfv(ctx->CurrentServerDispatch, (texture, pname, param));
6848      return;
6849   }
6850   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureParameterfv, cmd_size);
6851   cmd->texture = texture;
6852   cmd->pname = pname;
6853   char *variable_data = (char *) (cmd + 1);
6854   memcpy(variable_data, param, param_size);
6855}
6856
6857
6858/* TextureParameteri: marshalled asynchronously */
6859struct marshal_cmd_TextureParameteri
6860{
6861   struct marshal_cmd_base cmd_base;
6862   GLuint texture;
6863   GLenum pname;
6864   GLint param;
6865};
6866uint32_t
6867_mesa_unmarshal_TextureParameteri(struct gl_context *ctx, const struct marshal_cmd_TextureParameteri *cmd, const uint64_t *last)
6868{
6869   GLuint texture = cmd->texture;
6870   GLenum pname = cmd->pname;
6871   GLint param = cmd->param;
6872   CALL_TextureParameteri(ctx->CurrentServerDispatch, (texture, pname, param));
6873   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureParameteri), 8) / 8);
6874   assert (cmd_size == cmd->cmd_base.cmd_size);
6875   return cmd_size;
6876}
6877void GLAPIENTRY
6878_mesa_marshal_TextureParameteri(GLuint texture, GLenum pname, GLint param)
6879{
6880   GET_CURRENT_CONTEXT(ctx);
6881   int cmd_size = sizeof(struct marshal_cmd_TextureParameteri);
6882   struct marshal_cmd_TextureParameteri *cmd;
6883   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureParameteri, cmd_size);
6884   cmd->texture = texture;
6885   cmd->pname = pname;
6886   cmd->param = param;
6887}
6888
6889
6890/* TextureParameterIiv: marshalled asynchronously */
6891struct marshal_cmd_TextureParameterIiv
6892{
6893   struct marshal_cmd_base cmd_base;
6894   GLuint texture;
6895   GLenum pname;
6896   /* Next safe_mul(_mesa_tex_param_enum_to_count(pname), 1 * sizeof(GLint)) bytes are GLint params[_mesa_tex_param_enum_to_count(pname)] */
6897};
6898uint32_t
6899_mesa_unmarshal_TextureParameterIiv(struct gl_context *ctx, const struct marshal_cmd_TextureParameterIiv *cmd, const uint64_t *last)
6900{
6901   GLuint texture = cmd->texture;
6902   GLenum pname = cmd->pname;
6903   GLint * params;
6904   const char *variable_data = (const char *) (cmd + 1);
6905   params = (GLint *) variable_data;
6906   CALL_TextureParameterIiv(ctx->CurrentServerDispatch, (texture, pname, params));
6907   return cmd->cmd_base.cmd_size;
6908}
6909void GLAPIENTRY
6910_mesa_marshal_TextureParameterIiv(GLuint texture, GLenum pname, const GLint * params)
6911{
6912   GET_CURRENT_CONTEXT(ctx);
6913   int params_size = safe_mul(_mesa_tex_param_enum_to_count(pname), 1 * sizeof(GLint));
6914   int cmd_size = sizeof(struct marshal_cmd_TextureParameterIiv) + params_size;
6915   struct marshal_cmd_TextureParameterIiv *cmd;
6916   if (unlikely(params_size < 0 || (params_size > 0 && !params) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
6917      _mesa_glthread_finish_before(ctx, "TextureParameterIiv");
6918      CALL_TextureParameterIiv(ctx->CurrentServerDispatch, (texture, pname, params));
6919      return;
6920   }
6921   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureParameterIiv, cmd_size);
6922   cmd->texture = texture;
6923   cmd->pname = pname;
6924   char *variable_data = (char *) (cmd + 1);
6925   memcpy(variable_data, params, params_size);
6926}
6927
6928
6929/* TextureParameterIuiv: marshalled asynchronously */
6930struct marshal_cmd_TextureParameterIuiv
6931{
6932   struct marshal_cmd_base cmd_base;
6933   GLuint texture;
6934   GLenum pname;
6935   /* Next safe_mul(_mesa_tex_param_enum_to_count(pname), 1 * sizeof(GLuint)) bytes are GLuint params[_mesa_tex_param_enum_to_count(pname)] */
6936};
6937uint32_t
6938_mesa_unmarshal_TextureParameterIuiv(struct gl_context *ctx, const struct marshal_cmd_TextureParameterIuiv *cmd, const uint64_t *last)
6939{
6940   GLuint texture = cmd->texture;
6941   GLenum pname = cmd->pname;
6942   GLuint * params;
6943   const char *variable_data = (const char *) (cmd + 1);
6944   params = (GLuint *) variable_data;
6945   CALL_TextureParameterIuiv(ctx->CurrentServerDispatch, (texture, pname, params));
6946   return cmd->cmd_base.cmd_size;
6947}
6948void GLAPIENTRY
6949_mesa_marshal_TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint * params)
6950{
6951   GET_CURRENT_CONTEXT(ctx);
6952   int params_size = safe_mul(_mesa_tex_param_enum_to_count(pname), 1 * sizeof(GLuint));
6953   int cmd_size = sizeof(struct marshal_cmd_TextureParameterIuiv) + params_size;
6954   struct marshal_cmd_TextureParameterIuiv *cmd;
6955   if (unlikely(params_size < 0 || (params_size > 0 && !params) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
6956      _mesa_glthread_finish_before(ctx, "TextureParameterIuiv");
6957      CALL_TextureParameterIuiv(ctx->CurrentServerDispatch, (texture, pname, params));
6958      return;
6959   }
6960   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureParameterIuiv, cmd_size);
6961   cmd->texture = texture;
6962   cmd->pname = pname;
6963   char *variable_data = (char *) (cmd + 1);
6964   memcpy(variable_data, params, params_size);
6965}
6966
6967
6968/* TextureParameteriv: marshalled asynchronously */
6969struct marshal_cmd_TextureParameteriv
6970{
6971   struct marshal_cmd_base cmd_base;
6972   GLuint texture;
6973   GLenum pname;
6974   /* Next safe_mul(_mesa_tex_param_enum_to_count(pname), 1 * sizeof(GLint)) bytes are GLint param[_mesa_tex_param_enum_to_count(pname)] */
6975};
6976uint32_t
6977_mesa_unmarshal_TextureParameteriv(struct gl_context *ctx, const struct marshal_cmd_TextureParameteriv *cmd, const uint64_t *last)
6978{
6979   GLuint texture = cmd->texture;
6980   GLenum pname = cmd->pname;
6981   GLint * param;
6982   const char *variable_data = (const char *) (cmd + 1);
6983   param = (GLint *) variable_data;
6984   CALL_TextureParameteriv(ctx->CurrentServerDispatch, (texture, pname, param));
6985   return cmd->cmd_base.cmd_size;
6986}
6987void GLAPIENTRY
6988_mesa_marshal_TextureParameteriv(GLuint texture, GLenum pname, const GLint * param)
6989{
6990   GET_CURRENT_CONTEXT(ctx);
6991   int param_size = safe_mul(_mesa_tex_param_enum_to_count(pname), 1 * sizeof(GLint));
6992   int cmd_size = sizeof(struct marshal_cmd_TextureParameteriv) + param_size;
6993   struct marshal_cmd_TextureParameteriv *cmd;
6994   if (unlikely(param_size < 0 || (param_size > 0 && !param) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
6995      _mesa_glthread_finish_before(ctx, "TextureParameteriv");
6996      CALL_TextureParameteriv(ctx->CurrentServerDispatch, (texture, pname, param));
6997      return;
6998   }
6999   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureParameteriv, cmd_size);
7000   cmd->texture = texture;
7001   cmd->pname = pname;
7002   char *variable_data = (char *) (cmd + 1);
7003   memcpy(variable_data, param, param_size);
7004}
7005
7006
7007/* GenerateTextureMipmap: marshalled asynchronously */
7008struct marshal_cmd_GenerateTextureMipmap
7009{
7010   struct marshal_cmd_base cmd_base;
7011   GLuint texture;
7012};
7013uint32_t
7014_mesa_unmarshal_GenerateTextureMipmap(struct gl_context *ctx, const struct marshal_cmd_GenerateTextureMipmap *cmd, const uint64_t *last)
7015{
7016   GLuint texture = cmd->texture;
7017   CALL_GenerateTextureMipmap(ctx->CurrentServerDispatch, (texture));
7018   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_GenerateTextureMipmap), 8) / 8);
7019   assert (cmd_size == cmd->cmd_base.cmd_size);
7020   return cmd_size;
7021}
7022void GLAPIENTRY
7023_mesa_marshal_GenerateTextureMipmap(GLuint texture)
7024{
7025   GET_CURRENT_CONTEXT(ctx);
7026   int cmd_size = sizeof(struct marshal_cmd_GenerateTextureMipmap);
7027   struct marshal_cmd_GenerateTextureMipmap *cmd;
7028   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_GenerateTextureMipmap, cmd_size);
7029   cmd->texture = texture;
7030}
7031
7032
7033/* BindTextureUnit: marshalled asynchronously */
7034struct marshal_cmd_BindTextureUnit
7035{
7036   struct marshal_cmd_base cmd_base;
7037   GLuint unit;
7038   GLuint texture;
7039};
7040uint32_t
7041_mesa_unmarshal_BindTextureUnit(struct gl_context *ctx, const struct marshal_cmd_BindTextureUnit *cmd, const uint64_t *last)
7042{
7043   GLuint unit = cmd->unit;
7044   GLuint texture = cmd->texture;
7045   CALL_BindTextureUnit(ctx->CurrentServerDispatch, (unit, texture));
7046   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_BindTextureUnit), 8) / 8);
7047   assert (cmd_size == cmd->cmd_base.cmd_size);
7048   return cmd_size;
7049}
7050void GLAPIENTRY
7051_mesa_marshal_BindTextureUnit(GLuint unit, GLuint texture)
7052{
7053   GET_CURRENT_CONTEXT(ctx);
7054   int cmd_size = sizeof(struct marshal_cmd_BindTextureUnit);
7055   struct marshal_cmd_BindTextureUnit *cmd;
7056   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_BindTextureUnit, cmd_size);
7057   cmd->unit = unit;
7058   cmd->texture = texture;
7059}
7060
7061
7062/* GetTextureImage: marshalled asynchronously */
7063struct marshal_cmd_GetTextureImage
7064{
7065   struct marshal_cmd_base cmd_base;
7066   GLuint texture;
7067   GLint level;
7068   GLenum format;
7069   GLenum type;
7070   GLsizei bufSize;
7071   GLvoid * pixels;
7072};
7073uint32_t
7074_mesa_unmarshal_GetTextureImage(struct gl_context *ctx, const struct marshal_cmd_GetTextureImage *cmd, const uint64_t *last)
7075{
7076   GLuint texture = cmd->texture;
7077   GLint level = cmd->level;
7078   GLenum format = cmd->format;
7079   GLenum type = cmd->type;
7080   GLsizei bufSize = cmd->bufSize;
7081   GLvoid * pixels = cmd->pixels;
7082   CALL_GetTextureImage(ctx->CurrentServerDispatch, (texture, level, format, type, bufSize, pixels));
7083   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_GetTextureImage), 8) / 8);
7084   assert (cmd_size == cmd->cmd_base.cmd_size);
7085   return cmd_size;
7086}
7087void GLAPIENTRY
7088_mesa_marshal_GetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid * pixels)
7089{
7090   GET_CURRENT_CONTEXT(ctx);
7091   int cmd_size = sizeof(struct marshal_cmd_GetTextureImage);
7092   struct marshal_cmd_GetTextureImage *cmd;
7093   if (_mesa_glthread_has_no_pack_buffer(ctx)) {
7094      _mesa_glthread_finish_before(ctx, "GetTextureImage");
7095      CALL_GetTextureImage(ctx->CurrentServerDispatch, (texture, level, format, type, bufSize, pixels));
7096      return;
7097   }
7098   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_GetTextureImage, cmd_size);
7099   cmd->texture = texture;
7100   cmd->level = level;
7101   cmd->format = format;
7102   cmd->type = type;
7103   cmd->bufSize = bufSize;
7104   cmd->pixels = pixels;
7105}
7106
7107
7108/* GetCompressedTextureImage: marshalled asynchronously */
7109struct marshal_cmd_GetCompressedTextureImage
7110{
7111   struct marshal_cmd_base cmd_base;
7112   GLuint texture;
7113   GLint level;
7114   GLsizei bufSize;
7115   GLvoid * pixels;
7116};
7117uint32_t
7118_mesa_unmarshal_GetCompressedTextureImage(struct gl_context *ctx, const struct marshal_cmd_GetCompressedTextureImage *cmd, const uint64_t *last)
7119{
7120   GLuint texture = cmd->texture;
7121   GLint level = cmd->level;
7122   GLsizei bufSize = cmd->bufSize;
7123   GLvoid * pixels = cmd->pixels;
7124   CALL_GetCompressedTextureImage(ctx->CurrentServerDispatch, (texture, level, bufSize, pixels));
7125   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_GetCompressedTextureImage), 8) / 8);
7126   assert (cmd_size == cmd->cmd_base.cmd_size);
7127   return cmd_size;
7128}
7129void GLAPIENTRY
7130_mesa_marshal_GetCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, GLvoid * pixels)
7131{
7132   GET_CURRENT_CONTEXT(ctx);
7133   int cmd_size = sizeof(struct marshal_cmd_GetCompressedTextureImage);
7134   struct marshal_cmd_GetCompressedTextureImage *cmd;
7135   if (_mesa_glthread_has_no_pack_buffer(ctx)) {
7136      _mesa_glthread_finish_before(ctx, "GetCompressedTextureImage");
7137      CALL_GetCompressedTextureImage(ctx->CurrentServerDispatch, (texture, level, bufSize, pixels));
7138      return;
7139   }
7140   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_GetCompressedTextureImage, cmd_size);
7141   cmd->texture = texture;
7142   cmd->level = level;
7143   cmd->bufSize = bufSize;
7144   cmd->pixels = pixels;
7145}
7146
7147
7148/* GetTextureLevelParameterfv: marshalled synchronously */
7149void GLAPIENTRY
7150_mesa_marshal_GetTextureLevelParameterfv(GLuint texture, GLint level, GLenum pname, GLfloat * params)
7151{
7152   GET_CURRENT_CONTEXT(ctx);
7153   _mesa_glthread_finish_before(ctx, "GetTextureLevelParameterfv");
7154   CALL_GetTextureLevelParameterfv(ctx->CurrentServerDispatch, (texture, level, pname, params));
7155}
7156
7157
7158/* GetTextureLevelParameteriv: marshalled synchronously */
7159void GLAPIENTRY
7160_mesa_marshal_GetTextureLevelParameteriv(GLuint texture, GLint level, GLenum pname, GLint * params)
7161{
7162   GET_CURRENT_CONTEXT(ctx);
7163   _mesa_glthread_finish_before(ctx, "GetTextureLevelParameteriv");
7164   CALL_GetTextureLevelParameteriv(ctx->CurrentServerDispatch, (texture, level, pname, params));
7165}
7166
7167
7168/* GetTextureParameterfv: marshalled synchronously */
7169void GLAPIENTRY
7170_mesa_marshal_GetTextureParameterfv(GLuint texture, GLenum pname, GLfloat * params)
7171{
7172   GET_CURRENT_CONTEXT(ctx);
7173   _mesa_glthread_finish_before(ctx, "GetTextureParameterfv");
7174   CALL_GetTextureParameterfv(ctx->CurrentServerDispatch, (texture, pname, params));
7175}
7176
7177
7178/* GetTextureParameterIiv: marshalled synchronously */
7179void GLAPIENTRY
7180_mesa_marshal_GetTextureParameterIiv(GLuint texture, GLenum pname, GLint * params)
7181{
7182   GET_CURRENT_CONTEXT(ctx);
7183   _mesa_glthread_finish_before(ctx, "GetTextureParameterIiv");
7184   CALL_GetTextureParameterIiv(ctx->CurrentServerDispatch, (texture, pname, params));
7185}
7186
7187
7188/* GetTextureParameterIuiv: marshalled synchronously */
7189void GLAPIENTRY
7190_mesa_marshal_GetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint * params)
7191{
7192   GET_CURRENT_CONTEXT(ctx);
7193   _mesa_glthread_finish_before(ctx, "GetTextureParameterIuiv");
7194   CALL_GetTextureParameterIuiv(ctx->CurrentServerDispatch, (texture, pname, params));
7195}
7196
7197
7198/* GetTextureParameteriv: marshalled synchronously */
7199void GLAPIENTRY
7200_mesa_marshal_GetTextureParameteriv(GLuint texture, GLenum pname, GLint * params)
7201{
7202   GET_CURRENT_CONTEXT(ctx);
7203   _mesa_glthread_finish_before(ctx, "GetTextureParameteriv");
7204   CALL_GetTextureParameteriv(ctx->CurrentServerDispatch, (texture, pname, params));
7205}
7206
7207
7208/* CreateVertexArrays: marshalled synchronously */
7209void GLAPIENTRY
7210_mesa_marshal_CreateVertexArrays(GLsizei n, GLuint * arrays)
7211{
7212   GET_CURRENT_CONTEXT(ctx);
7213   _mesa_glthread_finish_before(ctx, "CreateVertexArrays");
7214   CALL_CreateVertexArrays(ctx->CurrentServerDispatch, (n, arrays));
7215   if (COMPAT) _mesa_glthread_GenVertexArrays(ctx, n, arrays);
7216}
7217
7218
7219/* DisableVertexArrayAttrib: marshalled asynchronously */
7220struct marshal_cmd_DisableVertexArrayAttrib
7221{
7222   struct marshal_cmd_base cmd_base;
7223   GLuint vaobj;
7224   GLuint index;
7225};
7226uint32_t
7227_mesa_unmarshal_DisableVertexArrayAttrib(struct gl_context *ctx, const struct marshal_cmd_DisableVertexArrayAttrib *cmd, const uint64_t *last)
7228{
7229   GLuint vaobj = cmd->vaobj;
7230   GLuint index = cmd->index;
7231   CALL_DisableVertexArrayAttrib(ctx->CurrentServerDispatch, (vaobj, index));
7232   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_DisableVertexArrayAttrib), 8) / 8);
7233   assert (cmd_size == cmd->cmd_base.cmd_size);
7234   return cmd_size;
7235}
7236void GLAPIENTRY
7237_mesa_marshal_DisableVertexArrayAttrib(GLuint vaobj, GLuint index)
7238{
7239   GET_CURRENT_CONTEXT(ctx);
7240   int cmd_size = sizeof(struct marshal_cmd_DisableVertexArrayAttrib);
7241   struct marshal_cmd_DisableVertexArrayAttrib *cmd;
7242   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DisableVertexArrayAttrib, cmd_size);
7243   cmd->vaobj = vaobj;
7244   cmd->index = index;
7245   if (COMPAT) _mesa_glthread_ClientState(ctx, &vaobj, VERT_ATTRIB_GENERIC(index), false);
7246}
7247
7248
7249/* EnableVertexArrayAttrib: marshalled asynchronously */
7250struct marshal_cmd_EnableVertexArrayAttrib
7251{
7252   struct marshal_cmd_base cmd_base;
7253   GLuint vaobj;
7254   GLuint index;
7255};
7256uint32_t
7257_mesa_unmarshal_EnableVertexArrayAttrib(struct gl_context *ctx, const struct marshal_cmd_EnableVertexArrayAttrib *cmd, const uint64_t *last)
7258{
7259   GLuint vaobj = cmd->vaobj;
7260   GLuint index = cmd->index;
7261   CALL_EnableVertexArrayAttrib(ctx->CurrentServerDispatch, (vaobj, index));
7262   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_EnableVertexArrayAttrib), 8) / 8);
7263   assert (cmd_size == cmd->cmd_base.cmd_size);
7264   return cmd_size;
7265}
7266void GLAPIENTRY
7267_mesa_marshal_EnableVertexArrayAttrib(GLuint vaobj, GLuint index)
7268{
7269   GET_CURRENT_CONTEXT(ctx);
7270   int cmd_size = sizeof(struct marshal_cmd_EnableVertexArrayAttrib);
7271   struct marshal_cmd_EnableVertexArrayAttrib *cmd;
7272   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_EnableVertexArrayAttrib, cmd_size);
7273   cmd->vaobj = vaobj;
7274   cmd->index = index;
7275   if (COMPAT) _mesa_glthread_ClientState(ctx, &vaobj, VERT_ATTRIB_GENERIC(index), true);
7276}
7277
7278
7279/* VertexArrayElementBuffer: marshalled asynchronously */
7280struct marshal_cmd_VertexArrayElementBuffer
7281{
7282   struct marshal_cmd_base cmd_base;
7283   GLuint vaobj;
7284   GLuint buffer;
7285};
7286uint32_t
7287_mesa_unmarshal_VertexArrayElementBuffer(struct gl_context *ctx, const struct marshal_cmd_VertexArrayElementBuffer *cmd, const uint64_t *last)
7288{
7289   GLuint vaobj = cmd->vaobj;
7290   GLuint buffer = cmd->buffer;
7291   CALL_VertexArrayElementBuffer(ctx->CurrentServerDispatch, (vaobj, buffer));
7292   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayElementBuffer), 8) / 8);
7293   assert (cmd_size == cmd->cmd_base.cmd_size);
7294   return cmd_size;
7295}
7296void GLAPIENTRY
7297_mesa_marshal_VertexArrayElementBuffer(GLuint vaobj, GLuint buffer)
7298{
7299   GET_CURRENT_CONTEXT(ctx);
7300   int cmd_size = sizeof(struct marshal_cmd_VertexArrayElementBuffer);
7301   struct marshal_cmd_VertexArrayElementBuffer *cmd;
7302   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayElementBuffer, cmd_size);
7303   cmd->vaobj = vaobj;
7304   cmd->buffer = buffer;
7305   if (COMPAT) _mesa_glthread_DSAElementBuffer(ctx, vaobj, buffer);
7306}
7307
7308
7309/* VertexArrayVertexBuffer: marshalled asynchronously */
7310struct marshal_cmd_VertexArrayVertexBuffer
7311{
7312   struct marshal_cmd_base cmd_base;
7313   GLuint vaobj;
7314   GLuint bindingindex;
7315   GLuint buffer;
7316   GLsizei stride;
7317   GLintptr offset;
7318};
7319uint32_t
7320_mesa_unmarshal_VertexArrayVertexBuffer(struct gl_context *ctx, const struct marshal_cmd_VertexArrayVertexBuffer *cmd, const uint64_t *last)
7321{
7322   GLuint vaobj = cmd->vaobj;
7323   GLuint bindingindex = cmd->bindingindex;
7324   GLuint buffer = cmd->buffer;
7325   GLintptr offset = cmd->offset;
7326   GLsizei stride = cmd->stride;
7327   CALL_VertexArrayVertexBuffer(ctx->CurrentServerDispatch, (vaobj, bindingindex, buffer, offset, stride));
7328   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayVertexBuffer), 8) / 8);
7329   assert (cmd_size == cmd->cmd_base.cmd_size);
7330   return cmd_size;
7331}
7332void GLAPIENTRY
7333_mesa_marshal_VertexArrayVertexBuffer(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)
7334{
7335   GET_CURRENT_CONTEXT(ctx);
7336   int cmd_size = sizeof(struct marshal_cmd_VertexArrayVertexBuffer);
7337   struct marshal_cmd_VertexArrayVertexBuffer *cmd;
7338   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayVertexBuffer, cmd_size);
7339   cmd->vaobj = vaobj;
7340   cmd->bindingindex = bindingindex;
7341   cmd->buffer = buffer;
7342   cmd->offset = offset;
7343   cmd->stride = stride;
7344   if (COMPAT) _mesa_glthread_DSAVertexBuffer(ctx, vaobj, bindingindex, buffer, offset, stride);
7345}
7346
7347
7348/* VertexArrayVertexBuffers: marshalled asynchronously */
7349struct marshal_cmd_VertexArrayVertexBuffers
7350{
7351   struct marshal_cmd_base cmd_base;
7352   GLuint vaobj;
7353   GLuint first;
7354   GLsizei count;
7355   /* Next safe_mul(count, 1 * sizeof(GLuint)) bytes are GLuint buffers[count] */
7356   /* Next safe_mul(count, 1 * sizeof(GLintptr)) bytes are GLintptr offsets[count] */
7357   /* Next safe_mul(count, 1 * sizeof(GLsizei)) bytes are GLsizei strides[count] */
7358};
7359uint32_t
7360_mesa_unmarshal_VertexArrayVertexBuffers(struct gl_context *ctx, const struct marshal_cmd_VertexArrayVertexBuffers *cmd, const uint64_t *last)
7361{
7362   GLuint vaobj = cmd->vaobj;
7363   GLuint first = cmd->first;
7364   GLsizei count = cmd->count;
7365   GLuint * buffers;
7366   GLintptr * offsets;
7367   GLsizei * strides;
7368   const char *variable_data = (const char *) (cmd + 1);
7369   buffers = (GLuint *) variable_data;
7370   variable_data += count * 1 * sizeof(GLuint);
7371   offsets = (GLintptr *) variable_data;
7372   variable_data += count * 1 * sizeof(GLintptr);
7373   strides = (GLsizei *) variable_data;
7374   CALL_VertexArrayVertexBuffers(ctx->CurrentServerDispatch, (vaobj, first, count, buffers, offsets, strides));
7375   return cmd->cmd_base.cmd_size;
7376}
7377void GLAPIENTRY
7378_mesa_marshal_VertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, const GLuint * buffers, const GLintptr * offsets, const GLsizei * strides)
7379{
7380   GET_CURRENT_CONTEXT(ctx);
7381   int buffers_size = safe_mul(count, 1 * sizeof(GLuint));
7382   int offsets_size = safe_mul(count, 1 * sizeof(GLintptr));
7383   int strides_size = safe_mul(count, 1 * sizeof(GLsizei));
7384   int cmd_size = sizeof(struct marshal_cmd_VertexArrayVertexBuffers) + buffers_size + offsets_size + strides_size;
7385   struct marshal_cmd_VertexArrayVertexBuffers *cmd;
7386   if (unlikely(buffers_size < 0 || (buffers_size > 0 && !buffers) || offsets_size < 0 || (offsets_size > 0 && !offsets) || strides_size < 0 || (strides_size > 0 && !strides) || (unsigned)cmd_size > MARSHAL_MAX_CMD_SIZE)) {
7387      _mesa_glthread_finish_before(ctx, "VertexArrayVertexBuffers");
7388      CALL_VertexArrayVertexBuffers(ctx->CurrentServerDispatch, (vaobj, first, count, buffers, offsets, strides));
7389      if (COMPAT) _mesa_glthread_DSAVertexBuffers(ctx, vaobj, first, count, buffers, offsets, strides);
7390      return;
7391   }
7392   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayVertexBuffers, cmd_size);
7393   cmd->vaobj = vaobj;
7394   cmd->first = first;
7395   cmd->count = count;
7396   char *variable_data = (char *) (cmd + 1);
7397   memcpy(variable_data, buffers, buffers_size);
7398   variable_data += buffers_size;
7399   memcpy(variable_data, offsets, offsets_size);
7400   variable_data += offsets_size;
7401   memcpy(variable_data, strides, strides_size);
7402   if (COMPAT) _mesa_glthread_DSAVertexBuffers(ctx, vaobj, first, count, buffers, offsets, strides);
7403}
7404
7405
7406/* VertexArrayAttribFormat: marshalled asynchronously */
7407struct marshal_cmd_VertexArrayAttribFormat
7408{
7409   struct marshal_cmd_base cmd_base;
7410   GLboolean normalized;
7411   GLuint vaobj;
7412   GLuint attribindex;
7413   GLint size;
7414   GLenum type;
7415   GLuint relativeoffset;
7416};
7417uint32_t
7418_mesa_unmarshal_VertexArrayAttribFormat(struct gl_context *ctx, const struct marshal_cmd_VertexArrayAttribFormat *cmd, const uint64_t *last)
7419{
7420   GLuint vaobj = cmd->vaobj;
7421   GLuint attribindex = cmd->attribindex;
7422   GLint size = cmd->size;
7423   GLenum type = cmd->type;
7424   GLboolean normalized = cmd->normalized;
7425   GLuint relativeoffset = cmd->relativeoffset;
7426   CALL_VertexArrayAttribFormat(ctx->CurrentServerDispatch, (vaobj, attribindex, size, type, normalized, relativeoffset));
7427   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayAttribFormat), 8) / 8);
7428   assert (cmd_size == cmd->cmd_base.cmd_size);
7429   return cmd_size;
7430}
7431void GLAPIENTRY
7432_mesa_marshal_VertexArrayAttribFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
7433{
7434   GET_CURRENT_CONTEXT(ctx);
7435   int cmd_size = sizeof(struct marshal_cmd_VertexArrayAttribFormat);
7436   struct marshal_cmd_VertexArrayAttribFormat *cmd;
7437   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayAttribFormat, cmd_size);
7438   cmd->vaobj = vaobj;
7439   cmd->attribindex = attribindex;
7440   cmd->size = size;
7441   cmd->type = type;
7442   cmd->normalized = normalized;
7443   cmd->relativeoffset = relativeoffset;
7444   if (COMPAT) _mesa_glthread_DSAAttribFormat(ctx, vaobj, attribindex, size, type, relativeoffset);
7445}
7446
7447
7448/* VertexArrayAttribIFormat: marshalled asynchronously */
7449struct marshal_cmd_VertexArrayAttribIFormat
7450{
7451   struct marshal_cmd_base cmd_base;
7452   GLuint vaobj;
7453   GLuint attribindex;
7454   GLint size;
7455   GLenum type;
7456   GLuint relativeoffset;
7457};
7458uint32_t
7459_mesa_unmarshal_VertexArrayAttribIFormat(struct gl_context *ctx, const struct marshal_cmd_VertexArrayAttribIFormat *cmd, const uint64_t *last)
7460{
7461   GLuint vaobj = cmd->vaobj;
7462   GLuint attribindex = cmd->attribindex;
7463   GLint size = cmd->size;
7464   GLenum type = cmd->type;
7465   GLuint relativeoffset = cmd->relativeoffset;
7466   CALL_VertexArrayAttribIFormat(ctx->CurrentServerDispatch, (vaobj, attribindex, size, type, relativeoffset));
7467   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayAttribIFormat), 8) / 8);
7468   assert (cmd_size == cmd->cmd_base.cmd_size);
7469   return cmd_size;
7470}
7471void GLAPIENTRY
7472_mesa_marshal_VertexArrayAttribIFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
7473{
7474   GET_CURRENT_CONTEXT(ctx);
7475   int cmd_size = sizeof(struct marshal_cmd_VertexArrayAttribIFormat);
7476   struct marshal_cmd_VertexArrayAttribIFormat *cmd;
7477   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayAttribIFormat, cmd_size);
7478   cmd->vaobj = vaobj;
7479   cmd->attribindex = attribindex;
7480   cmd->size = size;
7481   cmd->type = type;
7482   cmd->relativeoffset = relativeoffset;
7483   if (COMPAT) _mesa_glthread_DSAAttribFormat(ctx, vaobj, attribindex, size, type, relativeoffset);
7484}
7485
7486
7487/* VertexArrayAttribLFormat: marshalled asynchronously */
7488struct marshal_cmd_VertexArrayAttribLFormat
7489{
7490   struct marshal_cmd_base cmd_base;
7491   GLuint vaobj;
7492   GLuint attribindex;
7493   GLint size;
7494   GLenum type;
7495   GLuint relativeoffset;
7496};
7497uint32_t
7498_mesa_unmarshal_VertexArrayAttribLFormat(struct gl_context *ctx, const struct marshal_cmd_VertexArrayAttribLFormat *cmd, const uint64_t *last)
7499{
7500   GLuint vaobj = cmd->vaobj;
7501   GLuint attribindex = cmd->attribindex;
7502   GLint size = cmd->size;
7503   GLenum type = cmd->type;
7504   GLuint relativeoffset = cmd->relativeoffset;
7505   CALL_VertexArrayAttribLFormat(ctx->CurrentServerDispatch, (vaobj, attribindex, size, type, relativeoffset));
7506   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayAttribLFormat), 8) / 8);
7507   assert (cmd_size == cmd->cmd_base.cmd_size);
7508   return cmd_size;
7509}
7510void GLAPIENTRY
7511_mesa_marshal_VertexArrayAttribLFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
7512{
7513   GET_CURRENT_CONTEXT(ctx);
7514   int cmd_size = sizeof(struct marshal_cmd_VertexArrayAttribLFormat);
7515   struct marshal_cmd_VertexArrayAttribLFormat *cmd;
7516   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayAttribLFormat, cmd_size);
7517   cmd->vaobj = vaobj;
7518   cmd->attribindex = attribindex;
7519   cmd->size = size;
7520   cmd->type = type;
7521   cmd->relativeoffset = relativeoffset;
7522   if (COMPAT) _mesa_glthread_DSAAttribFormat(ctx, vaobj, attribindex, size, type, relativeoffset);
7523}
7524
7525
7526/* VertexArrayAttribBinding: marshalled asynchronously */
7527struct marshal_cmd_VertexArrayAttribBinding
7528{
7529   struct marshal_cmd_base cmd_base;
7530   GLuint vaobj;
7531   GLuint attribindex;
7532   GLuint bindingindex;
7533};
7534uint32_t
7535_mesa_unmarshal_VertexArrayAttribBinding(struct gl_context *ctx, const struct marshal_cmd_VertexArrayAttribBinding *cmd, const uint64_t *last)
7536{
7537   GLuint vaobj = cmd->vaobj;
7538   GLuint attribindex = cmd->attribindex;
7539   GLuint bindingindex = cmd->bindingindex;
7540   CALL_VertexArrayAttribBinding(ctx->CurrentServerDispatch, (vaobj, attribindex, bindingindex));
7541   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayAttribBinding), 8) / 8);
7542   assert (cmd_size == cmd->cmd_base.cmd_size);
7543   return cmd_size;
7544}
7545void GLAPIENTRY
7546_mesa_marshal_VertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex)
7547{
7548   GET_CURRENT_CONTEXT(ctx);
7549   int cmd_size = sizeof(struct marshal_cmd_VertexArrayAttribBinding);
7550   struct marshal_cmd_VertexArrayAttribBinding *cmd;
7551   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayAttribBinding, cmd_size);
7552   cmd->vaobj = vaobj;
7553   cmd->attribindex = attribindex;
7554   cmd->bindingindex = bindingindex;
7555   if (COMPAT) _mesa_glthread_DSAAttribBinding(ctx, vaobj, attribindex, bindingindex);
7556}
7557
7558
7559/* VertexArrayBindingDivisor: marshalled asynchronously */
7560struct marshal_cmd_VertexArrayBindingDivisor
7561{
7562   struct marshal_cmd_base cmd_base;
7563   GLuint vaobj;
7564   GLuint bindingindex;
7565   GLuint divisor;
7566};
7567uint32_t
7568_mesa_unmarshal_VertexArrayBindingDivisor(struct gl_context *ctx, const struct marshal_cmd_VertexArrayBindingDivisor *cmd, const uint64_t *last)
7569{
7570   GLuint vaobj = cmd->vaobj;
7571   GLuint bindingindex = cmd->bindingindex;
7572   GLuint divisor = cmd->divisor;
7573   CALL_VertexArrayBindingDivisor(ctx->CurrentServerDispatch, (vaobj, bindingindex, divisor));
7574   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_VertexArrayBindingDivisor), 8) / 8);
7575   assert (cmd_size == cmd->cmd_base.cmd_size);
7576   return cmd_size;
7577}
7578void GLAPIENTRY
7579_mesa_marshal_VertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor)
7580{
7581   GET_CURRENT_CONTEXT(ctx);
7582   int cmd_size = sizeof(struct marshal_cmd_VertexArrayBindingDivisor);
7583   struct marshal_cmd_VertexArrayBindingDivisor *cmd;
7584   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_VertexArrayBindingDivisor, cmd_size);
7585   cmd->vaobj = vaobj;
7586   cmd->bindingindex = bindingindex;
7587   cmd->divisor = divisor;
7588   if (COMPAT) _mesa_glthread_DSABindingDivisor(ctx, vaobj, bindingindex, divisor);
7589}
7590
7591
7592/* GetVertexArrayiv: marshalled synchronously */
7593void GLAPIENTRY
7594_mesa_marshal_GetVertexArrayiv(GLuint vaobj, GLenum pname, GLint * param)
7595{
7596   GET_CURRENT_CONTEXT(ctx);
7597   _mesa_glthread_finish_before(ctx, "GetVertexArrayiv");
7598   CALL_GetVertexArrayiv(ctx->CurrentServerDispatch, (vaobj, pname, param));
7599}
7600
7601
7602/* GetVertexArrayIndexediv: marshalled synchronously */
7603void GLAPIENTRY
7604_mesa_marshal_GetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint * param)
7605{
7606   GET_CURRENT_CONTEXT(ctx);
7607   _mesa_glthread_finish_before(ctx, "GetVertexArrayIndexediv");
7608   CALL_GetVertexArrayIndexediv(ctx->CurrentServerDispatch, (vaobj, index, pname, param));
7609}
7610
7611
7612/* GetVertexArrayIndexed64iv: marshalled synchronously */
7613void GLAPIENTRY
7614_mesa_marshal_GetVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64 * param)
7615{
7616   GET_CURRENT_CONTEXT(ctx);
7617   _mesa_glthread_finish_before(ctx, "GetVertexArrayIndexed64iv");
7618   CALL_GetVertexArrayIndexed64iv(ctx->CurrentServerDispatch, (vaobj, index, pname, param));
7619}
7620
7621
7622/* CreateSamplers: marshalled synchronously */
7623void GLAPIENTRY
7624_mesa_marshal_CreateSamplers(GLsizei n, GLuint * samplers)
7625{
7626   GET_CURRENT_CONTEXT(ctx);
7627   _mesa_glthread_finish_before(ctx, "CreateSamplers");
7628   CALL_CreateSamplers(ctx->CurrentServerDispatch, (n, samplers));
7629}
7630
7631
7632/* CreateProgramPipelines: marshalled synchronously */
7633void GLAPIENTRY
7634_mesa_marshal_CreateProgramPipelines(GLsizei n, GLuint * pipelines)
7635{
7636   GET_CURRENT_CONTEXT(ctx);
7637   _mesa_glthread_finish_before(ctx, "CreateProgramPipelines");
7638   CALL_CreateProgramPipelines(ctx->CurrentServerDispatch, (n, pipelines));
7639}
7640
7641
7642/* CreateQueries: marshalled synchronously */
7643void GLAPIENTRY
7644_mesa_marshal_CreateQueries(GLenum target, GLsizei n, GLuint * ids)
7645{
7646   GET_CURRENT_CONTEXT(ctx);
7647   _mesa_glthread_finish_before(ctx, "CreateQueries");
7648   CALL_CreateQueries(ctx->CurrentServerDispatch, (target, n, ids));
7649}
7650
7651
7652/* GetQueryBufferObjectiv: marshalled asynchronously */
7653struct marshal_cmd_GetQueryBufferObjectiv
7654{
7655   struct marshal_cmd_base cmd_base;
7656   GLuint id;
7657   GLuint buffer;
7658   GLenum pname;
7659   GLintptr offset;
7660};
7661uint32_t
7662_mesa_unmarshal_GetQueryBufferObjectiv(struct gl_context *ctx, const struct marshal_cmd_GetQueryBufferObjectiv *cmd, const uint64_t *last)
7663{
7664   GLuint id = cmd->id;
7665   GLuint buffer = cmd->buffer;
7666   GLenum pname = cmd->pname;
7667   GLintptr offset = cmd->offset;
7668   CALL_GetQueryBufferObjectiv(ctx->CurrentServerDispatch, (id, buffer, pname, offset));
7669   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_GetQueryBufferObjectiv), 8) / 8);
7670   assert (cmd_size == cmd->cmd_base.cmd_size);
7671   return cmd_size;
7672}
7673void GLAPIENTRY
7674_mesa_marshal_GetQueryBufferObjectiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
7675{
7676   GET_CURRENT_CONTEXT(ctx);
7677   int cmd_size = sizeof(struct marshal_cmd_GetQueryBufferObjectiv);
7678   struct marshal_cmd_GetQueryBufferObjectiv *cmd;
7679   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_GetQueryBufferObjectiv, cmd_size);
7680   cmd->id = id;
7681   cmd->buffer = buffer;
7682   cmd->pname = pname;
7683   cmd->offset = offset;
7684}
7685
7686
7687/* GetQueryBufferObjectuiv: marshalled asynchronously */
7688struct marshal_cmd_GetQueryBufferObjectuiv
7689{
7690   struct marshal_cmd_base cmd_base;
7691   GLuint id;
7692   GLuint buffer;
7693   GLenum pname;
7694   GLintptr offset;
7695};
7696uint32_t
7697_mesa_unmarshal_GetQueryBufferObjectuiv(struct gl_context *ctx, const struct marshal_cmd_GetQueryBufferObjectuiv *cmd, const uint64_t *last)
7698{
7699   GLuint id = cmd->id;
7700   GLuint buffer = cmd->buffer;
7701   GLenum pname = cmd->pname;
7702   GLintptr offset = cmd->offset;
7703   CALL_GetQueryBufferObjectuiv(ctx->CurrentServerDispatch, (id, buffer, pname, offset));
7704   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_GetQueryBufferObjectuiv), 8) / 8);
7705   assert (cmd_size == cmd->cmd_base.cmd_size);
7706   return cmd_size;
7707}
7708void GLAPIENTRY
7709_mesa_marshal_GetQueryBufferObjectuiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
7710{
7711   GET_CURRENT_CONTEXT(ctx);
7712   int cmd_size = sizeof(struct marshal_cmd_GetQueryBufferObjectuiv);
7713   struct marshal_cmd_GetQueryBufferObjectuiv *cmd;
7714   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_GetQueryBufferObjectuiv, cmd_size);
7715   cmd->id = id;
7716   cmd->buffer = buffer;
7717   cmd->pname = pname;
7718   cmd->offset = offset;
7719}
7720
7721
7722/* GetQueryBufferObjecti64v: marshalled asynchronously */
7723struct marshal_cmd_GetQueryBufferObjecti64v
7724{
7725   struct marshal_cmd_base cmd_base;
7726   GLuint id;
7727   GLuint buffer;
7728   GLenum pname;
7729   GLintptr offset;
7730};
7731uint32_t
7732_mesa_unmarshal_GetQueryBufferObjecti64v(struct gl_context *ctx, const struct marshal_cmd_GetQueryBufferObjecti64v *cmd, const uint64_t *last)
7733{
7734   GLuint id = cmd->id;
7735   GLuint buffer = cmd->buffer;
7736   GLenum pname = cmd->pname;
7737   GLintptr offset = cmd->offset;
7738   CALL_GetQueryBufferObjecti64v(ctx->CurrentServerDispatch, (id, buffer, pname, offset));
7739   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_GetQueryBufferObjecti64v), 8) / 8);
7740   assert (cmd_size == cmd->cmd_base.cmd_size);
7741   return cmd_size;
7742}
7743void GLAPIENTRY
7744_mesa_marshal_GetQueryBufferObjecti64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
7745{
7746   GET_CURRENT_CONTEXT(ctx);
7747   int cmd_size = sizeof(struct marshal_cmd_GetQueryBufferObjecti64v);
7748   struct marshal_cmd_GetQueryBufferObjecti64v *cmd;
7749   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_GetQueryBufferObjecti64v, cmd_size);
7750   cmd->id = id;
7751   cmd->buffer = buffer;
7752   cmd->pname = pname;
7753   cmd->offset = offset;
7754}
7755
7756
7757/* GetQueryBufferObjectui64v: marshalled asynchronously */
7758struct marshal_cmd_GetQueryBufferObjectui64v
7759{
7760   struct marshal_cmd_base cmd_base;
7761   GLuint id;
7762   GLuint buffer;
7763   GLenum pname;
7764   GLintptr offset;
7765};
7766uint32_t
7767_mesa_unmarshal_GetQueryBufferObjectui64v(struct gl_context *ctx, const struct marshal_cmd_GetQueryBufferObjectui64v *cmd, const uint64_t *last)
7768{
7769   GLuint id = cmd->id;
7770   GLuint buffer = cmd->buffer;
7771   GLenum pname = cmd->pname;
7772   GLintptr offset = cmd->offset;
7773   CALL_GetQueryBufferObjectui64v(ctx->CurrentServerDispatch, (id, buffer, pname, offset));
7774   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_GetQueryBufferObjectui64v), 8) / 8);
7775   assert (cmd_size == cmd->cmd_base.cmd_size);
7776   return cmd_size;
7777}
7778void GLAPIENTRY
7779_mesa_marshal_GetQueryBufferObjectui64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
7780{
7781   GET_CURRENT_CONTEXT(ctx);
7782   int cmd_size = sizeof(struct marshal_cmd_GetQueryBufferObjectui64v);
7783   struct marshal_cmd_GetQueryBufferObjectui64v *cmd;
7784   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_GetQueryBufferObjectui64v, cmd_size);
7785   cmd->id = id;
7786   cmd->buffer = buffer;
7787   cmd->pname = pname;
7788   cmd->offset = offset;
7789}
7790
7791
7792/* GetTextureSubImage: marshalled asynchronously */
7793struct marshal_cmd_GetTextureSubImage
7794{
7795   struct marshal_cmd_base cmd_base;
7796   GLuint texture;
7797   GLint level;
7798   GLint xoffset;
7799   GLint yoffset;
7800   GLint zoffset;
7801   GLsizei width;
7802   GLsizei height;
7803   GLsizei depth;
7804   GLenum format;
7805   GLenum type;
7806   GLsizei bufSize;
7807   GLvoid * pixels;
7808};
7809uint32_t
7810_mesa_unmarshal_GetTextureSubImage(struct gl_context *ctx, const struct marshal_cmd_GetTextureSubImage *cmd, const uint64_t *last)
7811{
7812   GLuint texture = cmd->texture;
7813   GLint level = cmd->level;
7814   GLint xoffset = cmd->xoffset;
7815   GLint yoffset = cmd->yoffset;
7816   GLint zoffset = cmd->zoffset;
7817   GLsizei width = cmd->width;
7818   GLsizei height = cmd->height;
7819   GLsizei depth = cmd->depth;
7820   GLenum format = cmd->format;
7821   GLenum type = cmd->type;
7822   GLsizei bufSize = cmd->bufSize;
7823   GLvoid * pixels = cmd->pixels;
7824   CALL_GetTextureSubImage(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize, pixels));
7825   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_GetTextureSubImage), 8) / 8);
7826   assert (cmd_size == cmd->cmd_base.cmd_size);
7827   return cmd_size;
7828}
7829void GLAPIENTRY
7830_mesa_marshal_GetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, GLvoid * pixels)
7831{
7832   GET_CURRENT_CONTEXT(ctx);
7833   int cmd_size = sizeof(struct marshal_cmd_GetTextureSubImage);
7834   struct marshal_cmd_GetTextureSubImage *cmd;
7835   if (_mesa_glthread_has_no_pack_buffer(ctx)) {
7836      _mesa_glthread_finish_before(ctx, "GetTextureSubImage");
7837      CALL_GetTextureSubImage(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize, pixels));
7838      return;
7839   }
7840   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_GetTextureSubImage, cmd_size);
7841   cmd->texture = texture;
7842   cmd->level = level;
7843   cmd->xoffset = xoffset;
7844   cmd->yoffset = yoffset;
7845   cmd->zoffset = zoffset;
7846   cmd->width = width;
7847   cmd->height = height;
7848   cmd->depth = depth;
7849   cmd->format = format;
7850   cmd->type = type;
7851   cmd->bufSize = bufSize;
7852   cmd->pixels = pixels;
7853}
7854
7855
7856/* GetCompressedTextureSubImage: marshalled asynchronously */
7857struct marshal_cmd_GetCompressedTextureSubImage
7858{
7859   struct marshal_cmd_base cmd_base;
7860   GLuint texture;
7861   GLint level;
7862   GLint xoffset;
7863   GLint yoffset;
7864   GLint zoffset;
7865   GLsizei width;
7866   GLsizei height;
7867   GLsizei depth;
7868   GLsizei bufSize;
7869   GLvoid * pixels;
7870};
7871uint32_t
7872_mesa_unmarshal_GetCompressedTextureSubImage(struct gl_context *ctx, const struct marshal_cmd_GetCompressedTextureSubImage *cmd, const uint64_t *last)
7873{
7874   GLuint texture = cmd->texture;
7875   GLint level = cmd->level;
7876   GLint xoffset = cmd->xoffset;
7877   GLint yoffset = cmd->yoffset;
7878   GLint zoffset = cmd->zoffset;
7879   GLsizei width = cmd->width;
7880   GLsizei height = cmd->height;
7881   GLsizei depth = cmd->depth;
7882   GLsizei bufSize = cmd->bufSize;
7883   GLvoid * pixels = cmd->pixels;
7884   CALL_GetCompressedTextureSubImage(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels));
7885   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_GetCompressedTextureSubImage), 8) / 8);
7886   assert (cmd_size == cmd->cmd_base.cmd_size);
7887   return cmd_size;
7888}
7889void GLAPIENTRY
7890_mesa_marshal_GetCompressedTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, GLvoid * pixels)
7891{
7892   GET_CURRENT_CONTEXT(ctx);
7893   int cmd_size = sizeof(struct marshal_cmd_GetCompressedTextureSubImage);
7894   struct marshal_cmd_GetCompressedTextureSubImage *cmd;
7895   if (_mesa_glthread_has_no_pack_buffer(ctx)) {
7896      _mesa_glthread_finish_before(ctx, "GetCompressedTextureSubImage");
7897      CALL_GetCompressedTextureSubImage(ctx->CurrentServerDispatch, (texture, level, xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels));
7898      return;
7899   }
7900   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_GetCompressedTextureSubImage, cmd_size);
7901   cmd->texture = texture;
7902   cmd->level = level;
7903   cmd->xoffset = xoffset;
7904   cmd->yoffset = yoffset;
7905   cmd->zoffset = zoffset;
7906   cmd->width = width;
7907   cmd->height = height;
7908   cmd->depth = depth;
7909   cmd->bufSize = bufSize;
7910   cmd->pixels = pixels;
7911}
7912
7913
7914/* TextureBarrierNV: marshalled asynchronously */
7915struct marshal_cmd_TextureBarrierNV
7916{
7917   struct marshal_cmd_base cmd_base;
7918};
7919uint32_t
7920_mesa_unmarshal_TextureBarrierNV(struct gl_context *ctx, const struct marshal_cmd_TextureBarrierNV *cmd, const uint64_t *last)
7921{
7922   CALL_TextureBarrierNV(ctx->CurrentServerDispatch, ());
7923   const unsigned cmd_size = (align(sizeof(struct marshal_cmd_TextureBarrierNV), 8) / 8);
7924   assert (cmd_size == cmd->cmd_base.cmd_size);
7925   return cmd_size;
7926}
7927void GLAPIENTRY
7928_mesa_marshal_TextureBarrierNV(void)
7929{
7930   GET_CURRENT_CONTEXT(ctx);
7931   int cmd_size = sizeof(struct marshal_cmd_TextureBarrierNV);
7932   struct marshal_cmd_TextureBarrierNV *cmd;
7933   cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_TextureBarrierNV, cmd_size);
7934   (void) cmd;
7935}
7936
7937
7938