summaryrefslogtreecommitdiff
path: root/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_program.c
blob: 32978a358ac262f9f29a41ab9ad4161472ae94d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
/* Copyright (c) 2001, Stanford University
 * All rights reserved
 *
 * See the file LICENSE.txt for information on redistributing this software.
 */

#include "unpacker.h"
#include "cr_error.h"
#include "cr_protocol.h"
#include "cr_mem.h"
#include "cr_version.h"


void crUnpackExtendProgramParameter4dvNV(void)
{
	GLenum target = READ_DATA( 8, GLenum );
	GLuint index = READ_DATA( 12, GLuint );
	GLdouble params[4];
	params[0] = READ_DOUBLE( 16 );
	params[1] = READ_DOUBLE( 24 );
	params[2] = READ_DOUBLE( 32 );
	params[3] = READ_DOUBLE( 40 );
	cr_unpackDispatch.ProgramParameter4dvNV( target, index, params );
}


void crUnpackExtendProgramParameter4fvNV(void)
{
	GLenum target = READ_DATA( 8, GLenum );
	GLuint index = READ_DATA( 12, GLuint );
	GLfloat params[4];
	params[0] = READ_DATA( 16, GLfloat );
	params[1] = READ_DATA( 20, GLfloat );
	params[2] = READ_DATA( 24, GLfloat );
	params[3] = READ_DATA( 28, GLfloat );
	cr_unpackDispatch.ProgramParameter4fvNV( target, index, params );
}


void crUnpackExtendProgramParameters4dvNV(void)
{
	GLenum target = READ_DATA( 8, GLenum );
	GLuint index = READ_DATA( 12, GLuint );
	GLuint num = READ_DATA( 16, GLuint);
	GLdouble *params = (GLdouble *) crAlloc(num * 4 * sizeof(GLdouble));
	if (params) {
		GLuint i;
		for (i = 0; i < 4 * num; i++) {
			params[i] = READ_DATA( 20 + i * 8, GLdouble );
		}
		cr_unpackDispatch.ProgramParameters4dvNV( target, index, num, params );
		crFree(params);
	}
}


void crUnpackExtendProgramParameters4fvNV(void)
{
	GLenum target = READ_DATA( 8, GLenum );
	GLuint index = READ_DATA( 12, GLuint );
	GLuint num = READ_DATA( 16, GLuint);
	GLfloat *params = (GLfloat *) crAlloc(num * 4 * sizeof(GLfloat));
	if (params) {
		GLuint i;
		for (i = 0; i < 4 * num; i++) {
			params[i] = READ_DATA( 20 + i * 4, GLfloat );
		}
		cr_unpackDispatch.ProgramParameters4fvNV( target, index, num, params );
		crFree(params);
	}
}


void crUnpackExtendAreProgramsResidentNV(void)
{
	GLsizei n = READ_DATA( 8, GLsizei );
	const GLuint *programs = DATA_POINTER( 12, const GLuint );
	SET_RETURN_PTR(12 + n * sizeof(GLuint));
	SET_WRITEBACK_PTR(20 + n * sizeof(GLuint));
	(void) cr_unpackDispatch.AreProgramsResidentNV( n, programs, NULL );
}


void crUnpackExtendLoadProgramNV(void)
{
	GLenum target = READ_DATA( 8, GLenum );
	GLuint id = READ_DATA( 12, GLuint );
	GLsizei len = READ_DATA( 16, GLsizei );
	GLvoid *program = DATA_POINTER( 20, GLvoid );
	cr_unpackDispatch.LoadProgramNV( target, id, len, program );
}


void crUnpackExtendExecuteProgramNV(void)
{
	GLenum target = READ_DATA( 8, GLenum );
	GLuint id = READ_DATA( 12, GLuint );
	GLfloat params[4];
	params[0] = READ_DATA( 16, GLfloat );
	params[1] = READ_DATA( 20, GLfloat );
	params[2] = READ_DATA( 24, GLfloat );
	params[3] = READ_DATA( 28, GLfloat );
	cr_unpackDispatch.ExecuteProgramNV( target, id, params );
}

void crUnpackExtendRequestResidentProgramsNV(void)
{
	GLsizei n = READ_DATA( 8, GLsizei );
	crError( "RequestResidentProgramsNV needs to be special cased!" );
	cr_unpackDispatch.RequestResidentProgramsNV( n, NULL );
}


void crUnpackExtendProgramLocalParameter4fvARB(void)
{
	GLenum target = READ_DATA( 8, GLenum );
	GLuint index = READ_DATA( 12, GLuint );
	GLfloat params[4];
	params[0] = READ_DATA( 16, GLfloat );
	params[1] = READ_DATA( 20, GLfloat );
	params[2] = READ_DATA( 24, GLfloat );
	params[3] = READ_DATA( 28, GLfloat );
	cr_unpackDispatch.ProgramLocalParameter4fvARB( target, index, params );
}


