2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
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, sublicense,
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:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 * NVIDIA vertex/fragment program state management functions.
32 * Regarding GL_NV_fragment/vertex_program, GL_NV_vertex_program1_1, etc:
34 * Portions of this software may use or implement intellectual
35 * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims
36 * any and all warranties with respect to such intellectual property,
37 * including any use thereof or modifications thereto.
40 #include "main/glheader.h"
41 #include "main/context.h"
42 #include "main/hash.h"
43 #include "main/imports.h"
44 #include "main/macros.h"
46 #include "prog_parameter.h"
47 #include "prog_instruction.h"
48 #include "nvfragparse.h"
49 #include "nvvertparse.h"
50 #include "nvprogram.h"
55 * Execute a vertex state program.
56 * \note Called from the GL API dispatcher.
59 _mesa_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
61 struct gl_vertex_program
*vprog
;
62 GET_CURRENT_CONTEXT(ctx
);
63 ASSERT_OUTSIDE_BEGIN_END(ctx
);
65 if (target
!= GL_VERTEX_STATE_PROGRAM_NV
) {
66 _mesa_error(ctx
, GL_INVALID_ENUM
, "glExecuteProgramNV");
70 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
72 vprog
= (struct gl_vertex_program
*) _mesa_lookup_program(ctx
, id
);
74 if (!vprog
|| vprog
->Base
.Target
!= GL_VERTEX_STATE_PROGRAM_NV
) {
75 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glExecuteProgramNV");
79 _mesa_problem(ctx
, "glExecuteProgramNV() not supported");
84 * Determine if a set of programs is resident in hardware.
85 * \note Not compiled into display lists.
86 * \note Called from the GL API dispatcher.
89 _mesa_AreProgramsResidentNV(GLsizei n
, const GLuint
*ids
,
90 GLboolean
*residences
)
93 GLboolean allResident
= GL_TRUE
;
94 GET_CURRENT_CONTEXT(ctx
);
95 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
98 _mesa_error(ctx
, GL_INVALID_VALUE
, "glAreProgramsResidentNV(n)");
102 for (i
= 0; i
< n
; i
++) {
103 const struct gl_program
*prog
;
105 _mesa_error(ctx
, GL_INVALID_VALUE
, "glAreProgramsResidentNV");
108 prog
= _mesa_lookup_program(ctx
, ids
[i
]);
110 _mesa_error(ctx
, GL_INVALID_VALUE
, "glAreProgramsResidentNV");
113 if (prog
->Resident
) {
115 residences
[i
] = GL_TRUE
;
119 allResident
= GL_FALSE
;
120 for (j
= 0; j
< i
; j
++)
121 residences
[j
] = GL_TRUE
;
123 residences
[i
] = GL_FALSE
;
132 * Request that a set of programs be resident in hardware.
133 * \note Called from the GL API dispatcher.
136 _mesa_RequestResidentProgramsNV(GLsizei n
, const GLuint
*ids
)
139 GET_CURRENT_CONTEXT(ctx
);
140 ASSERT_OUTSIDE_BEGIN_END(ctx
);
143 _mesa_error(ctx
, GL_INVALID_VALUE
, "glRequestResidentProgramsNV(n)");
147 /* just error checking for now */
148 for (i
= 0; i
< n
; i
++) {
149 struct gl_program
*prog
;
152 _mesa_error(ctx
, GL_INVALID_VALUE
, "glRequestResidentProgramsNV(id)");
156 prog
= _mesa_lookup_program(ctx
, ids
[i
]);
158 _mesa_error(ctx
, GL_INVALID_VALUE
, "glRequestResidentProgramsNV(id)");
162 /* XXX this is really a hardware thing we should hook out */
163 prog
->Resident
= GL_TRUE
;
169 * Get a program parameter register.
170 * \note Not compiled into display lists.
171 * \note Called from the GL API dispatcher.
174 _mesa_GetProgramParameterfvNV(GLenum target
, GLuint index
,
175 GLenum pname
, GLfloat
*params
)
177 GET_CURRENT_CONTEXT(ctx
);
178 ASSERT_OUTSIDE_BEGIN_END(ctx
);
180 if (target
== GL_VERTEX_PROGRAM_NV
) {
181 if (pname
== GL_PROGRAM_PARAMETER_NV
) {
182 if (index
< MAX_NV_VERTEX_PROGRAM_PARAMS
) {
183 COPY_4V(params
, ctx
->VertexProgram
.Parameters
[index
]);
186 _mesa_error(ctx
, GL_INVALID_VALUE
,
187 "glGetProgramParameterfvNV(index)");
192 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterfvNV(pname)");
197 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterfvNV(target)");
204 * Get a program parameter register.
205 * \note Not compiled into display lists.
206 * \note Called from the GL API dispatcher.
209 _mesa_GetProgramParameterdvNV(GLenum target
, GLuint index
,
210 GLenum pname
, GLdouble
*params
)
212 GET_CURRENT_CONTEXT(ctx
);
213 ASSERT_OUTSIDE_BEGIN_END(ctx
);
215 if (target
== GL_VERTEX_PROGRAM_NV
) {
216 if (pname
== GL_PROGRAM_PARAMETER_NV
) {
217 if (index
< MAX_NV_VERTEX_PROGRAM_PARAMS
) {
218 COPY_4V(params
, ctx
->VertexProgram
.Parameters
[index
]);
221 _mesa_error(ctx
, GL_INVALID_VALUE
,
222 "glGetProgramParameterdvNV(index)");
227 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterdvNV(pname)");
232 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterdvNV(target)");
239 * Get a program attribute.
240 * \note Not compiled into display lists.
241 * \note Called from the GL API dispatcher.
244 _mesa_GetProgramivNV(GLuint id
, GLenum pname
, GLint
*params
)
246 struct gl_program
*prog
;
247 GET_CURRENT_CONTEXT(ctx
);
249 if (!ctx
->_CurrentProgram
)
250 ASSERT_OUTSIDE_BEGIN_END(ctx
);
252 prog
= _mesa_lookup_program(ctx
, id
);
254 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramivNV");
259 case GL_PROGRAM_TARGET_NV
:
260 *params
= prog
->Target
;
262 case GL_PROGRAM_LENGTH_NV
:
263 *params
= prog
->String
?(GLint
)_mesa_strlen((char *) prog
->String
) : 0;
265 case GL_PROGRAM_RESIDENT_NV
:
266 *params
= prog
->Resident
;
269 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramivNV(pname)");
276 * Get the program source code.
277 * \note Not compiled into display lists.
278 * \note Called from the GL API dispatcher.
281 _mesa_GetProgramStringNV(GLuint id
, GLenum pname
, GLubyte
*program
)
283 struct gl_program
*prog
;
284 GET_CURRENT_CONTEXT(ctx
);
286 if (!ctx
->_CurrentProgram
)
287 ASSERT_OUTSIDE_BEGIN_END(ctx
);
289 if (pname
!= GL_PROGRAM_STRING_NV
) {
290 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramStringNV(pname)");
294 prog
= _mesa_lookup_program(ctx
, id
);
296 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramStringNV");
301 MEMCPY(program
, prog
->String
, _mesa_strlen((char *) prog
->String
));
310 * Get matrix tracking information.
311 * \note Not compiled into display lists.
312 * \note Called from the GL API dispatcher.
315 _mesa_GetTrackMatrixivNV(GLenum target
, GLuint address
,
316 GLenum pname
, GLint
*params
)
318 GET_CURRENT_CONTEXT(ctx
);
319 ASSERT_OUTSIDE_BEGIN_END(ctx
);
321 if (target
== GL_VERTEX_PROGRAM_NV
322 && ctx
->Extensions
.NV_vertex_program
) {
325 if ((address
& 0x3) || address
>= MAX_NV_VERTEX_PROGRAM_PARAMS
) {
326 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetTrackMatrixivNV(address)");
333 case GL_TRACK_MATRIX_NV
:
334 params
[0] = (GLint
) ctx
->VertexProgram
.TrackMatrix
[i
];
336 case GL_TRACK_MATRIX_TRANSFORM_NV
:
337 params
[0] = (GLint
) ctx
->VertexProgram
.TrackMatrixTransform
[i
];
340 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTrackMatrixivNV");
345 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTrackMatrixivNV");
352 * Get a vertex (or vertex array) attribute.
353 * \note Not compiled into display lists.
354 * \note Called from the GL API dispatcher.
357 _mesa_GetVertexAttribdvNV(GLuint index
, GLenum pname
, GLdouble
*params
)
359 GET_CURRENT_CONTEXT(ctx
);
360 ASSERT_OUTSIDE_BEGIN_END(ctx
);
362 if (index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
363 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
368 case GL_ATTRIB_ARRAY_SIZE_NV
:
369 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Size
;
371 case GL_ATTRIB_ARRAY_STRIDE_NV
:
372 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Stride
;
374 case GL_ATTRIB_ARRAY_TYPE_NV
:
375 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Type
;
377 case GL_CURRENT_ATTRIB_NV
:
379 _mesa_error(ctx
, GL_INVALID_OPERATION
,
380 "glGetVertexAttribdvNV(index == 0)");
383 FLUSH_CURRENT(ctx
, 0);
384 COPY_4V(params
, ctx
->Current
.Attrib
[index
]);
387 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
393 * Get a vertex (or vertex array) attribute.
394 * \note Not compiled into display lists.
395 * \note Called from the GL API dispatcher.
398 _mesa_GetVertexAttribfvNV(GLuint index
, GLenum pname
, GLfloat
*params
)
400 GET_CURRENT_CONTEXT(ctx
);
401 ASSERT_OUTSIDE_BEGIN_END(ctx
);
403 if (index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
404 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
409 case GL_ATTRIB_ARRAY_SIZE_NV
:
410 params
[0] = (GLfloat
) ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Size
;
412 case GL_ATTRIB_ARRAY_STRIDE_NV
:
413 params
[0] = (GLfloat
) ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Stride
;
415 case GL_ATTRIB_ARRAY_TYPE_NV
:
416 params
[0] = (GLfloat
) ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Type
;
418 case GL_CURRENT_ATTRIB_NV
:
420 _mesa_error(ctx
, GL_INVALID_OPERATION
,
421 "glGetVertexAttribfvNV(index == 0)");
424 FLUSH_CURRENT(ctx
, 0);
425 COPY_4V(params
, ctx
->Current
.Attrib
[index
]);
428 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
434 * Get a vertex (or vertex array) attribute.
435 * \note Not compiled into display lists.
436 * \note Called from the GL API dispatcher.
439 _mesa_GetVertexAttribivNV(GLuint index
, GLenum pname
, GLint
*params
)
441 GET_CURRENT_CONTEXT(ctx
);
442 ASSERT_OUTSIDE_BEGIN_END(ctx
);
444 if (index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
445 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
450 case GL_ATTRIB_ARRAY_SIZE_NV
:
451 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Size
;
453 case GL_ATTRIB_ARRAY_STRIDE_NV
:
454 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Stride
;
456 case GL_ATTRIB_ARRAY_TYPE_NV
:
457 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Type
;
459 case GL_CURRENT_ATTRIB_NV
:
461 _mesa_error(ctx
, GL_INVALID_OPERATION
,
462 "glGetVertexAttribivNV(index == 0)");
465 FLUSH_CURRENT(ctx
, 0);
466 params
[0] = (GLint
) ctx
->Current
.Attrib
[index
][0];
467 params
[1] = (GLint
) ctx
->Current
.Attrib
[index
][1];
468 params
[2] = (GLint
) ctx
->Current
.Attrib
[index
][2];
469 params
[3] = (GLint
) ctx
->Current
.Attrib
[index
][3];
471 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB
:
472 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].BufferObj
->Name
;
475 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
482 * Get a vertex array attribute pointer.
483 * \note Not compiled into display lists.
484 * \note Called from the GL API dispatcher.
487 _mesa_GetVertexAttribPointervNV(GLuint index
, GLenum pname
, GLvoid
**pointer
)
489 GET_CURRENT_CONTEXT(ctx
);
490 ASSERT_OUTSIDE_BEGIN_END(ctx
);
492 if (index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
493 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribPointerNV(index)");
497 if (pname
!= GL_ATTRIB_ARRAY_POINTER_NV
) {
498 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribPointerNV(pname)");
502 *pointer
= (GLvoid
*) ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Ptr
;
508 * Load/parse/compile a program.
509 * \note Called from the GL API dispatcher.
512 _mesa_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
513 const GLubyte
*program
)
515 struct gl_program
*prog
;
516 GET_CURRENT_CONTEXT(ctx
);
517 ASSERT_OUTSIDE_BEGIN_END(ctx
);
520 _mesa_error(ctx
, GL_INVALID_VALUE
, "glLoadProgramNV(id)");
525 _mesa_error(ctx
, GL_INVALID_VALUE
, "glLoadProgramNV(len)");
529 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
531 prog
= _mesa_lookup_program(ctx
, id
);
533 if (prog
&& prog
->Target
!= 0 && prog
->Target
!= target
) {
534 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glLoadProgramNV(target)");
538 if ((target
== GL_VERTEX_PROGRAM_NV
||
539 target
== GL_VERTEX_STATE_PROGRAM_NV
)
540 && ctx
->Extensions
.NV_vertex_program
) {
541 struct gl_vertex_program
*vprog
= (struct gl_vertex_program
*) prog
;
542 if (!vprog
|| prog
== &_mesa_DummyProgram
) {
543 vprog
= (struct gl_vertex_program
*)
544 ctx
->Driver
.NewProgram(ctx
, target
, id
);
546 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
549 _mesa_HashInsert(ctx
->Shared
->Programs
, id
, vprog
);
551 _mesa_parse_nv_vertex_program(ctx
, target
, program
, len
, vprog
);
553 else if (target
== GL_FRAGMENT_PROGRAM_NV
554 && ctx
->Extensions
.NV_fragment_program
) {
555 struct gl_fragment_program
*fprog
= (struct gl_fragment_program
*) prog
;
556 if (!fprog
|| prog
== &_mesa_DummyProgram
) {
557 fprog
= (struct gl_fragment_program
*)
558 ctx
->Driver
.NewProgram(ctx
, target
, id
);
560 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
563 _mesa_HashInsert(ctx
->Shared
->Programs
, id
, fprog
);
565 _mesa_parse_nv_fragment_program(ctx
, target
, program
, len
, fprog
);
568 _mesa_error(ctx
, GL_INVALID_ENUM
, "glLoadProgramNV(target)");
575 * Set a sequence of program parameter registers.
576 * \note Called from the GL API dispatcher.
579 _mesa_ProgramParameters4dvNV(GLenum target
, GLuint index
,
580 GLuint num
, const GLdouble
*params
)
582 GET_CURRENT_CONTEXT(ctx
);
583 ASSERT_OUTSIDE_BEGIN_END(ctx
);
585 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
587 if (index
+ num
> MAX_NV_VERTEX_PROGRAM_PARAMS
) {
588 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramParameters4dvNV");
591 for (i
= 0; i
< num
; i
++) {
592 ctx
->VertexProgram
.Parameters
[index
+ i
][0] = (GLfloat
) params
[0];
593 ctx
->VertexProgram
.Parameters
[index
+ i
][1] = (GLfloat
) params
[1];
594 ctx
->VertexProgram
.Parameters
[index
+ i
][2] = (GLfloat
) params
[2];
595 ctx
->VertexProgram
.Parameters
[index
+ i
][3] = (GLfloat
) params
[3];
600 _mesa_error(ctx
, GL_INVALID_ENUM
, "glProgramParameters4dvNV");
607 * Set a sequence of program parameter registers.
608 * \note Called from the GL API dispatcher.
611 _mesa_ProgramParameters4fvNV(GLenum target
, GLuint index
,
612 GLuint num
, const GLfloat
*params
)
614 GET_CURRENT_CONTEXT(ctx
);
615 ASSERT_OUTSIDE_BEGIN_END(ctx
);
617 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
619 if (index
+ num
> MAX_NV_VERTEX_PROGRAM_PARAMS
) {
620 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramParameters4fvNV");
623 for (i
= 0; i
< num
; i
++) {
624 COPY_4V(ctx
->VertexProgram
.Parameters
[index
+ i
], params
);
629 _mesa_error(ctx
, GL_INVALID_ENUM
, "glProgramParameters4fvNV");
637 * Setup tracking of matrices into program parameter registers.
638 * \note Called from the GL API dispatcher.
641 _mesa_TrackMatrixNV(GLenum target
, GLuint address
,
642 GLenum matrix
, GLenum transform
)
644 GET_CURRENT_CONTEXT(ctx
);
645 ASSERT_OUTSIDE_BEGIN_END(ctx
);
647 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
649 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
651 /* addr must be multiple of four */
652 _mesa_error(ctx
, GL_INVALID_VALUE
, "glTrackMatrixNV(address)");
662 case GL_MODELVIEW_PROJECTION_NV
:
671 /* OK, fallthrough */
674 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(matrix)");
681 case GL_TRANSPOSE_NV
:
682 case GL_INVERSE_TRANSPOSE_NV
:
683 /* OK, fallthrough */
686 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(transform)");
690 ctx
->VertexProgram
.TrackMatrix
[address
/ 4] = matrix
;
691 ctx
->VertexProgram
.TrackMatrixTransform
[address
/ 4] = transform
;
694 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(target)");
701 _mesa_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
702 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
704 struct gl_program
*prog
;
705 struct gl_fragment_program
*fragProg
;
708 GET_CURRENT_CONTEXT(ctx
);
709 ASSERT_OUTSIDE_BEGIN_END(ctx
);
711 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
713 prog
= _mesa_lookup_program(ctx
, id
);
714 if (!prog
|| prog
->Target
!= GL_FRAGMENT_PROGRAM_NV
) {
715 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glProgramNamedParameterNV");
720 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramNamedParameterNV(len)");
724 fragProg
= (struct gl_fragment_program
*) prog
;
725 v
= _mesa_lookup_parameter_value(fragProg
->Base
.Parameters
, len
,
735 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramNamedParameterNV(name)");
740 _mesa_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
743 _mesa_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
748 _mesa_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
749 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
751 _mesa_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
)x
, (GLfloat
)y
,
752 (GLfloat
)z
, (GLfloat
)w
);
757 _mesa_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
760 _mesa_ProgramNamedParameter4fNV(id
, len
, name
,
761 (GLfloat
)v
[0], (GLfloat
)v
[1],
762 (GLfloat
)v
[2], (GLfloat
)v
[3]);
767 _mesa_GetProgramNamedParameterfvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
770 struct gl_program
*prog
;
771 struct gl_fragment_program
*fragProg
;
774 GET_CURRENT_CONTEXT(ctx
);
776 if (!ctx
->_CurrentProgram
)
777 ASSERT_OUTSIDE_BEGIN_END(ctx
);
779 prog
= _mesa_lookup_program(ctx
, id
);
780 if (!prog
|| prog
->Target
!= GL_FRAGMENT_PROGRAM_NV
) {
781 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramNamedParameterNV");
786 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetProgramNamedParameterNV");
790 fragProg
= (struct gl_fragment_program
*) prog
;
791 v
= _mesa_lookup_parameter_value(fragProg
->Base
.Parameters
,
801 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetProgramNamedParameterNV");
806 _mesa_GetProgramNamedParameterdvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
809 GLfloat floatParams
[4];
810 _mesa_GetProgramNamedParameterfvNV(id
, len
, name
, floatParams
);
811 COPY_4V(params
, floatParams
);