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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
|
/*
* Mesa 3-D graphics library
* Version: 5.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file arbprogram.c
* \brief ARB_vertex/fragment_program state management functions.
* \author Brian Paul
*/
#include "glheader.h"
#include "context.h"
#include "hash.h"
#include "imports.h"
#include "macros.h"
#include "mtypes.h"
#include "arbprogram.h"
void
_mesa_VertexAttrib1sARB(GLuint index, GLshort x)
{
}
void
_mesa_VertexAttrib1fARB(GLuint index, GLfloat x)
{
}
void
_mesa_VertexAttrib1dARB(GLuint index, GLdouble x)
{
}
void
_mesa_VertexAttrib2sARB(GLuint index, GLshort x, GLshort y)
{
}
void
_mesa_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
{
}
void
_mesa_VertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y)
{
}
void
_mesa_VertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z)
{
}
void
_mesa_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
{
}
void
_mesa_VertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z)
{
}
void
_mesa_VertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
{
}
void
_mesa_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
}
void
_mesa_VertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
{
}
void
_mesa_VertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
{
}
void
_mesa_VertexAttrib1svARB(GLuint index, const GLshort *v)
{
}
void
_mesa_VertexAttrib1fvARB(GLuint index, const GLfloat *v)
{
}
void
_mesa_VertexAttrib1dvARB(GLuint index, const GLdouble *v)
{
}
void
_mesa_VertexAttrib2svARB(GLuint index, const GLshort *v)
{
}
void
_mesa_VertexAttrib2fvARB(GLuint index, const GLfloat *v)
{
}
void
_mesa_VertexAttrib2dvARB(GLuint index, const GLdouble *v)
{
}
void
_mesa_VertexAttrib3svARB(GLuint index, const GLshort *v)
{
}
void
_mesa_VertexAttrib3fvARB(GLuint index, const GLfloat *v)
{
}
void
_mesa_VertexAttrib3dvARB(GLuint index, const GLdouble *v)
{
}
void
_mesa_VertexAttrib4bvARB(GLuint index, const GLbyte *v)
{
}
void
_mesa_VertexAttrib4svARB(GLuint index, const GLshort *v)
{
}
void
_mesa_VertexAttrib4ivARB(GLuint index, const GLint *v)
{
}
void
_mesa_VertexAttrib4ubvARB(GLuint index, const GLubyte *v)
{
}
void
_mesa_VertexAttrib4usvARB(GLuint index, const GLushort *v)
{
}
void
_mesa_VertexAttrib4uivARB(GLuint index, const GLuint *v)
{
}
void
_mesa_VertexAttrib4fvARB(GLuint index, const GLfloat *v)
{
}
void
_mesa_VertexAttrib4dvARB(GLuint index, const GLdouble *v)
{
}
void
_mesa_VertexAttrib4NbvARB(GLuint index, const GLbyte *v)
{
}
void
_mesa_VertexAttrib4NsvARB(GLuint index, const GLshort *v)
{
}
void
_mesa_VertexAttrib4NivARB(GLuint index, const GLint *v)
{
}
void
_mesa_VertexAttrib4NubvARB(GLuint index, const GLubyte *v)
{
}
void
_mesa_VertexAttrib4NusvARB(GLuint index, const GLushort *v)
{
}
void
_mesa_VertexAttrib4NuivARB(GLuint index, const GLuint *v)
{
}
void
_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
GLboolean normalized, GLsizei stride,
const GLvoid *pointer)
{
}
void
_mesa_EnableVertexAttribArrayARB(GLuint index)
{
}
void
_mesa_DisableVertexAttribArrayARB(GLuint index)
{
}
void
_mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params)
{
}
void
_mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params)
{
}
void
_mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params)
{
}
void
_mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer)
{
}
void
_mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
const GLvoid *string)
{
}
void
_mesa_BindProgramARB(GLenum target, GLuint program)
{
}
void
_mesa_DeleteProgramsARB(GLsizei n, const GLuint *programs)
{
}
void
_mesa_GenProgramsARB(GLsizei n, GLuint *programs)
{
}
void
_mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index,
GLdouble x, GLdouble y, GLdouble z, GLdouble w)
{
}
void
_mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
const GLdouble *params)
{
}
void
_mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
}
void
_mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
const GLfloat *params)
{
}
#if 111
void
_mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index,
GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (target == GL_FRAGMENT_PROGRAM_NV) {
struct fragment_program *fprog = ctx->FragmentProgram.Current;
if (!fprog) {
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramLocalParameterARB");
return;
}
if (index >= MAX_NV_FRAGMENT_PROGRAM_PARAMS) {
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameterARB");
return;
}
fprog->Base.LocalParams[index][0] = x;
fprog->Base.LocalParams[index][1] = y;
fprog->Base.LocalParams[index][2] = z;
fprog->Base.LocalParams[index][3] = w;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramLocalParameterARB");
return;
}
}
void
_mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
const GLfloat *params)
{
glProgramLocalParameter4fARB(target, index, params[0], params[1],
params[2], params[3]);
}
void
_mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index,
GLdouble x, GLdouble y,
GLdouble z, GLdouble w)
{
glProgramLocalParameter4fARB(target, index, (GLfloat)x, (GLfloat)y,
(GLfloat)z, (GLfloat)w);
}
void
_mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
const GLdouble *params)
{
glProgramLocalParameter4fARB(target, index, (GLfloat)params[0],
(GLfloat)params[1], (GLfloat)params[2],
(GLfloat)params[3]);
}
void
_mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index,
GLfloat *params)
{
struct program *prog;
GLuint maxParams;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (target == GL_VERTEX_PROGRAM_ARB
&& ctx->Extensions.ARB_vertex_program) {
prog = &(ctx->VertexProgram.Current->Base);
maxParams = ctx->Const.MaxVertexProgramParams;
}
else if ((target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) ||
(target == GL_FRAGMENT_PROGRAM_NV
&& ctx->Extensions.NV_fragment_program)) {
prog = &(ctx->FragmentProgram.Current->Base);
maxParams = ctx->Const.MaxFragmentProgramParams;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetProgramLocalParameterARB(target)");
return;
}
if (index >= maxParams) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glGetProgramLocalParameterARB(index)");
return;
}
ASSERT(prog);
params[0] = prog->LocalParams[index][0];
params[1] = prog->LocalParams[index][1];
params[2] = prog->LocalParams[index][2];
params[3] = prog->LocalParams[index][3];
}
void
_mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index,
GLdouble *params)
{
GLfloat floatParams[4];
glGetProgramLocalParameterfvARB(target, index, floatParams);
COPY_4V(params, floatParams);
}
#else
void
_mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index,
GLdouble x, GLdouble y,
GLdouble z, GLdouble w)
{
}
void
_mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
const GLdouble *params)
{
}
void
_mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index,
GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
}
void
_mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
const GLfloat *params)
{
}
#endif
void
_mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index,
GLdouble *params)
{
}
void
_mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index,
GLfloat *params)
{
}
#if 000
void
_mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index,
GLdouble *params)
{
}
void
_mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index,
GLfloat *params)
{
}
#endif
void
_mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
{
struct program *prog;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (target == GL_VERTEX_PROGRAM_ARB) {
prog = &(ctx->VertexProgram.Current->Base);
}
else if (target == GL_FRAGMENT_PROGRAM_ARB) {
prog = &(ctx->FragmentProgram.Current->Base);
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)");
return;
}
ASSERT(prog);
switch (pname) {
case GL_PROGRAM_LENGTH_ARB:
*params = prog->String ? _mesa_strlen((char *) prog->String) : 0;
break;
case GL_PROGRAM_FORMAT_ARB:
*params = prog->Format;
break;
case GL_PROGRAM_BINDING_ARB:
*params = prog->Id;
break;
case GL_PROGRAM_INSTRUCTIONS_ARB:
*params = prog->NumInstructions;
break;
case GL_MAX_PROGRAM_INSTRUCTIONS_ARB:
case GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB:
case GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB:
case GL_PROGRAM_TEMPORARIES_ARB:
case GL_MAX_PROGRAM_TEMPORARIES_ARB:
case GL_PROGRAM_NATIVE_TEMPORARIES_ARB:
case GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB:
case GL_PROGRAM_PARAMETERS_ARB:
case GL_MAX_PROGRAM_PARAMETERS_ARB:
case GL_PROGRAM_NATIVE_PARAMETERS_ARB:
case GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB:
case GL_PROGRAM_ATTRIBS_ARB:
case GL_MAX_PROGRAM_ATTRIBS_ARB:
case GL_PROGRAM_NATIVE_ATTRIBS_ARB:
case GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB:
case GL_PROGRAM_ADDRESS_REGISTERS_ARB:
case GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB:
case GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB:
case GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB:
case GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB:
case GL_MAX_PROGRAM_ENV_PARAMETERS_ARB:
case GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB:
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(pname)");
return;
}
}
void
_mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string)
{
struct program *prog;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (target == GL_VERTEX_PROGRAM_ARB) {
prog = &(ctx->VertexProgram.Current->Base);
}
else if (target == GL_FRAGMENT_PROGRAM_ARB) {
prog = &(ctx->FragmentProgram.Current->Base);
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringARB(target)");
return;
}
ASSERT(prog);
if (pname != GL_PROGRAM_STRING_ARB) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringARB(pname)");
return;
}
MEMCPY(string, prog->String, _mesa_strlen((char *) prog->String));
}
GLboolean
_mesa_IsProgramARB(GLuint program)
{
struct program *prog;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
if (program == 0)
return GL_FALSE;
prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, program);
if (prog && prog->Target)
return GL_TRUE;
else
return GL_FALSE;
}
|