void crUnpackExtendProgramLocalParameter4dvARB(void)
{
	GLenum target = READ_DATA( 8, GLenum );
	GLuint index = READ_DATA( 12, GLuint );
	GLdouble params[4];
	params[0] = READ_DOUBLE( 16 );
	params[1] = READ_DOUBLE( 24 );
	params[2] = READ_DOUBLE( 32 );
	params[3] = READ_DOUBLE( 40 );
	cr_unpackDispatch.ProgramLocalParameter4dvARB( target, index, params );
}



void crUnpackExtendProgramNamedParameter4dvNV(void)
{
	GLuint id = READ_DATA( 8, GLuint );
	GLsizei len = READ_DATA( 12, GLsizei );
	GLdouble params[4];
	GLubyte *name = crAlloc( len );
	params[0] = READ_DOUBLE( 16 );
	params[1] = READ_DOUBLE( 24 );
	params[2] = READ_DOUBLE( 32 );
	params[3] = READ_DOUBLE( 40 );
	crMemcpy( name, DATA_POINTER( 48, GLubyte ), len );
	cr_unpackDispatch.ProgramNamedParameter4dvNV( id, len, name, params );
}

void crUnpackExtendProgramNamedParameter4dNV(void)
{
	GLuint id = READ_DATA( 8, GLuint );
	GLsizei len = READ_DATA( 12, GLsizei );
	GLdouble params[4];
	GLubyte *name = crAlloc ( len );
	params[0] = READ_DOUBLE( 16 );
	params[1] = READ_DOUBLE( 24 );
	params[2] = READ_DOUBLE( 32 );
	params[3] = READ_DOUBLE( 40 );
	crMemcpy( name, DATA_POINTER( 48, GLubyte ), len );
	cr_unpackDispatch.ProgramNamedParameter4dNV( id, len, name, params[0], params[1], params[2], params[3] );
}

void crUnpackExtendProgramNamedParameter4fNV(void)
{
	GLenum id = READ_DATA( 8, GLuint );
	GLsizei len = READ_DATA( 12, GLsizei );
	GLfloat params[4];
	GLubyte *name = crAlloc( len);
	params[0] = READ_DATA( 16, GLfloat );
	params[1] = READ_DATA( 20, GLfloat );
	params[2] = READ_DATA( 24, GLfloat );
	params[3] = READ_DATA( 28, GLfloat );
	crMemcpy( name, DATA_POINTER( 32,  GLubyte ), len );
	cr_unpackDispatch.ProgramNamedParameter4fNV( id, len, name, params[0], params[1], params[2], params[3] );
}

void crUnpackExtendProgramNamedParameter4fvNV(void)
{
	GLenum id = READ_DATA( 8, GLuint );
	GLsizei len = READ_DATA( 12, GLsizei );
	GLfloat params[4];
	GLubyte *name = crAlloc( len);
	params[0] = READ_DATA( 16, GLfloat );
	params[1] = READ_DATA( 20, GLfloat );
	params[2] = READ_DATA( 24, GLfloat );
	params[3] = READ_DATA( 28, GLfloat );
	crMemcpy( name, DATA_POINTER( 32, GLubyte ), len );
	cr_unpackDispatch.ProgramNamedParameter4fvNV( id, len, name, params );
}

void crUnpackExtendGetProgramNamedParameterdvNV(void)
{
	GLuint id = READ_DATA( 8, GLuint );
	GLsizei len = READ_DATA( 12, GLsizei );
	const GLubyte *name = DATA_POINTER( 16, GLubyte );
	SET_RETURN_PTR( 16+len );
	SET_WRITEBACK_PTR( 16+len+8 );
	cr_unpackDispatch.GetProgramNamedParameterdvNV( id, len, name, NULL );
}

void crUnpackExtendGetProgramNamedParameterfvNV(void)
{
	GLuint id = READ_DATA( 8, GLuint );
	GLsizei len = READ_DATA( 12, GLsizei );
	const GLubyte *name = DATA_POINTER( 16, GLubyte );
	SET_RETURN_PTR( 16+len );
	SET_WRITEBACK_PTR( 16+len+8 );
	cr_unpackDispatch.GetProgramNamedParameterfvNV( id, len, name, NULL );
}

void crUnpackExtendProgramStringARB(void)
{ 
      GLenum target = READ_DATA( 8, GLenum );
      GLenum format = READ_DATA( 12, GLuint );
      GLsizei len = READ_DATA( 16, GLsizei );
      GLvoid *program = DATA_POINTER( 20, GLvoid );
      cr_unpackDispatch.ProgramStringARB( target, format, len, program );
}

void crUnpackExtendGetProgramStringARB(void)
{
}

