1 | /* $Id: unpack_shaders.cpp 78265 2019-04-23 18:56:56Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox OpenGL DRI driver functions
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #include "unpacker.h"
|
---|
19 | #include "cr_error.h"
|
---|
20 | #include "cr_protocol.h"
|
---|
21 | #include "cr_mem.h"
|
---|
22 | #include "cr_string.h"
|
---|
23 | #include "cr_version.h"
|
---|
24 |
|
---|
25 | void crUnpackExtendBindAttribLocation(PCrUnpackerState pState)
|
---|
26 | {
|
---|
27 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLuint);
|
---|
28 |
|
---|
29 | GLuint program = READ_DATA(pState, 8, GLuint);
|
---|
30 | GLuint index = READ_DATA(pState, 12, GLuint);
|
---|
31 | const char *name = DATA_POINTER(pState, 16, const char);
|
---|
32 |
|
---|
33 | CHECK_STRING_FROM_PTR_UPDATE_NO_SZ(pState, name);
|
---|
34 | pState->pDispatchTbl->BindAttribLocation(program, index, name);
|
---|
35 | }
|
---|
36 |
|
---|
37 | void crUnpackExtendShaderSource(PCrUnpackerState pState)
|
---|
38 | {
|
---|
39 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLsizei);
|
---|
40 |
|
---|
41 | GLint *length = NULL;
|
---|
42 | GLuint shader = READ_DATA(pState, 8, GLuint);
|
---|
43 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
44 | GLint hasNonLocalLen = READ_DATA(pState, 16, GLsizei);
|
---|
45 | GLint *pLocalLength = DATA_POINTER(pState, 20, GLint);
|
---|
46 | char **ppStrings = NULL;
|
---|
47 | GLsizei i, j, jUpTo;
|
---|
48 | int pos, pos_check;
|
---|
49 |
|
---|
50 | if (count <= 0 || count >= INT32_MAX / sizeof(GLint) / 8)
|
---|
51 | {
|
---|
52 | crError("crUnpackExtendShaderSource: count %u is out of range", count);
|
---|
53 | return;
|
---|
54 | }
|
---|
55 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, pLocalLength, count, GLint);
|
---|
56 |
|
---|
57 | /** @todo More verification required here. */
|
---|
58 | pos = 20 + count * sizeof(*pLocalLength);
|
---|
59 |
|
---|
60 | if (!DATA_POINTER_CHECK(pState, pos))
|
---|
61 | {
|
---|
62 | crError("crUnpackExtendShaderSource: pos %d is out of range", pos);
|
---|
63 | return;
|
---|
64 | }
|
---|
65 |
|
---|
66 | if (hasNonLocalLen > 0)
|
---|
67 | {
|
---|
68 | length = DATA_POINTER(pState, pos, GLint);
|
---|
69 | pos += count * sizeof(*length);
|
---|
70 | }
|
---|
71 |
|
---|
72 | pos_check = pos;
|
---|
73 |
|
---|
74 | if (!DATA_POINTER_CHECK(pState, pos_check))
|
---|
75 | {
|
---|
76 | crError("crUnpackExtendShaderSource: pos %d is out of range", pos);
|
---|
77 | return;
|
---|
78 | }
|
---|
79 |
|
---|
80 | pos_check = pos;
|
---|
81 |
|
---|
82 | for (i = 0; i < count; ++i)
|
---|
83 | {
|
---|
84 | if (pLocalLength[i] <= 0 || pos_check >= INT32_MAX - pLocalLength[i] || !DATA_POINTER_CHECK(pState, pos_check))
|
---|
85 | {
|
---|
86 | crError("crUnpackExtendShaderSource: pos %d is out of range", pos_check);
|
---|
87 | return;
|
---|
88 | }
|
---|
89 |
|
---|
90 | pos_check += pLocalLength[i];
|
---|
91 |
|
---|
92 | if (!DATA_POINTER_CHECK(pState, pos_check))
|
---|
93 | {
|
---|
94 | crError("crUnpackExtendShaderSource: pos %d is out of range", pos_check);
|
---|
95 | return;
|
---|
96 | }
|
---|
97 | }
|
---|
98 |
|
---|
99 | ppStrings = (char **)crAlloc(count * sizeof(char*));
|
---|
100 | if (!ppStrings) return;
|
---|
101 |
|
---|
102 | for (i = 0; i < count; ++i)
|
---|
103 | {
|
---|
104 | CHECK_BUFFER_SIZE_STATIC_UPDATE(pState, pos); /** @todo Free ppStrings on error. */
|
---|
105 | ppStrings[i] = DATA_POINTER(pState, pos, char);
|
---|
106 | pos += pLocalLength[i];
|
---|
107 | if (!length)
|
---|
108 | {
|
---|
109 | pLocalLength[i] -= 1;
|
---|
110 | }
|
---|
111 |
|
---|
112 | Assert(pLocalLength[i] > 0);
|
---|
113 | jUpTo = i == count -1 ? pLocalLength[i] - 1 : pLocalLength[i];
|
---|
114 | for (j = 0; j < jUpTo; ++j)
|
---|
115 | {
|
---|
116 | char *pString = ppStrings[i];
|
---|
117 |
|
---|
118 | if (pString[j] == '\0')
|
---|
119 | {
|
---|
120 | Assert(j == jUpTo - 1);
|
---|
121 | pString[j] = '\n';
|
---|
122 | }
|
---|
123 | }
|
---|
124 | }
|
---|
125 |
|
---|
126 | // pState->pDispatchTbl->ShaderSource(shader, count, ppStrings, length ? length : pLocalLength);
|
---|
127 | pState->pDispatchTbl->ShaderSource(shader, 1, (const char**)ppStrings, 0);
|
---|
128 |
|
---|
129 | crFree(ppStrings);
|
---|
130 | }
|
---|
131 |
|
---|
132 | void crUnpackExtendUniform1fv(PCrUnpackerState pState)
|
---|
133 | {
|
---|
134 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
|
---|
135 |
|
---|
136 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
137 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
138 | const GLfloat *value = DATA_POINTER(pState, 16, const GLfloat);
|
---|
139 |
|
---|
140 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count, GLfloat);
|
---|
141 | pState->pDispatchTbl->Uniform1fv(location, count, value);
|
---|
142 | }
|
---|
143 |
|
---|
144 | void crUnpackExtendUniform1iv(PCrUnpackerState pState)
|
---|
145 | {
|
---|
146 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
|
---|
147 |
|
---|
148 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
149 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
150 | const GLint *value = DATA_POINTER(pState, 16, const GLint);
|
---|
151 |
|
---|
152 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count, GLint);
|
---|
153 | pState->pDispatchTbl->Uniform1iv(location, count, value);
|
---|
154 | }
|
---|
155 |
|
---|
156 | void crUnpackExtendUniform2fv(PCrUnpackerState pState)
|
---|
157 | {
|
---|
158 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
|
---|
159 |
|
---|
160 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
161 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
162 | const GLfloat *value = DATA_POINTER(pState, 16, const GLfloat);
|
---|
163 |
|
---|
164 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2, GLfloat);
|
---|
165 | pState->pDispatchTbl->Uniform2fv(location, count, value);
|
---|
166 | }
|
---|
167 |
|
---|
168 | void crUnpackExtendUniform2iv(PCrUnpackerState pState)
|
---|
169 | {
|
---|
170 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
|
---|
171 |
|
---|
172 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
173 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
174 | const GLint *value = DATA_POINTER(pState, 16, const GLint);
|
---|
175 |
|
---|
176 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2, GLint);
|
---|
177 | pState->pDispatchTbl->Uniform2iv(location, count, value);
|
---|
178 | }
|
---|
179 |
|
---|
180 | void crUnpackExtendUniform3fv(PCrUnpackerState pState)
|
---|
181 | {
|
---|
182 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
|
---|
183 |
|
---|
184 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
185 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
186 | const GLfloat *value = DATA_POINTER(pState, 16, const GLfloat);
|
---|
187 |
|
---|
188 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3, GLfloat);
|
---|
189 | pState->pDispatchTbl->Uniform3fv(location, count, value);
|
---|
190 | }
|
---|
191 |
|
---|
192 | void crUnpackExtendUniform3iv(PCrUnpackerState pState)
|
---|
193 | {
|
---|
194 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
|
---|
195 |
|
---|
196 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
197 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
198 | const GLint *value = DATA_POINTER(pState, 16, const GLint);
|
---|
199 |
|
---|
200 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3, GLint);
|
---|
201 | pState->pDispatchTbl->Uniform3iv(location, count, value);
|
---|
202 | }
|
---|
203 |
|
---|
204 | void crUnpackExtendUniform4fv(PCrUnpackerState pState)
|
---|
205 | {
|
---|
206 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
|
---|
207 |
|
---|
208 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
209 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
210 | const GLfloat *value = DATA_POINTER(pState, 16, const GLfloat);
|
---|
211 |
|
---|
212 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4, GLfloat);
|
---|
213 | pState->pDispatchTbl->Uniform4fv(location, count, value);
|
---|
214 | }
|
---|
215 |
|
---|
216 | void crUnpackExtendUniform4iv(PCrUnpackerState pState)
|
---|
217 | {
|
---|
218 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
|
---|
219 |
|
---|
220 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
221 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
222 | const GLint *value = DATA_POINTER(pState, 16, const GLint);
|
---|
223 |
|
---|
224 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4, GLint);
|
---|
225 | pState->pDispatchTbl->Uniform4iv(location, count, value);
|
---|
226 | }
|
---|
227 |
|
---|
228 | void crUnpackExtendUniformMatrix2fv(PCrUnpackerState pState)
|
---|
229 | {
|
---|
230 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
|
---|
231 |
|
---|
232 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
233 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
234 | GLboolean transpose = READ_DATA(pState, 16, GLboolean);
|
---|
235 | const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
|
---|
236 |
|
---|
237 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2 * 2, GLfloat);
|
---|
238 | pState->pDispatchTbl->UniformMatrix2fv(location, count, transpose, value);
|
---|
239 | }
|
---|
240 |
|
---|
241 | void crUnpackExtendUniformMatrix3fv(PCrUnpackerState pState)
|
---|
242 | {
|
---|
243 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
|
---|
244 |
|
---|
245 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
246 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
247 | GLboolean transpose = READ_DATA(pState, 16, GLboolean);
|
---|
248 | const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
|
---|
249 |
|
---|
250 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3 * 3, GLfloat);
|
---|
251 | pState->pDispatchTbl->UniformMatrix3fv(location, count, transpose, value);
|
---|
252 | }
|
---|
253 |
|
---|
254 | void crUnpackExtendUniformMatrix4fv(PCrUnpackerState pState)
|
---|
255 | {
|
---|
256 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
|
---|
257 |
|
---|
258 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
259 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
260 | GLboolean transpose = READ_DATA(pState, 16, GLboolean);
|
---|
261 | const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
|
---|
262 |
|
---|
263 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4 * 4, GLfloat);
|
---|
264 | pState->pDispatchTbl->UniformMatrix4fv(location, count, transpose, value);
|
---|
265 | }
|
---|
266 |
|
---|
267 | void crUnpackExtendUniformMatrix2x3fv(PCrUnpackerState pState)
|
---|
268 | {
|
---|
269 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
|
---|
270 |
|
---|
271 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
272 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
273 | GLboolean transpose = READ_DATA(pState, 16, GLboolean);
|
---|
274 | const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
|
---|
275 |
|
---|
276 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2 * 3, GLfloat);
|
---|
277 | pState->pDispatchTbl->UniformMatrix2x3fv(location, count, transpose, value);
|
---|
278 | }
|
---|
279 |
|
---|
280 | void crUnpackExtendUniformMatrix3x2fv(PCrUnpackerState pState)
|
---|
281 | {
|
---|
282 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
|
---|
283 |
|
---|
284 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
285 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
286 | GLboolean transpose = READ_DATA(pState, 16, GLboolean);
|
---|
287 | const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
|
---|
288 |
|
---|
289 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3 * 2, GLfloat);
|
---|
290 | pState->pDispatchTbl->UniformMatrix3x2fv(location, count, transpose, value);
|
---|
291 | }
|
---|
292 |
|
---|
293 | void crUnpackExtendUniformMatrix2x4fv(PCrUnpackerState pState)
|
---|
294 | {
|
---|
295 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
|
---|
296 |
|
---|
297 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
298 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
299 | GLboolean transpose = READ_DATA(pState, 16, GLboolean);
|
---|
300 | const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
|
---|
301 |
|
---|
302 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2 * 4, GLfloat);
|
---|
303 | pState->pDispatchTbl->UniformMatrix2x4fv(location, count, transpose, value);
|
---|
304 | }
|
---|
305 |
|
---|
306 | void crUnpackExtendUniformMatrix4x2fv(PCrUnpackerState pState)
|
---|
307 | {
|
---|
308 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
|
---|
309 |
|
---|
310 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
311 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
312 | GLboolean transpose = READ_DATA(pState, 16, GLboolean);
|
---|
313 | const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
|
---|
314 |
|
---|
315 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4 * 2, GLfloat);
|
---|
316 | pState->pDispatchTbl->UniformMatrix4x2fv(location, count, transpose, value);
|
---|
317 | }
|
---|
318 |
|
---|
319 | void crUnpackExtendUniformMatrix3x4fv(PCrUnpackerState pState)
|
---|
320 | {
|
---|
321 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
|
---|
322 |
|
---|
323 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
324 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
325 | GLboolean transpose = READ_DATA(pState, 16, GLboolean);
|
---|
326 | const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
|
---|
327 |
|
---|
328 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3 * 4, GLfloat);
|
---|
329 | pState->pDispatchTbl->UniformMatrix3x4fv(location, count, transpose, value);
|
---|
330 | }
|
---|
331 |
|
---|
332 | void crUnpackExtendUniformMatrix4x3fv(PCrUnpackerState pState)
|
---|
333 | {
|
---|
334 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
|
---|
335 |
|
---|
336 | GLint location = READ_DATA(pState, 8, GLint);
|
---|
337 | GLsizei count = READ_DATA(pState, 12, GLsizei);
|
---|
338 | GLboolean transpose = READ_DATA(pState, 16, GLboolean);
|
---|
339 | const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
|
---|
340 |
|
---|
341 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4 * 3, GLfloat);
|
---|
342 | pState->pDispatchTbl->UniformMatrix4x3fv(location, count, transpose, value);
|
---|
343 | }
|
---|
344 |
|
---|
345 | void crUnpackExtendDrawBuffers(PCrUnpackerState pState)
|
---|
346 | {
|
---|
347 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 8, GLsizei);
|
---|
348 |
|
---|
349 | GLsizei n = READ_DATA(pState, 8, GLsizei);
|
---|
350 | const GLenum *bufs = DATA_POINTER(pState, 8+sizeof(GLsizei), const GLenum);
|
---|
351 |
|
---|
352 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, bufs, n, GLenum);
|
---|
353 | pState->pDispatchTbl->DrawBuffers(n, bufs);
|
---|
354 | }
|
---|
355 |
|
---|
356 | void crUnpackExtendGetActiveAttrib(PCrUnpackerState pState)
|
---|
357 | {
|
---|
358 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 28, CRNetworkPointer);
|
---|
359 |
|
---|
360 | GLuint program = READ_DATA(pState, 8, GLuint);
|
---|
361 | GLuint index = READ_DATA(pState, 12, GLuint);
|
---|
362 | GLsizei bufSize = READ_DATA(pState, 16, GLsizei);
|
---|
363 | SET_RETURN_PTR(pState, 20);
|
---|
364 | SET_WRITEBACK_PTR(pState, 28);
|
---|
365 | pState->pDispatchTbl->GetActiveAttrib(program, index, bufSize, NULL, NULL, NULL, NULL);
|
---|
366 | }
|
---|
367 |
|
---|
368 | void crUnpackExtendGetActiveUniform(PCrUnpackerState pState)
|
---|
369 | {
|
---|
370 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 28, CRNetworkPointer);
|
---|
371 |
|
---|
372 | GLuint program = READ_DATA(pState, 8, GLuint);
|
---|
373 | GLuint index = READ_DATA(pState, 12, GLuint);
|
---|
374 | GLsizei bufSize = READ_DATA(pState, 16, GLsizei);
|
---|
375 | SET_RETURN_PTR(pState, 20);
|
---|
376 | SET_WRITEBACK_PTR(pState, 28);
|
---|
377 | pState->pDispatchTbl->GetActiveUniform(program, index, bufSize, NULL, NULL, NULL, NULL);
|
---|
378 | }
|
---|
379 |
|
---|
380 | void crUnpackExtendGetAttachedShaders(PCrUnpackerState pState)
|
---|
381 | {
|
---|
382 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
|
---|
383 |
|
---|
384 | GLuint program = READ_DATA(pState, 8, GLuint);
|
---|
385 | GLsizei maxCount = READ_DATA(pState, 12, GLsizei);
|
---|
386 | SET_RETURN_PTR(pState, 16);
|
---|
387 | SET_WRITEBACK_PTR(pState, 24);
|
---|
388 | pState->pDispatchTbl->GetAttachedShaders(program, maxCount, NULL, NULL);
|
---|
389 | }
|
---|
390 |
|
---|
391 | void crUnpackExtendGetAttachedObjectsARB(PCrUnpackerState pState)
|
---|
392 | {
|
---|
393 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
|
---|
394 |
|
---|
395 | VBoxGLhandleARB containerObj = READ_DATA(pState, 8, VBoxGLhandleARB);
|
---|
396 | GLsizei maxCount = READ_DATA(pState, 12, GLsizei);
|
---|
397 | SET_RETURN_PTR(pState, 16);
|
---|
398 | SET_WRITEBACK_PTR(pState, 24);
|
---|
399 | pState->pDispatchTbl->GetAttachedObjectsARB(containerObj, maxCount, NULL, NULL);
|
---|
400 | }
|
---|
401 |
|
---|
402 | void crUnpackExtendGetInfoLogARB(PCrUnpackerState pState)
|
---|
403 | {
|
---|
404 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
|
---|
405 |
|
---|
406 | VBoxGLhandleARB obj = READ_DATA(pState, 8, VBoxGLhandleARB);
|
---|
407 | GLsizei maxLength = READ_DATA(pState, 12, GLsizei);
|
---|
408 | SET_RETURN_PTR(pState, 16);
|
---|
409 | SET_WRITEBACK_PTR(pState, 24);
|
---|
410 | pState->pDispatchTbl->GetInfoLogARB(obj, maxLength, NULL, NULL);
|
---|
411 | }
|
---|
412 |
|
---|
413 | void crUnpackExtendGetProgramInfoLog(PCrUnpackerState pState)
|
---|
414 | {
|
---|
415 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
|
---|
416 |
|
---|
417 | GLuint program = READ_DATA(pState, 8, GLuint);
|
---|
418 | GLsizei bufSize = READ_DATA(pState, 12, GLsizei);
|
---|
419 | SET_RETURN_PTR(pState, 16);
|
---|
420 | SET_WRITEBACK_PTR(pState, 24);
|
---|
421 | pState->pDispatchTbl->GetProgramInfoLog(program, bufSize, NULL, NULL);
|
---|
422 | }
|
---|
423 |
|
---|
424 | void crUnpackExtendGetShaderInfoLog(PCrUnpackerState pState)
|
---|
425 | {
|
---|
426 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
|
---|
427 |
|
---|
428 | GLuint shader = READ_DATA(pState, 8, GLuint);
|
---|
429 | GLsizei bufSize = READ_DATA(pState, 12, GLsizei);
|
---|
430 | SET_RETURN_PTR(pState, 16);
|
---|
431 | SET_WRITEBACK_PTR(pState, 24);
|
---|
432 | pState->pDispatchTbl->GetShaderInfoLog(shader, bufSize, NULL, NULL);
|
---|
433 | }
|
---|
434 |
|
---|
435 | void crUnpackExtendGetShaderSource(PCrUnpackerState pState)
|
---|
436 | {
|
---|
437 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
|
---|
438 |
|
---|
439 | GLuint shader = READ_DATA(pState, 8, GLuint);
|
---|
440 | GLsizei bufSize = READ_DATA(pState, 12, GLsizei);
|
---|
441 | SET_RETURN_PTR(pState, 16);
|
---|
442 | SET_WRITEBACK_PTR(pState, 24);
|
---|
443 | pState->pDispatchTbl->GetShaderSource(shader, bufSize, NULL, NULL);
|
---|
444 | }
|
---|
445 |
|
---|
446 | void crUnpackExtendGetAttribLocation(PCrUnpackerState pState)
|
---|
447 | {
|
---|
448 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 8, GLuint);
|
---|
449 |
|
---|
450 | unsigned packet_length = (unsigned)READ_DATA(pState, 0, int);
|
---|
451 | GLuint program = READ_DATA(pState, 8, GLuint);
|
---|
452 | const char *name = DATA_POINTER(pState, 12, const char);
|
---|
453 |
|
---|
454 | size_t cchStr = CHECK_STRING_FROM_PTR_UPDATE_NO_RETURN(pState, name);
|
---|
455 | if (RT_UNLIKELY(cchStr == ~(size_t)0U || packet_length != cchStr + 2 * sizeof(CRNetworkPointer)))
|
---|
456 | {
|
---|
457 | crError("crUnpackExtendGetAttribLocation: packet_length is corrupt");
|
---|
458 | return;
|
---|
459 | }
|
---|
460 |
|
---|
461 | CHECK_BUFFER_SIZE_STATIC_UPDATE(pState, packet_length);
|
---|
462 | SET_RETURN_PTR(pState, packet_length-16);
|
---|
463 | SET_WRITEBACK_PTR(pState, packet_length-8);
|
---|
464 | pState->pDispatchTbl->GetAttribLocation(program, name);
|
---|
465 | }
|
---|
466 |
|
---|
467 | void crUnpackExtendGetUniformLocation(PCrUnpackerState pState)
|
---|
468 | {
|
---|
469 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 8, GLuint);
|
---|
470 |
|
---|
471 | unsigned packet_length = (unsigned)READ_DATA(pState, 0, int);
|
---|
472 | GLuint program = READ_DATA(pState, 8, GLuint);
|
---|
473 | const char *name = DATA_POINTER(pState, 12, const char);
|
---|
474 |
|
---|
475 | size_t cchStr = CHECK_STRING_FROM_PTR_UPDATE_NO_RETURN(pState, name);
|
---|
476 | if (RT_UNLIKELY(cchStr == ~(size_t)0U || packet_length != cchStr + 2 * sizeof(CRNetworkPointer)))
|
---|
477 | {
|
---|
478 | crError("crUnpackExtendGetUniformLocation: packet_length is corrupt");
|
---|
479 | return;
|
---|
480 | }
|
---|
481 |
|
---|
482 | CHECK_BUFFER_SIZE_STATIC_UPDATE(pState, packet_length);
|
---|
483 | SET_RETURN_PTR(pState, packet_length-16);
|
---|
484 | SET_WRITEBACK_PTR(pState, packet_length-8);
|
---|
485 | pState->pDispatchTbl->GetUniformLocation(program, name);
|
---|
486 | }
|
---|
487 |
|
---|
488 | void crUnpackExtendGetUniformsLocations(PCrUnpackerState pState)
|
---|
489 | {
|
---|
490 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
|
---|
491 |
|
---|
492 | GLuint program = READ_DATA(pState, 8, GLuint);
|
---|
493 | GLsizei maxcbData = READ_DATA(pState, 12, GLsizei);
|
---|
494 | SET_RETURN_PTR(pState, 16);
|
---|
495 | SET_WRITEBACK_PTR(pState, 24);
|
---|
496 | pState->pDispatchTbl->GetUniformsLocations(program, maxcbData, NULL, NULL);
|
---|
497 | }
|
---|
498 |
|
---|
499 | void crUnpackExtendGetAttribsLocations(PCrUnpackerState pState)
|
---|
500 | {
|
---|
501 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
|
---|
502 |
|
---|
503 | GLuint program = READ_DATA(pState, 8, GLuint);
|
---|
504 | GLsizei maxcbData = READ_DATA(pState, 12, GLsizei);
|
---|
505 | SET_RETURN_PTR(pState, 16);
|
---|
506 | SET_WRITEBACK_PTR(pState, 24);
|
---|
507 | pState->pDispatchTbl->GetAttribsLocations(program, maxcbData, NULL, NULL);
|
---|
508 | }
|
---|