2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2003 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.
38 #include "nvfragparse.h"
39 #include "nvfragprog.h"
40 #include "nvvertexec.h"
41 #include "nvvertparse.h"
42 #include "nvvertprog.h"
43 #include "nvprogram.h"
49 * Execute a vertex state program.
50 * \note Called from the GL API dispatcher.
53 _mesa_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
55 struct vertex_program
*vprog
;
56 GET_CURRENT_CONTEXT(ctx
);
57 ASSERT_OUTSIDE_BEGIN_END(ctx
);
59 if (target
!= GL_VERTEX_STATE_PROGRAM_NV
) {
60 _mesa_error(ctx
, GL_INVALID_ENUM
, "glExecuteProgramNV");
64 vprog
= (struct vertex_program
*)
65 _mesa_HashLookup(ctx
->Shared
->Programs
, id
);
67 if (!vprog
|| vprog
->Base
.Target
!= GL_VERTEX_STATE_PROGRAM_NV
) {
68 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glExecuteProgramNV");
72 _mesa_init_vp_registers(ctx
);
73 _mesa_init_tracked_matrices(ctx
);
74 COPY_4V(ctx
->VertexProgram
.Inputs
[VERT_ATTRIB_POS
], params
);
75 _mesa_exec_vertex_program(ctx
, vprog
);
80 * Determine if a set of programs is resident in hardware.
81 * \note Not compiled into display lists.
82 * \note Called from the GL API dispatcher.
84 GLboolean
_mesa_AreProgramsResidentNV(GLsizei n
, const GLuint
*ids
,
85 GLboolean
*residences
)
88 GLboolean allResident
= GL_TRUE
;
89 GET_CURRENT_CONTEXT(ctx
);
90 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
93 _mesa_error(ctx
, GL_INVALID_VALUE
, "glAreProgramsResidentNV(n)");
97 for (i
= 0; i
< n
; i
++) {
98 const struct program
*prog
;
100 _mesa_error(ctx
, GL_INVALID_VALUE
, "glAreProgramsResidentNV");
103 prog
= (const struct program
*)
104 _mesa_HashLookup(ctx
->Shared
->Programs
, ids
[i
]);
106 _mesa_error(ctx
, GL_INVALID_VALUE
, "glAreProgramsResidentNV");
109 if (prog
->Resident
) {
111 residences
[i
] = GL_TRUE
;
115 allResident
= GL_FALSE
;
116 for (j
= 0; j
< i
; j
++)
117 residences
[j
] = GL_TRUE
;
119 residences
[i
] = GL_FALSE
;
128 * Request that a set of programs be resident in hardware.
129 * \note Called from the GL API dispatcher.
132 _mesa_RequestResidentProgramsNV(GLsizei n
, const GLuint
*ids
)
135 GET_CURRENT_CONTEXT(ctx
);
136 ASSERT_OUTSIDE_BEGIN_END(ctx
);
139 _mesa_error(ctx
, GL_INVALID_VALUE
, "glRequestResidentProgramsNV(n)");
143 /* just error checking for now */
144 for (i
= 0; i
< n
; i
++) {
145 struct program
*prog
;
148 _mesa_error(ctx
, GL_INVALID_VALUE
, "glRequestResidentProgramsNV(id)");
152 prog
= (struct program
*) _mesa_HashLookup(ctx
->Shared
->Programs
, ids
[i
]);
155 _mesa_error(ctx
, GL_INVALID_VALUE
, "glRequestResidentProgramsNV(id)");
159 prog
->Resident
= GL_TRUE
;
165 * Get a program parameter register.
166 * \note Not compiled into display lists.
167 * \note Called from the GL API dispatcher.
170 _mesa_GetProgramParameterfvNV(GLenum target
, GLuint index
,
171 GLenum pname
, GLfloat
*params
)
173 GET_CURRENT_CONTEXT(ctx
);
174 ASSERT_OUTSIDE_BEGIN_END(ctx
);
176 if (target
== GL_VERTEX_PROGRAM_NV
) {
177 if (pname
== GL_PROGRAM_PARAMETER_NV
) {
178 if (index
< MAX_NV_VERTEX_PROGRAM_PARAMS
) {
179 COPY_4V(params
, ctx
->VertexProgram
.Parameters
[index
]);
182 _mesa_error(ctx
, GL_INVALID_VALUE
,
183 "glGetProgramParameterfvNV(index)");
188 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterfvNV(pname)");
193 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterfvNV(target)");
200 * Get a program parameter register.
201 * \note Not compiled into display lists.
202 * \note Called from the GL API dispatcher.
205 _mesa_GetProgramParameterdvNV(GLenum target
, GLuint index
,
206 GLenum pname
, GLdouble
*params
)
208 GET_CURRENT_CONTEXT(ctx
);
209 ASSERT_OUTSIDE_BEGIN_END(ctx
);
211 if (target
== GL_VERTEX_PROGRAM_NV
) {
212 if (pname
== GL_PROGRAM_PARAMETER_NV
) {
213 if (index
< MAX_NV_VERTEX_PROGRAM_PARAMS
) {
214 COPY_4V(params
, ctx
->VertexProgram
.Parameters
[index
]);
217 _mesa_error(ctx
, GL_INVALID_VALUE
,
218 "glGetProgramParameterdvNV(index)");
223 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterdvNV(pname)");
228 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterdvNV(target)");
235 * Get a program attribute.
236 * \note Not compiled into display lists.
237 * \note Called from the GL API dispatcher.
240 _mesa_GetProgramivNV(GLuint id
, GLenum pname
, GLint
*params
)
242 struct program
*prog
;
243 GET_CURRENT_CONTEXT(ctx
);
245 if (!ctx
->_CurrentProgram
)
246 ASSERT_OUTSIDE_BEGIN_END(ctx
);
248 prog
= (struct program
*) _mesa_HashLookup(ctx
->Shared
->Programs
, id
);
250 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramivNV");
255 case GL_PROGRAM_TARGET_NV
:
256 *params
= prog
->Target
;
258 case GL_PROGRAM_LENGTH_NV
:
259 *params
= prog
->String
? _mesa_strlen((char *) prog
->String
) : 0;
261 case GL_PROGRAM_RESIDENT_NV
:
262 *params
= prog
->Resident
;
265 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramivNV(pname)");
272 * Get the program source code.
273 * \note Not compiled into display lists.
274 * \note Called from the GL API dispatcher.
277 _mesa_GetProgramStringNV(GLuint id
, GLenum pname
, GLubyte
*program
)
279 struct program
*prog
;
280 GET_CURRENT_CONTEXT(ctx
);
282 if (!ctx
->_CurrentProgram
)
283 ASSERT_OUTSIDE_BEGIN_END(ctx
);
285 if (pname
!= GL_PROGRAM_STRING_NV
) {
286 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramStringNV(pname)");
290 prog
= (struct program
*) _mesa_HashLookup(ctx
->Shared
->Programs
, id
);
292 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramStringNV");
297 MEMCPY(program
, prog
->String
, _mesa_strlen((char *) prog
->String
));
306 * Get matrix tracking information.
307 * \note Not compiled into display lists.
308 * \note Called from the GL API dispatcher.
311 _mesa_GetTrackMatrixivNV(GLenum target
, GLuint address
,
312 GLenum pname
, GLint
*params
)
314 GET_CURRENT_CONTEXT(ctx
);
315 ASSERT_OUTSIDE_BEGIN_END(ctx
);
317 if (target
== GL_VERTEX_PROGRAM_NV
318 && ctx
->Extensions
.NV_vertex_program
) {
321 if ((address
& 0x3) || address
>= MAX_NV_VERTEX_PROGRAM_PARAMS
) {
322 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetTrackMatrixivNV(address)");
329 case GL_TRACK_MATRIX_NV
:
330 params
[0] = (GLint
) ctx
->VertexProgram
.TrackMatrix
[i
];
332 case GL_TRACK_MATRIX_TRANSFORM_NV
:
333 params
[0] = (GLint
) ctx
->VertexProgram
.TrackMatrixTransform
[i
];
336 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTrackMatrixivNV");
341 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTrackMatrixivNV");
348 * Get a vertex (or vertex array) attribute.
349 * \note Not compiled into display lists.
350 * \note Called from the GL API dispatcher.
353 _mesa_GetVertexAttribdvNV(GLuint index
, GLenum pname
, GLdouble
*params
)
355 GET_CURRENT_CONTEXT(ctx
);
356 ASSERT_OUTSIDE_BEGIN_END(ctx
);
358 if (index
== 0 || index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
359 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
364 case GL_ATTRIB_ARRAY_SIZE_NV
:
365 params
[0] = ctx
->Array
.VertexAttrib
[index
].Size
;
367 case GL_ATTRIB_ARRAY_STRIDE_NV
:
368 params
[0] = ctx
->Array
.VertexAttrib
[index
].Stride
;
370 case GL_ATTRIB_ARRAY_TYPE_NV
:
371 params
[0] = ctx
->Array
.VertexAttrib
[index
].Type
;
373 case GL_CURRENT_ATTRIB_NV
:
374 FLUSH_CURRENT(ctx
, 0);
375 COPY_4V(params
, ctx
->Current
.Attrib
[index
]);
378 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
384 * Get a vertex (or vertex array) attribute.
385 * \note Not compiled into display lists.
386 * \note Called from the GL API dispatcher.
389 _mesa_GetVertexAttribfvNV(GLuint index
, GLenum pname
, GLfloat
*params
)
391 GET_CURRENT_CONTEXT(ctx
);
392 ASSERT_OUTSIDE_BEGIN_END(ctx
);
394 if (index
== 0 || index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
395 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
400 case GL_ATTRIB_ARRAY_SIZE_NV
:
401 params
[0] = (GLfloat
) ctx
->Array
.VertexAttrib
[index
].Size
;
403 case GL_ATTRIB_ARRAY_STRIDE_NV
:
404 params
[0] = (GLfloat
) ctx
->Array
.VertexAttrib
[index
].Stride
;
406 case GL_ATTRIB_ARRAY_TYPE_NV
:
407 params
[0] = (GLfloat
) ctx
->Array
.VertexAttrib
[index
].Type
;
409 case GL_CURRENT_ATTRIB_NV
:
410 FLUSH_CURRENT(ctx
, 0);
411 COPY_4V(params
, ctx
->Current
.Attrib
[index
]);
414 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
420 * Get a vertex (or vertex array) attribute.
421 * \note Not compiled into display lists.
422 * \note Called from the GL API dispatcher.
425 _mesa_GetVertexAttribivNV(GLuint index
, GLenum pname
, GLint
*params
)
427 GET_CURRENT_CONTEXT(ctx
);
428 ASSERT_OUTSIDE_BEGIN_END(ctx
);
430 if (index
== 0 || index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
431 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
436 case GL_ATTRIB_ARRAY_SIZE_NV
:
437 params
[0] = ctx
->Array
.VertexAttrib
[index
].Size
;
439 case GL_ATTRIB_ARRAY_STRIDE_NV
:
440 params
[0] = ctx
->Array
.VertexAttrib
[index
].Stride
;
442 case GL_ATTRIB_ARRAY_TYPE_NV
:
443 params
[0] = ctx
->Array
.VertexAttrib
[index
].Type
;
445 case GL_CURRENT_ATTRIB_NV
:
446 FLUSH_CURRENT(ctx
, 0);
447 params
[0] = (GLint
) ctx
->Current
.Attrib
[index
][0];
448 params
[1] = (GLint
) ctx
->Current
.Attrib
[index
][1];
449 params
[2] = (GLint
) ctx
->Current
.Attrib
[index
][2];
450 params
[3] = (GLint
) ctx
->Current
.Attrib
[index
][3];
452 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB
:
453 if (!ctx
->Extensions
.ARB_vertex_buffer_object
) {
454 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
457 params
[0] = ctx
->Array
.VertexAttrib
[index
].BufferBinding
;
460 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
467 * Get a vertex array attribute pointer.
468 * \note Not compiled into display lists.
469 * \note Called from the GL API dispatcher.
472 _mesa_GetVertexAttribPointervNV(GLuint index
, GLenum pname
, GLvoid
**pointer
)
474 GET_CURRENT_CONTEXT(ctx
);
475 ASSERT_OUTSIDE_BEGIN_END(ctx
);
477 if (index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
478 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribPointerNV(index)");
482 if (pname
!= GL_ATTRIB_ARRAY_POINTER_NV
) {
483 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribPointerNV(pname)");
487 *pointer
= ctx
->Array
.VertexAttrib
[index
].Ptr
;;
493 * Load/parse/compile a program.
494 * \note Called from the GL API dispatcher.
497 _mesa_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
498 const GLubyte
*program
)
500 struct program
*prog
;
501 GET_CURRENT_CONTEXT(ctx
);
502 ASSERT_OUTSIDE_BEGIN_END(ctx
);
505 _mesa_error(ctx
, GL_INVALID_VALUE
, "glLoadProgramNV(id)");
509 prog
= (struct program
*) _mesa_HashLookup(ctx
->Shared
->Programs
, id
);
511 if (prog
&& prog
->Target
!= 0 && prog
->Target
!= target
) {
512 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glLoadProgramNV(target)");
516 if ((target
== GL_VERTEX_PROGRAM_NV
||
517 target
== GL_VERTEX_STATE_PROGRAM_NV
)
518 && ctx
->Extensions
.NV_vertex_program
) {
519 struct vertex_program
*vprog
= (struct vertex_program
*) prog
;
521 vprog
= CALLOC_STRUCT(vertex_program
);
523 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
526 vprog
->Base
.RefCount
= 1;
527 vprog
->Base
.Resident
= GL_TRUE
;
528 _mesa_HashInsert(ctx
->Shared
->Programs
, id
, vprog
);
530 _mesa_parse_nv_vertex_program(ctx
, target
, program
, len
, vprog
);
532 else if (target
== GL_FRAGMENT_PROGRAM_NV
533 && ctx
->Extensions
.NV_fragment_program
) {
534 struct fragment_program
*fprog
= (struct fragment_program
*) prog
;
536 fprog
= CALLOC_STRUCT(fragment_program
);
538 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
541 fprog
->Base
.RefCount
= 1;
542 fprog
->Base
.Resident
= GL_TRUE
;
543 _mesa_HashInsert(ctx
->Shared
->Programs
, id
, fprog
);
545 _mesa_parse_nv_fragment_program(ctx
, target
, program
, len
, fprog
);
548 _mesa_error(ctx
, GL_INVALID_ENUM
, "glLoadProgramNV(target)");
555 * Set a program parameter register.
556 * \note Called from the GL API dispatcher.
559 _mesa_ProgramParameter4dNV(GLenum target
, GLuint index
,
560 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
562 _mesa_ProgramParameter4fNV(target
, index
,
563 (GLfloat
)x
, (GLfloat
)y
, (GLfloat
)z
, (GLfloat
)w
);
568 * Set a program parameter register.
569 * \note Called from the GL API dispatcher.
572 _mesa_ProgramParameter4dvNV(GLenum target
, GLuint index
,
573 const GLdouble
*params
)
575 _mesa_ProgramParameter4fNV(target
, index
,
576 (GLfloat
)params
[0], (GLfloat
)params
[1],
577 (GLfloat
)params
[2], (GLfloat
)params
[3]);
582 * Set a program parameter register.
583 * \note Called from the GL API dispatcher.
586 _mesa_ProgramParameter4fNV(GLenum target
, GLuint index
,
587 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
589 GET_CURRENT_CONTEXT(ctx
);
590 ASSERT_OUTSIDE_BEGIN_END(ctx
);
592 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
593 if (index
< MAX_NV_VERTEX_PROGRAM_PARAMS
) {
594 ASSIGN_4V(ctx
->VertexProgram
.Parameters
[index
], x
, y
, z
, w
);
597 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramParameterNV(index)");
602 _mesa_error(ctx
, GL_INVALID_ENUM
, "glProgramParameterNV");
609 * Set a program parameter register.
610 * \note Called from the GL API dispatcher.
613 _mesa_ProgramParameter4fvNV(GLenum target
, GLuint index
,
614 const GLfloat
*params
)
616 _mesa_ProgramParameter4fNV(target
, index
,
617 params
[0], params
[1], params
[2], params
[3]);
623 * Set a sequence of program parameter registers.
624 * \note Called from the GL API dispatcher.
627 _mesa_ProgramParameters4dvNV(GLenum target
, GLuint index
,
628 GLuint num
, const GLdouble
*params
)
630 GET_CURRENT_CONTEXT(ctx
);
631 ASSERT_OUTSIDE_BEGIN_END(ctx
);
633 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
635 if (index
+ num
> MAX_NV_VERTEX_PROGRAM_PARAMS
) {
636 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramParameters4dvNV");
639 for (i
= 0; i
< num
; i
++) {
640 ctx
->VertexProgram
.Parameters
[index
+ i
][0] = (GLfloat
) params
[0];
641 ctx
->VertexProgram
.Parameters
[index
+ i
][1] = (GLfloat
) params
[1];
642 ctx
->VertexProgram
.Parameters
[index
+ i
][2] = (GLfloat
) params
[2];
643 ctx
->VertexProgram
.Parameters
[index
+ i
][3] = (GLfloat
) params
[3];
648 _mesa_error(ctx
, GL_INVALID_ENUM
, "glProgramParameters4dvNV");
655 * Set a sequence of program parameter registers.
656 * \note Called from the GL API dispatcher.
659 _mesa_ProgramParameters4fvNV(GLenum target
, GLuint index
,
660 GLuint num
, const GLfloat
*params
)
662 GET_CURRENT_CONTEXT(ctx
);
663 ASSERT_OUTSIDE_BEGIN_END(ctx
);
665 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
667 if (index
+ num
> MAX_NV_VERTEX_PROGRAM_PARAMS
) {
668 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramParameters4fvNV");
671 for (i
= 0; i
< num
; i
++) {
672 COPY_4V(ctx
->VertexProgram
.Parameters
[index
+ i
], params
);
677 _mesa_error(ctx
, GL_INVALID_ENUM
, "glProgramParameters4fvNV");
685 * Setup tracking of matrices into program parameter registers.
686 * \note Called from the GL API dispatcher.
689 _mesa_TrackMatrixNV(GLenum target
, GLuint address
,
690 GLenum matrix
, GLenum transform
)
692 GET_CURRENT_CONTEXT(ctx
);
693 ASSERT_OUTSIDE_BEGIN_END(ctx
);
695 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
697 /* addr must be multiple of four */
698 _mesa_error(ctx
, GL_INVALID_VALUE
, "glTrackMatrixNV(address)");
708 case GL_MODELVIEW_PROJECTION_NV
:
717 /* OK, fallthrough */
720 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(matrix)");
727 case GL_TRANSPOSE_NV
:
728 case GL_INVERSE_TRANSPOSE_NV
:
729 /* OK, fallthrough */
732 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(transform)");
736 ctx
->VertexProgram
.TrackMatrix
[address
/ 4] = matrix
;
737 ctx
->VertexProgram
.TrackMatrixTransform
[address
/ 4] = transform
;
740 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(target)");
747 _mesa_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
748 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
750 struct program
*prog
;
751 struct fragment_program
*fragProg
;
754 GET_CURRENT_CONTEXT(ctx
);
755 ASSERT_OUTSIDE_BEGIN_END(ctx
);
757 prog
= (struct program
*) _mesa_HashLookup(ctx
->Shared
->Programs
, id
);
758 if (!prog
|| prog
->Target
!= GL_FRAGMENT_PROGRAM_NV
) {
759 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glProgramNamedParameterNV");
764 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramNamedParameterNV");
768 fragProg
= (struct fragment_program
*) prog
;
769 v
= _mesa_lookup_parameter_value(fragProg
->Parameters
, len
, (char *) name
);
778 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramNamedParameterNV");
783 _mesa_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
786 _mesa_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
791 _mesa_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
792 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
794 _mesa_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
)x
, (GLfloat
)y
,
795 (GLfloat
)z
, (GLfloat
)w
);
800 _mesa_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
803 _mesa_ProgramNamedParameter4fNV(id
, len
, name
,
804 (GLfloat
)v
[0], (GLfloat
)v
[1],
805 (GLfloat
)v
[2], (GLfloat
)v
[3]);
810 _mesa_GetProgramNamedParameterfvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
813 struct program
*prog
;
814 struct fragment_program
*fragProg
;
817 GET_CURRENT_CONTEXT(ctx
);
819 if (!ctx
->_CurrentProgram
)
820 ASSERT_OUTSIDE_BEGIN_END(ctx
);
822 prog
= (struct program
*) _mesa_HashLookup(ctx
->Shared
->Programs
, id
);
823 if (!prog
|| prog
->Target
!= GL_FRAGMENT_PROGRAM_NV
) {
824 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramNamedParameterNV");
829 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetProgramNamedParameterNV");
833 fragProg
= (struct fragment_program
*) prog
;
834 v
= _mesa_lookup_parameter_value(fragProg
->Parameters
, len
, (char *) name
);
843 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetProgramNamedParameterNV");
848 _mesa_GetProgramNamedParameterdvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
851 GLfloat floatParams
[4];
852 _mesa_GetProgramNamedParameterfvNV(id
, len
, name
, floatParams
);
853 COPY_4V(params
, floatParams
);