void crUnpackExtendProgramEnvParameter4dvARB(void)
{
	GLenum target = READ_DATA( 8, GLenum );
	GLuint index = READ_DATA( 12, GLuint );
	GLdouble params[4];
	params[0] = READ_DOUBLE( 16 );
	params[1] = READ_DOUBLE( 24 );
	params[2] = READ_DOUBLE( 32 );
	params[3] = READ_DOUBLE( 40 );
	cr_unpackDispatch.ProgramEnvParameter4dvARB( target, index, params );
}

void crUnpackExtendProgramEnvParameter4fvARB(void)
{
	GLenum target = READ_DATA( 8, GLenum );
	GLuint index = READ_DATA( 12, GLuint );
	GLfloat params[4];
	params[0] = READ_DATA( 16, GLfloat );
	params[1] = READ_DATA( 20, GLfloat );
	params[2] = READ_DATA( 24, GLfloat );
	params[3] = READ_DATA( 28, GLfloat );
	cr_unpackDispatch.ProgramEnvParameter4fvARB( target, index, params );
}

void crUnpackExtendDeleteProgramsARB(void)
{
	GLsizei n = READ_DATA( 8, GLsizei );
	const GLuint *programs = DATA_POINTER( 12, GLuint );
	cr_unpackDispatch.DeleteProgramsARB( n, programs );
}

void crUnpackVertexAttrib4NbvARB(void)
{
	GLuint index = READ_DATA( 0, GLuint );
	const GLbyte *v = DATA_POINTER(4, const GLbyte);
	cr_unpackDispatch.VertexAttrib4NbvARB( index, v );
	INCR_DATA_PTR( 8 );
}

void crUnpackVertexAttrib4NivARB(void)
{
	GLuint index = READ_DATA( 0, GLuint );
	const GLint *v = DATA_POINTER(4, const GLint);
	cr_unpackDispatch.VertexAttrib4NivARB( index, v );
	INCR_DATA_PTR( 20 );
}

void crUnpackVertexAttrib4NsvARB(void)
{
	GLuint index = READ_DATA( 0, GLuint );
	const GLshort *v = DATA_POINTER(4, const GLshort);
	cr_unpackDispatch.VertexAttrib4NsvARB( index, v );
	INCR_DATA_PTR( 12 );
}

void crUnpackVertexAttrib4NubvARB(void)
{
	GLuint index = READ_DATA( 0, GLuint );
	const GLubyte *v = DATA_POINTER(4, const GLubyte);
	cr_unpackDispatch.VertexAttrib4NubvARB( index, v );
	INCR_DATA_PTR( 8 );
}

void crUnpackVertexAttrib4NuivARB(void)
{
	GLuint index = READ_DATA( 0, GLuint );
	const GLuint *v = DATA_POINTER(4, const GLuint);
	cr_unpackDispatch.VertexAttrib4NuivARB( index, v );
	INCR_DATA_PTR( 20 );
}

void crUnpackVertexAttrib4NusvARB(void)
{
	GLuint index = READ_DATA( 0, GLuint );
	const GLushort *v = DATA_POINTER(4, const GLushort);
	cr_unpackDispatch.VertexAttrib4NusvARB( index, v );
	INCR_DATA_PTR( 12 );
}

void crUnpackVertexAttrib4bvARB(void)
{
	GLuint index = READ_DATA( 0, GLuint );
	const GLbyte *v = DATA_POINTER(4, const GLbyte);
	cr_unpackDispatch.VertexAttrib4bvARB( index, v );
	INCR_DATA_PTR( 8 );
}

void crUnpackVertexAttrib4ivARB(void)
{
	GLuint index = READ_DATA( 0, GLuint );
	const GLint *v = DATA_POINTER(4, const GLint);
	cr_unpackDispatch.VertexAttrib4ivARB( index, v );
	INCR_DATA_PTR( 20 );
}

void crUnpackVertexAttrib4ubvARB(void)
{
	GLuint index = READ_DATA( 0, GLuint );
	const GLubyte *v = DATA_POINTER(4, const GLubyte);
	cr_unpackDispatch.VertexAttrib4ubvARB( index, v );
	INCR_DATA_PTR( 8 );
}

void crUnpackVertexAttrib4uivARB(void)
{
	GLuint index = READ_DATA( 0, GLuint );
	const GLuint *v = DATA_POINTER(4, const GLuint);
	cr_unpackDispatch.VertexAttrib4uivARB( index, v );
	INCR_DATA_PTR( 20 );
}

void crUnpackVertexAttrib4usvARB(void)
{
	GLuint index = READ_DATA( 0, GLuint );
	const GLushort *v = DATA_POINTER(4, const GLushort);
	cr_unpackDispatch.VertexAttrib4usvARB( index, v );
	INCR_DATA_PTR( 12 );
}