VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c@ 80163

Last change on this file since 80163 was 78190, checked in by vboxsync, 6 years ago

Merge first stage of the Chromium cleanup from the branch:

  • r129818 (Remove VBOX_WITH_CR_DISPLAY_LISTS and accompanying code as it was disabled since r108676 and was never brought back (see ​bugref:3456 and ​bugref:8485))
  • r129819 (HostServices/SharedOpenGL: Remove unused main entry point from upstream server process based implementation)
  • r129820 (HostServices/SharedOpenGL: Started eliminating all backends other than HGCM. They are not used and probably wouldn't work anymore anyway)
  • r129821 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill crTimer* API as it is not used anywhere)
  • r129822 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill most from cr_process.h apart from two used methods)
  • r129823 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill crList* API as it is unused)
  • r129824 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill crHullInteriorBox API as it is unused)
  • r129825 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill crWarpPoint API as it is unused)
  • r129826 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill CrSa* API as it is unused and not even compiled in)
  • r129827 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill cr_bbox.h as it is unused)
  • r129828 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove a few crParseUrl() two uses)
  • r129829 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove last crParseURL() use)
  • r129830 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove crParseURL())
  • r129831 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove VBOX_WITH_COCOA_QT and related code when not set as it is the default for years now and we don't support anything else anymore)
  • r129832 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_logo.h)
  • r129833 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused crut_api.h and crut_clientapi.h)
  • r129834 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_dmx.h)
  • r129835 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_perf.h)
  • r129836 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove cr_rand.h and friends as it is not actively used anywhere)
  • r129837 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of all the swapped versions in the packer SPU, we never change endianess from guest to host and don't need it)
  • r129838 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129839 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129840 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused pack_pica.c)
  • r129841 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129842 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of cr_endianess.h and friends)
  • r129843 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused lowercase.py)
  • r129844 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused cr_calllists.h and friends)
  • r129845 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of completely unused idpool.c, not even compiled in)
  • r129846 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused cr_debugopcodes.h and friends)
  • r129847 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Make the cr_mem.h API inline and get rid of the implementation in the util library)
  • r129848 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of SPUOptions and related code as it is of no use for us)
  • r129849 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of cr_environment.h and friends and convert usage to RTEnv* APIs)
  • r129850 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused renderspu_agl.c)
  • r129851 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused code in cr_htable.h)
  • r129853 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Introduce a state paremeter for the unpacker workers instead of reyling on global variables, work in progress)
  • r129854 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Let the caller of crUnpack set up the initial state. This allows to get rid of the global return_ptr and writeback_ptr as they get supplied in the unpacker state by the server)
  • r129855 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of the cr_lastDispatch and cr_unpackDispatch as they are of no use now)
  • r129856 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of the global cr_unpackData and cr_unpackDataEnd symbols by indtroducing another hack to make it possible for certail server dispatch callbacks to access the data buffer)
  • r129857 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: build fix for release builds)
  • r129858 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Make the pointer to the unpacker state non const (is required for the access verification))
  • r129859 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: First iteration of the buffer size validation to prevent out of bound read access + added todos for places where additional checks are needed)
  • r129860 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129861 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129871 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129872 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Stop as soon as the unpacker encountered an error)
  • r129876 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129880 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129882 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Fixed some offsets in unpack_texture.c, 3DMark03 renders correctly again)
  • r130013 (HostServices/SharedOpenGL: Convert files to C++ so we can use C99 featuers on Windows with cl.exe)
  • r130014 (HostServices/SharedOpenGL,GuestHost/OpenGL: WIndows build fixes)
  • r130015 (HostServices/SharedOpenGL,GuestHost/OpenGL: More Windows build fixes)
  • r130036 (Config.kmk: Fix linker error on Windows by temporarily disabling the use of VBoxGuestR3DllMinW2K)
  • r130094 (src/VBox/GuestHost/OpenGL: Revert inlining the allocation/free functions in R3 completely as it doesn't work on Windows if memory is allocated and freed across different DLLs which don't share a common CRT, causes crashes in RtlValidtaeHeap())
  • r130095 (src/VBox/GuestHost/OpenGL,src/VBox/Additions/common/crOpenGL/pack: Don't use floating point specifiers in packspu_GetString() to avoid R6002 errors (couldn't fully understand why they occur suddenly after the rework but this gets rid of it))
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 23.1 KB
Line 
1/* $Id: pack_shaders.c 78190 2019-04-18 00:07:07Z vboxsync $ */
2
3/** @file
4 * VBox OpenGL DRI driver functions
5 */
6
7/*
8 * Copyright (C) 2009-2019 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#include "packer.h"
20#include "cr_error.h"
21#include "cr_string.h"
22
23void PACK_APIENTRY crPackBindAttribLocation(GLuint program, GLuint index, const char *name)
24{
25 CR_GET_PACKER_CONTEXT(pc);
26 unsigned char *data_ptr;
27 int cbName = crStrlen(name)+1;
28 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(program)+sizeof(index) + cbName*sizeof(*name);
29
30 CR_GET_BUFFERED_POINTER(pc, packet_length);
31 WRITE_DATA_AI(int, packet_length);
32 WRITE_DATA_AI(GLenum, CR_BINDATTRIBLOCATION_EXTEND_OPCODE);
33 WRITE_DATA_AI(GLuint, program);
34 WRITE_DATA_AI(GLuint, index);
35 crMemcpy(data_ptr, name, cbName*sizeof(*name));
36 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
37 CR_UNLOCK_PACKER_CONTEXT(pc);
38}
39
40void PACK_APIENTRY crPackShaderSource(GLuint shader, GLsizei count, const char **string, const GLint *length)
41{
42 CR_GET_PACKER_CONTEXT(pc);
43 unsigned char *data_ptr;
44 GLint *pLocalLength;
45 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(shader)+sizeof(count)+sizeof(GLint)+count*sizeof(*pLocalLength);
46 GLsizei i;
47
48 if ((0==count) || (!string)) return;
49
50 pLocalLength = crAlloc(count*sizeof(*length));
51 if (!pLocalLength) return;
52
53 for (i=0; i<count; ++i)
54 {
55 pLocalLength[i] = ((length && (length[i]>=0)) ? length[i] : crStrlen(string[i]))+1;
56 packet_length += pLocalLength[i];
57 }
58
59 if (length)
60 {
61 packet_length += count*sizeof(*length);
62 }
63
64 CR_GET_BUFFERED_POINTER(pc, packet_length);
65 WRITE_DATA_AI(int, packet_length);
66 WRITE_DATA_AI(GLenum, CR_SHADERSOURCE_EXTEND_OPCODE);
67 WRITE_DATA_AI(GLuint, shader);
68 WRITE_DATA_AI(GLsizei, count);
69 WRITE_DATA_AI(GLint, (GLint)(length ? 1:0));
70 crMemcpy(data_ptr, pLocalLength, count*sizeof(*pLocalLength));
71 data_ptr += count*sizeof(*pLocalLength);
72
73 if (length)
74 {
75 crMemcpy(data_ptr, length, count*sizeof(*length));
76 data_ptr += count*sizeof(*length);
77 }
78
79 for (i=0; i<count; ++i)
80 {
81 if (string[i])
82 {
83 if (length && (length[i]>=0))
84 {
85 /* include \0 in the string to make intel drivers happy */
86 crMemcpy(data_ptr, string[i], pLocalLength[i] - 1);
87 data_ptr[pLocalLength[i] - 1] = '\0';
88 }
89 else
90 {
91 /* the \0 s already in the string */
92 crMemcpy(data_ptr, string[i], pLocalLength[i]);
93 }
94 }
95 else
96 {
97 CRASSERT(pLocalLength[i]==1);
98 *data_ptr = 0;
99 }
100 data_ptr += pLocalLength[i];
101 }
102 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
103 CR_UNLOCK_PACKER_CONTEXT(pc);
104
105 crFree(pLocalLength);
106}
107
108void PACK_APIENTRY crPackUniform1fv(GLint location, GLsizei count, const GLfloat *value)
109{
110 CR_GET_PACKER_CONTEXT(pc);
111 unsigned char *data_ptr;
112 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + count*sizeof(*value);
113
114 CR_GET_BUFFERED_POINTER(pc, packet_length);
115 WRITE_DATA_AI(int, packet_length);
116 WRITE_DATA_AI(GLenum, CR_UNIFORM1FV_EXTEND_OPCODE);
117 WRITE_DATA_AI(GLint, location);
118 WRITE_DATA_AI(GLsizei, count);
119 crMemcpy(data_ptr, value, count*sizeof(*value));
120 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
121 CR_UNLOCK_PACKER_CONTEXT(pc);
122}
123
124void PACK_APIENTRY crPackUniform1iv(GLint location, GLsizei count, const GLint *value)
125{
126 CR_GET_PACKER_CONTEXT(pc);
127 unsigned char *data_ptr;
128 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + count*sizeof(*value);
129
130 CR_GET_BUFFERED_POINTER(pc, packet_length);
131 WRITE_DATA_AI(int, packet_length);
132 WRITE_DATA_AI(GLenum, CR_UNIFORM1IV_EXTEND_OPCODE);
133 WRITE_DATA_AI(GLint, location);
134 WRITE_DATA_AI(GLsizei, count);
135 crMemcpy(data_ptr, value, count*sizeof(*value));
136 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
137 CR_UNLOCK_PACKER_CONTEXT(pc);
138}
139
140void PACK_APIENTRY crPackUniform2fv(GLint location, GLsizei count, const GLfloat *value)
141{
142 CR_GET_PACKER_CONTEXT(pc);
143 unsigned char *data_ptr;
144 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 2*count*sizeof(*value);
145
146 CR_GET_BUFFERED_POINTER(pc, packet_length);
147 WRITE_DATA_AI(int, packet_length);
148 WRITE_DATA_AI(GLenum, CR_UNIFORM2FV_EXTEND_OPCODE);
149 WRITE_DATA_AI(GLint, location);
150 WRITE_DATA_AI(GLsizei, count);
151 crMemcpy(data_ptr, value, 2*count*sizeof(*value));
152 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
153 CR_UNLOCK_PACKER_CONTEXT(pc);
154}
155
156void PACK_APIENTRY crPackUniform2iv(GLint location, GLsizei count, const GLint *value)
157{
158 CR_GET_PACKER_CONTEXT(pc);
159 unsigned char *data_ptr;
160 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 2*count*sizeof(*value);
161
162 CR_GET_BUFFERED_POINTER(pc, packet_length);
163 WRITE_DATA_AI(int, packet_length);
164 WRITE_DATA_AI(GLenum, CR_UNIFORM2IV_EXTEND_OPCODE);
165 WRITE_DATA_AI(GLint, location);
166 WRITE_DATA_AI(GLsizei, count);
167 crMemcpy(data_ptr, value, 2*count*sizeof(*value));
168 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
169 CR_UNLOCK_PACKER_CONTEXT(pc);
170}
171
172void PACK_APIENTRY crPackUniform3fv(GLint location, GLsizei count, const GLfloat *value)
173{
174 CR_GET_PACKER_CONTEXT(pc);
175 unsigned char *data_ptr;
176 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 3*count*sizeof(*value);
177
178 CR_GET_BUFFERED_POINTER(pc, packet_length);
179 WRITE_DATA_AI(int, packet_length);
180 WRITE_DATA_AI(GLenum, CR_UNIFORM3FV_EXTEND_OPCODE);
181 WRITE_DATA_AI(GLint, location);
182 WRITE_DATA_AI(GLsizei, count);
183 crMemcpy(data_ptr, value, 3*count*sizeof(*value));
184 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
185 CR_UNLOCK_PACKER_CONTEXT(pc);
186}
187
188void PACK_APIENTRY crPackUniform3iv(GLint location, GLsizei count, const GLint *value)
189{
190 CR_GET_PACKER_CONTEXT(pc);
191 unsigned char *data_ptr;
192 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 3*count*sizeof(*value);
193
194 CR_GET_BUFFERED_POINTER(pc, packet_length);
195 WRITE_DATA_AI(int, packet_length);
196 WRITE_DATA_AI(GLenum, CR_UNIFORM3IV_EXTEND_OPCODE);
197 WRITE_DATA_AI(GLint, location);
198 WRITE_DATA_AI(GLsizei, count);
199 crMemcpy(data_ptr, value, 3*count*sizeof(*value));
200 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
201 CR_UNLOCK_PACKER_CONTEXT(pc);
202}
203
204void PACK_APIENTRY crPackUniform4fv(GLint location, GLsizei count, const GLfloat *value)
205{
206 CR_GET_PACKER_CONTEXT(pc);
207 unsigned char *data_ptr;
208 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 4*count*sizeof(*value);
209
210 CR_GET_BUFFERED_POINTER(pc, packet_length);
211 WRITE_DATA_AI(int, packet_length);
212 WRITE_DATA_AI(GLenum, CR_UNIFORM4FV_EXTEND_OPCODE);
213 WRITE_DATA_AI(GLint, location);
214 WRITE_DATA_AI(GLsizei, count);
215 crMemcpy(data_ptr, value, 4*count*sizeof(*value));
216 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
217 CR_UNLOCK_PACKER_CONTEXT(pc);
218}
219
220void PACK_APIENTRY crPackUniform4iv(GLint location, GLsizei count, const GLint *value)
221{
222 CR_GET_PACKER_CONTEXT(pc);
223 unsigned char *data_ptr;
224 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 4*count*sizeof(*value);
225
226 CR_GET_BUFFERED_POINTER(pc, packet_length);
227 WRITE_DATA_AI(int, packet_length);
228 WRITE_DATA_AI(GLenum, CR_UNIFORM4IV_EXTEND_OPCODE);
229 WRITE_DATA_AI(GLint, location);
230 WRITE_DATA_AI(GLsizei, count);
231 crMemcpy(data_ptr, value, 4*count*sizeof(*value));
232 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
233 CR_UNLOCK_PACKER_CONTEXT(pc);
234}
235
236void PACK_APIENTRY crPackUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
237{
238 CR_GET_PACKER_CONTEXT(pc);
239 unsigned char *data_ptr;
240 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose) + 2*2*count*sizeof(*value);
241
242 CR_GET_BUFFERED_POINTER(pc, packet_length);
243 WRITE_DATA_AI(int, packet_length);
244 WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX2FV_EXTEND_OPCODE);
245 WRITE_DATA_AI(GLint, location);
246 WRITE_DATA_AI(GLsizei, count);
247 WRITE_DATA_AI(GLboolean, transpose);
248 crMemcpy(data_ptr, value, 2*2*count*sizeof(*value));
249 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
250 CR_UNLOCK_PACKER_CONTEXT(pc);
251}
252
253void PACK_APIENTRY crPackUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
254{
255 CR_GET_PACKER_CONTEXT(pc);
256 unsigned char *data_ptr;
257 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose) + 3*3*count*sizeof(*value);
258
259 CR_GET_BUFFERED_POINTER(pc, packet_length);
260 WRITE_DATA_AI(int, packet_length);
261 WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX3FV_EXTEND_OPCODE);
262 WRITE_DATA_AI(GLint, location);
263 WRITE_DATA_AI(GLsizei, count);
264 WRITE_DATA_AI(GLboolean, transpose);
265 crMemcpy(data_ptr, value, 3*3*count*sizeof(*value));
266 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
267 CR_UNLOCK_PACKER_CONTEXT(pc);
268}
269
270void PACK_APIENTRY crPackUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
271{
272 CR_GET_PACKER_CONTEXT(pc);
273 unsigned char *data_ptr;
274 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose) + 4*4*count*sizeof(*value);
275
276 CR_GET_BUFFERED_POINTER(pc, packet_length);
277 WRITE_DATA_AI(int, packet_length);
278 WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX4FV_EXTEND_OPCODE);
279 WRITE_DATA_AI(GLint, location);
280 WRITE_DATA_AI(GLsizei, count);
281 WRITE_DATA_AI(GLboolean, transpose);
282 crMemcpy(data_ptr, value, 4*4*count*sizeof(*value));
283 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
284 CR_UNLOCK_PACKER_CONTEXT(pc);
285}
286
287void PACK_APIENTRY crPackUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
288{
289 CR_GET_PACKER_CONTEXT(pc);
290 unsigned char *data_ptr;
291 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
292 + 2*3*count*sizeof(*value);
293
294 CR_GET_BUFFERED_POINTER(pc, packet_length);
295 WRITE_DATA_AI(int, packet_length);
296 WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX2X3FV_EXTEND_OPCODE);
297 WRITE_DATA_AI(GLint, location);
298 WRITE_DATA_AI(GLsizei, count);
299 WRITE_DATA_AI(GLboolean, transpose);
300 crMemcpy(data_ptr, value, 2*3*count*sizeof(*value));
301 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
302 CR_UNLOCK_PACKER_CONTEXT(pc);
303}
304
305void PACK_APIENTRY crPackUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
306{
307 CR_GET_PACKER_CONTEXT(pc);
308 unsigned char *data_ptr;
309 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
310 + 3*2*count*sizeof(*value);
311
312 CR_GET_BUFFERED_POINTER(pc, packet_length);
313 WRITE_DATA_AI(int, packet_length);
314 WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX3X2FV_EXTEND_OPCODE);
315 WRITE_DATA_AI(GLint, location);
316 WRITE_DATA_AI(GLsizei, count);
317 WRITE_DATA_AI(GLboolean, transpose);
318 crMemcpy(data_ptr, value, 3*2*count*sizeof(*value));
319 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
320 CR_UNLOCK_PACKER_CONTEXT(pc);
321}
322
323void PACK_APIENTRY crPackUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
324{
325 CR_GET_PACKER_CONTEXT(pc);
326 unsigned char *data_ptr;
327 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
328 + 2*4*count*sizeof(*value);
329
330 CR_GET_BUFFERED_POINTER(pc, packet_length);
331 WRITE_DATA_AI(int, packet_length);
332 WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX2X4FV_EXTEND_OPCODE);
333 WRITE_DATA_AI(GLint, location);
334 WRITE_DATA_AI(GLsizei, count);
335 WRITE_DATA_AI(GLboolean, transpose);
336 crMemcpy(data_ptr, value, 2*4*count*sizeof(*value));
337 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
338 CR_UNLOCK_PACKER_CONTEXT(pc);
339}
340
341void PACK_APIENTRY crPackUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
342{
343 CR_GET_PACKER_CONTEXT(pc);
344 unsigned char *data_ptr;
345 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
346 + 4*2*count*sizeof(*value);
347
348 CR_GET_BUFFERED_POINTER(pc, packet_length);
349 WRITE_DATA_AI(int, packet_length);
350 WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX4X2FV_EXTEND_OPCODE);
351 WRITE_DATA_AI(GLint, location);
352 WRITE_DATA_AI(GLsizei, count);
353 WRITE_DATA_AI(GLboolean, transpose);
354 crMemcpy(data_ptr, value, 4*2*count*sizeof(*value));
355 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
356 CR_UNLOCK_PACKER_CONTEXT(pc);
357}
358
359void PACK_APIENTRY crPackUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
360{
361 CR_GET_PACKER_CONTEXT(pc);
362 unsigned char *data_ptr;
363 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
364 + 3*4*count*sizeof(*value);
365
366 CR_GET_BUFFERED_POINTER(pc, packet_length);
367 WRITE_DATA_AI(int, packet_length);
368 WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX3X4FV_EXTEND_OPCODE);
369 WRITE_DATA_AI(GLint, location);
370 WRITE_DATA_AI(GLsizei, count);
371 WRITE_DATA_AI(GLboolean, transpose);
372 crMemcpy(data_ptr, value, 3*4*count*sizeof(*value));
373 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
374 CR_UNLOCK_PACKER_CONTEXT(pc);
375}
376
377void PACK_APIENTRY crPackUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
378{
379 CR_GET_PACKER_CONTEXT(pc);
380 unsigned char *data_ptr;
381 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
382 + 4*3*count*sizeof(*value);
383
384 CR_GET_BUFFERED_POINTER(pc, packet_length);
385 WRITE_DATA_AI(int, packet_length);
386 WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX4X3FV_EXTEND_OPCODE);
387 WRITE_DATA_AI(GLint, location);
388 WRITE_DATA_AI(GLsizei, count);
389 WRITE_DATA_AI(GLboolean, transpose);
390 crMemcpy(data_ptr, value, 4*3*count*sizeof(*value));
391 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
392 CR_UNLOCK_PACKER_CONTEXT(pc);
393}
394
395void PACK_APIENTRY crPackDrawBuffers(GLsizei n, const GLenum *bufs)
396{
397 CR_GET_PACKER_CONTEXT(pc);
398 unsigned char *data_ptr;
399 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(n) + n*sizeof(*bufs);
400
401 CR_GET_BUFFERED_POINTER(pc, packet_length);
402 WRITE_DATA_AI(int, packet_length);
403 WRITE_DATA_AI(GLenum, CR_DRAWBUFFERS_EXTEND_OPCODE);
404 WRITE_DATA_AI(GLsizei, n);
405 crMemcpy(data_ptr, bufs, n*sizeof(*bufs));
406 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
407 CR_UNLOCK_PACKER_CONTEXT(pc);
408}
409
410/** @todo next 8 functions are bit hacky,
411 * we expect packspu to pass a single structure with all output parameters via first output pointer.
412 * it'd be better to add CRMessageMultiReadback one day.
413 */
414void PACK_APIENTRY crPackGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, char * name, int * writeback)
415{
416 CR_GET_PACKER_CONTEXT(pc);
417 unsigned char *data_ptr;
418 (void) pc;
419 (void) size;
420 (void) type;
421 (void) name;
422 CR_GET_BUFFERED_POINTER(pc, 36);
423 WRITE_DATA(0, GLint, 36);
424 WRITE_DATA(4, GLenum, CR_GETACTIVEATTRIB_EXTEND_OPCODE);
425 WRITE_DATA(8, GLuint, program);
426 WRITE_DATA(12, GLuint, index);
427 WRITE_DATA(16, GLsizei, bufSize);
428 WRITE_NETWORK_POINTER(20, (void *) length);
429 WRITE_NETWORK_POINTER(28, (void *) writeback);
430 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
431 CR_CMDBLOCK_CHECK_FLUSH(pc);
432 CR_UNLOCK_PACKER_CONTEXT(pc);
433}
434
435void PACK_APIENTRY crPackGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, char * name, int * writeback)
436{
437 CR_GET_PACKER_CONTEXT(pc);
438 unsigned char *data_ptr;
439 (void) pc;
440 (void) size;
441 (void) type;
442 (void) name;
443 CR_GET_BUFFERED_POINTER(pc, 36);
444 WRITE_DATA(0, GLint, 36);
445 WRITE_DATA(4, GLenum, CR_GETACTIVEUNIFORM_EXTEND_OPCODE);
446 WRITE_DATA(8, GLuint, program);
447 WRITE_DATA(12, GLuint, index);
448 WRITE_DATA(16, GLsizei, bufSize);
449 WRITE_NETWORK_POINTER(20, (void *) length);
450 WRITE_NETWORK_POINTER(28, (void *) writeback);
451 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
452 CR_CMDBLOCK_CHECK_FLUSH(pc);
453 CR_UNLOCK_PACKER_CONTEXT(pc);
454}
455
456void PACK_APIENTRY crPackGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders, int * writeback)
457{
458 CR_GET_PACKER_CONTEXT(pc);
459 unsigned char *data_ptr;
460 (void) pc;
461 (void) shaders;
462 CR_GET_BUFFERED_POINTER(pc, 32);
463 WRITE_DATA(0, GLint, 32);
464 WRITE_DATA(4, GLenum, CR_GETATTACHEDSHADERS_EXTEND_OPCODE);
465 WRITE_DATA(8, GLuint, program);
466 WRITE_DATA(12, GLsizei, maxCount);
467 WRITE_NETWORK_POINTER(16, (void *) count);
468 WRITE_NETWORK_POINTER(24, (void *) writeback);
469 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
470 CR_CMDBLOCK_CHECK_FLUSH(pc);
471 CR_UNLOCK_PACKER_CONTEXT(pc);
472}
473
474void PACK_APIENTRY crPackGetAttachedObjectsARB(VBoxGLhandleARB containerObj, GLsizei maxCount, GLsizei * count, VBoxGLhandleARB * obj, int * writeback)
475{
476 CR_GET_PACKER_CONTEXT(pc);
477 unsigned char *data_ptr;
478 (void) pc; (void) obj;
479 CR_GET_BUFFERED_POINTER(pc, 32);
480 WRITE_DATA(0, GLint, 32);
481 WRITE_DATA(4, GLenum, CR_GETATTACHEDOBJECTSARB_EXTEND_OPCODE);
482 WRITE_DATA(8, VBoxGLhandleARB, containerObj);
483 WRITE_DATA(12, GLsizei, maxCount);
484 WRITE_NETWORK_POINTER(16, (void *) count);
485 WRITE_NETWORK_POINTER(24, (void *) writeback);
486 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
487 CR_CMDBLOCK_CHECK_FLUSH(pc);
488 CR_UNLOCK_PACKER_CONTEXT(pc);
489}
490
491void PACK_APIENTRY crPackGetInfoLogARB(VBoxGLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog, int * writeback)
492{
493 CR_GET_PACKER_CONTEXT(pc);
494 unsigned char *data_ptr;
495 (void) pc; (void) infoLog;
496 CR_GET_BUFFERED_POINTER(pc, 32);
497 WRITE_DATA(0, GLint, 32);
498 WRITE_DATA(4, GLenum, CR_GETINFOLOGARB_EXTEND_OPCODE);
499 WRITE_DATA(8, VBoxGLhandleARB, obj);
500 WRITE_DATA(12, GLsizei, maxLength);
501 WRITE_NETWORK_POINTER(16, (void *) length);
502 WRITE_NETWORK_POINTER(24, (void *) writeback);
503 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
504 CR_CMDBLOCK_CHECK_FLUSH(pc);
505 CR_UNLOCK_PACKER_CONTEXT(pc);
506}
507
508void PACK_APIENTRY crPackGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei * length, char * infoLog, int * writeback)
509{
510 CR_GET_PACKER_CONTEXT(pc);
511 unsigned char *data_ptr;
512 (void) pc;
513 (void) infoLog;
514 CR_GET_BUFFERED_POINTER(pc, 32);
515 WRITE_DATA(0, GLint, 32);
516 WRITE_DATA(4, GLenum, CR_GETPROGRAMINFOLOG_EXTEND_OPCODE);
517 WRITE_DATA(8, GLuint, program);
518 WRITE_DATA(12, GLsizei, bufSize);
519 WRITE_NETWORK_POINTER(16, (void *) length);
520 WRITE_NETWORK_POINTER(24, (void *) writeback);
521 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
522 CR_CMDBLOCK_CHECK_FLUSH(pc);
523 CR_UNLOCK_PACKER_CONTEXT(pc);
524}
525
526void PACK_APIENTRY crPackGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei * length, char * infoLog, int * writeback)
527{
528 CR_GET_PACKER_CONTEXT(pc);
529 unsigned char *data_ptr;
530 (void) pc;
531 (void) infoLog;
532 CR_GET_BUFFERED_POINTER(pc, 32);
533 WRITE_DATA(0, GLint, 32);
534 WRITE_DATA(4, GLenum, CR_GETSHADERINFOLOG_EXTEND_OPCODE);
535 WRITE_DATA(8, GLuint, shader);
536 WRITE_DATA(12, GLsizei, bufSize);
537 WRITE_NETWORK_POINTER(16, (void *) length);
538 WRITE_NETWORK_POINTER(24, (void *) writeback);
539 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
540 CR_CMDBLOCK_CHECK_FLUSH(pc);
541 CR_UNLOCK_PACKER_CONTEXT(pc);
542}
543
544void PACK_APIENTRY crPackGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei * length, char * source, int * writeback)
545{
546 CR_GET_PACKER_CONTEXT(pc);
547 unsigned char *data_ptr;
548 (void) pc;
549 (void) source;
550 CR_GET_BUFFERED_POINTER(pc, 32);
551 WRITE_DATA(0, GLint, 32);
552 WRITE_DATA(4, GLenum, CR_GETSHADERSOURCE_EXTEND_OPCODE);
553 WRITE_DATA(8, GLuint, shader);
554 WRITE_DATA(12, GLsizei, bufSize);
555 WRITE_NETWORK_POINTER(16, (void *) length);
556 WRITE_NETWORK_POINTER(24, (void *) writeback);
557 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
558 CR_CMDBLOCK_CHECK_FLUSH(pc);
559 CR_UNLOCK_PACKER_CONTEXT(pc);
560}
561
562void PACK_APIENTRY crPackGetUniformsLocations(GLuint program, GLsizei maxcbData, GLsizei * cbData, GLvoid * pData, int * writeback)
563{
564 CR_GET_PACKER_CONTEXT(pc);
565 unsigned char *data_ptr;
566 (void) pData;
567 CR_GET_BUFFERED_POINTER(pc, 32);
568 WRITE_DATA(0, GLint, 32);
569 WRITE_DATA(4, GLenum, CR_GETUNIFORMSLOCATIONS_EXTEND_OPCODE);
570 WRITE_DATA(8, GLuint, program);
571 WRITE_DATA(12, GLsizei, maxcbData);
572 WRITE_NETWORK_POINTER(16, (void *) cbData);
573 WRITE_NETWORK_POINTER(24, (void *) writeback);
574 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
575 CR_CMDBLOCK_CHECK_FLUSH(pc);
576 CR_UNLOCK_PACKER_CONTEXT(pc);
577}
578
579void PACK_APIENTRY crPackGetAttribsLocations(GLuint program, GLsizei maxcbData, GLsizei * cbData, GLvoid * pData, int * writeback)
580{
581 CR_GET_PACKER_CONTEXT(pc);
582 unsigned char *data_ptr;
583 (void) pData;
584 CR_GET_BUFFERED_POINTER(pc, 32);
585 WRITE_DATA(0, GLint, 32);
586 WRITE_DATA(4, GLenum, CR_GETATTRIBSLOCATIONS_EXTEND_OPCODE);
587 WRITE_DATA(8, GLuint, program);
588 WRITE_DATA(12, GLsizei, maxcbData);
589 WRITE_NETWORK_POINTER(16, (void *) cbData);
590 WRITE_NETWORK_POINTER(24, (void *) writeback);
591 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
592 CR_CMDBLOCK_CHECK_FLUSH(pc);
593 CR_UNLOCK_PACKER_CONTEXT(pc);
594}
595
596void PACK_APIENTRY crPackGetAttribLocation(GLuint program, const char * name, GLint * return_value, int * writeback)
597{
598 CR_GET_PACKER_CONTEXT(pc);
599 unsigned char *data_ptr;
600 int cbName = crStrlen(name)+1;
601 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(program)+cbName*sizeof(*name)+16;
602
603 CR_GET_BUFFERED_POINTER(pc, packet_length);
604 WRITE_DATA_AI(int, packet_length);
605 WRITE_DATA_AI(GLenum, CR_GETATTRIBLOCATION_EXTEND_OPCODE);
606 WRITE_DATA_AI(GLuint, program);
607 crMemcpy(data_ptr, name, cbName*sizeof(*name));
608 data_ptr += cbName*sizeof(*name);
609 WRITE_NETWORK_POINTER(0, (void *) return_value);
610 WRITE_NETWORK_POINTER(8, (void *) writeback);
611 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
612 CR_CMDBLOCK_CHECK_FLUSH(pc);
613 CR_UNLOCK_PACKER_CONTEXT(pc);
614}
615
616void PACK_APIENTRY crPackGetUniformLocation(GLuint program, const char * name, GLint * return_value, int * writeback)
617{
618 CR_GET_PACKER_CONTEXT(pc);
619 unsigned char *data_ptr;
620 int cbName = crStrlen(name)+1;
621 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(program)+cbName*sizeof(*name)+16;
622
623 CR_GET_BUFFERED_POINTER(pc, packet_length);
624 WRITE_DATA_AI(int, packet_length);
625 WRITE_DATA_AI(GLenum, CR_GETUNIFORMLOCATION_EXTEND_OPCODE);
626 WRITE_DATA_AI(GLuint, program);
627 crMemcpy(data_ptr, name, cbName*sizeof(*name));
628 data_ptr += cbName*sizeof(*name);
629 WRITE_NETWORK_POINTER(0, (void *) return_value);
630 WRITE_NETWORK_POINTER(8, (void *) writeback);
631 WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
632 CR_CMDBLOCK_CHECK_FLUSH(pc);
633 CR_UNLOCK_PACKER_CONTEXT(pc);
634}
635
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette