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 ASSERT_OUTSIDE_BEGIN_END(ctx
);
251 prog
= _mesa_lookup_program(ctx
, id
);
253 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramivNV");
258 case GL_PROGRAM_TARGET_NV
:
259 *params
= prog
->Target
;
261 case GL_PROGRAM_LENGTH_NV
:
262 *params
= prog
->String
?(GLint
)_mesa_strlen((char *) prog
->String
) : 0;
264 case GL_PROGRAM_RESIDENT_NV
:
265 *params
= prog
->Resident
;
268 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramivNV(pname)");
275 * Get the program source code.
276 * \note Not compiled into display lists.
277 * \note Called from the GL API dispatcher.
280 _mesa_GetProgramStringNV(GLuint id
, GLenum pname
, GLubyte
*program
)
282 struct gl_program
*prog
;
283 GET_CURRENT_CONTEXT(ctx
);
285 ASSERT_OUTSIDE_BEGIN_END(ctx
);
287 if (pname
!= GL_PROGRAM_STRING_NV
) {
288 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramStringNV(pname)");
292 prog
= _mesa_lookup_program(ctx
, id
);
294 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramStringNV");
299 MEMCPY(program
, prog
->String
, _mesa_strlen((char *) prog
->String
));
308 * Get matrix tracking information.
309 * \note Not compiled into display lists.
310 * \note Called from the GL API dispatcher.
313 _mesa_GetTrackMatrixivNV(GLenum target
, GLuint address
,
314 GLenum pname
, GLint
*params
)
316 GET_CURRENT_CONTEXT(ctx
);
317 ASSERT_OUTSIDE_BEGIN_END(ctx
);
319 if (target
== GL_VERTEX_PROGRAM_NV
320 && ctx
->Extensions
.NV_vertex_program
) {
323 if ((address
& 0x3) || address
>= MAX_NV_VERTEX_PROGRAM_PARAMS
) {
324 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetTrackMatrixivNV(address)");
331 case GL_TRACK_MATRIX_NV
:
332 params
[0] = (GLint
) ctx
->VertexProgram
.TrackMatrix
[i
];
334 case GL_TRACK_MATRIX_TRANSFORM_NV
:
335 params
[0] = (GLint
) ctx
->VertexProgram
.TrackMatrixTransform
[i
];
338 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTrackMatrixivNV");
343 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTrackMatrixivNV");
350 * Get a vertex (or vertex array) attribute.
351 * \note Not compiled into display lists.
352 * \note Called from the GL API dispatcher.
355 _mesa_GetVertexAttribdvNV(GLuint index
, GLenum pname
, GLdouble
*params
)
357 const struct gl_client_array
*array
;
358 GET_CURRENT_CONTEXT(ctx
);
359 ASSERT_OUTSIDE_BEGIN_END(ctx
);
361 if (index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
362 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
366 array
= &ctx
->Array
.ArrayObj
->VertexAttrib
[index
];
369 case GL_ATTRIB_ARRAY_SIZE_NV
:
370 params
[0] = array
->Size
;
372 case GL_ATTRIB_ARRAY_STRIDE_NV
:
373 params
[0] = array
->Stride
;
375 case GL_ATTRIB_ARRAY_TYPE_NV
:
376 params
[0] = array
->Type
;
378 case GL_CURRENT_ATTRIB_NV
:
380 _mesa_error(ctx
, GL_INVALID_OPERATION
,
381 "glGetVertexAttribdvNV(index == 0)");
384 FLUSH_CURRENT(ctx
, 0);
385 COPY_4V(params
, ctx
->Current
.Attrib
[index
]);
388 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
394 * Get a vertex (or vertex array) attribute.
395 * \note Not compiled into display lists.
396 * \note Called from the GL API dispatcher.
399 _mesa_GetVertexAttribfvNV(GLuint index
, GLenum pname
, GLfloat
*params
)
401 const struct gl_client_array
*array
;
402 GET_CURRENT_CONTEXT(ctx
);
403 ASSERT_OUTSIDE_BEGIN_END(ctx
);
405 if (index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
406 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
410 array
= &ctx
->Array
.ArrayObj
->VertexAttrib
[index
];
413 case GL_ATTRIB_ARRAY_SIZE_NV
:
414 params
[0] = (GLfloat
) array
->Size
;
416 case GL_ATTRIB_ARRAY_STRIDE_NV
:
417 params
[0] = (GLfloat
) array
->Stride
;
419 case GL_ATTRIB_ARRAY_TYPE_NV
:
420 params
[0] = (GLfloat
) array
->Type
;
422 case GL_CURRENT_ATTRIB_NV
:
424 _mesa_error(ctx
, GL_INVALID_OPERATION
,
425 "glGetVertexAttribfvNV(index == 0)");
428 FLUSH_CURRENT(ctx
, 0);
429 COPY_4V(params
, ctx
->Current
.Attrib
[index
]);
432 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
438 * Get a vertex (or vertex array) attribute.
439 * \note Not compiled into display lists.
440 * \note Called from the GL API dispatcher.
443 _mesa_GetVertexAttribivNV(GLuint index
, GLenum pname
, GLint
*params
)
445 const struct gl_client_array
*array
;
446 GET_CURRENT_CONTEXT(ctx
);
447 ASSERT_OUTSIDE_BEGIN_END(ctx
);
449 if (index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
450 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
454 array
= &ctx
->Array
.ArrayObj
->VertexAttrib
[index
];
457 case GL_ATTRIB_ARRAY_SIZE_NV
:
458 params
[0] = array
->Size
;
460 case GL_ATTRIB_ARRAY_STRIDE_NV
:
461 params
[0] = array
->Stride
;
463 case GL_ATTRIB_ARRAY_TYPE_NV
:
464 params
[0] = array
->Type
;
466 case GL_CURRENT_ATTRIB_NV
:
468 _mesa_error(ctx
, GL_INVALID_OPERATION
,
469 "glGetVertexAttribivNV(index == 0)");
472 FLUSH_CURRENT(ctx
, 0);
473 params
[0] = (GLint
) ctx
->Current
.Attrib
[index
][0];
474 params
[1] = (GLint
) ctx
->Current
.Attrib
[index
][1];
475 params
[2] = (GLint
) ctx
->Current
.Attrib
[index
][2];
476 params
[3] = (GLint
) ctx
->Current
.Attrib
[index
][3];
478 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB
:
479 params
[0] = array
->BufferObj
->Name
;
482 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
489 * Get a vertex array attribute pointer.
490 * \note Not compiled into display lists.
491 * \note Called from the GL API dispatcher.
494 _mesa_GetVertexAttribPointervNV(GLuint index
, GLenum pname
, GLvoid
**pointer
)
496 GET_CURRENT_CONTEXT(ctx
);
497 ASSERT_OUTSIDE_BEGIN_END(ctx
);
499 if (index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
500 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribPointerNV(index)");
504 if (pname
!= GL_ATTRIB_ARRAY_POINTER_NV
) {
505 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribPointerNV(pname)");
509 *pointer
= (GLvoid
*) ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Ptr
;
515 * Load/parse/compile a program.
516 * \note Called from the GL API dispatcher.
519 _mesa_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
520 const GLubyte
*program
)
522 struct gl_program
*prog
;
523 GET_CURRENT_CONTEXT(ctx
);
524 ASSERT_OUTSIDE_BEGIN_END(ctx
);
527 _mesa_error(ctx
, GL_INVALID_VALUE
, "glLoadProgramNV(id)");
532 _mesa_error(ctx
, GL_INVALID_VALUE
, "glLoadProgramNV(len)");
536 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
538 prog
= _mesa_lookup_program(ctx
, id
);
540 if (prog
&& prog
->Target
!= 0 && prog
->Target
!= target
) {
541 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glLoadProgramNV(target)");
545 if ((target
== GL_VERTEX_PROGRAM_NV
||
546 target
== GL_VERTEX_STATE_PROGRAM_NV
)
547 && ctx
->Extensions
.NV_vertex_program
) {
548 struct gl_vertex_program
*vprog
= (struct gl_vertex_program
*) prog
;
549 if (!vprog
|| prog
== &_mesa_DummyProgram
) {
550 vprog
= (struct gl_vertex_program
*)
551 ctx
->Driver
.NewProgram(ctx
, target
, id
);
553 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
556 _mesa_HashInsert(ctx
->Shared
->Programs
, id
, vprog
);
558 _mesa_parse_nv_vertex_program(ctx
, target
, program
, len
, vprog
);
560 else if (target
== GL_FRAGMENT_PROGRAM_NV
561 && ctx
->Extensions
.NV_fragment_program
) {
562 struct gl_fragment_program
*fprog
= (struct gl_fragment_program
*) prog
;
563 if (!fprog
|| prog
== &_mesa_DummyProgram
) {
564 fprog
= (struct gl_fragment_program
*)
565 ctx
->Driver
.NewProgram(ctx
, target
, id
);
567 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
570 _mesa_HashInsert(ctx
->Shared
->Programs
, id
, fprog
);
572 _mesa_parse_nv_fragment_program(ctx
, target
, program
, len
, fprog
);
575 _mesa_error(ctx
, GL_INVALID_ENUM
, "glLoadProgramNV(target)");
582 * Set a sequence of program parameter registers.
583 * \note Called from the GL API dispatcher.
586 _mesa_ProgramParameters4dvNV(GLenum target
, GLuint index
,
587 GLuint num
, const GLdouble
*params
)
589 GET_CURRENT_CONTEXT(ctx
);
590 ASSERT_OUTSIDE_BEGIN_END(ctx
);
592 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
594 if (index
+ num
> MAX_NV_VERTEX_PROGRAM_PARAMS
) {
595 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramParameters4dvNV");
598 for (i
= 0; i
< num
; i
++) {
599 ctx
->VertexProgram
.Parameters
[index
+ i
][0] = (GLfloat
) params
[0];
600 ctx
->VertexProgram
.Parameters
[index
+ i
][1] = (GLfloat
) params
[1];
601 ctx
->VertexProgram
.Parameters
[index
+ i
][2] = (GLfloat
) params
[2];
602 ctx
->VertexProgram
.Parameters
[index
+ i
][3] = (GLfloat
) params
[3];
607 _mesa_error(ctx
, GL_INVALID_ENUM
, "glProgramParameters4dvNV");
614 * Set a sequence of program parameter registers.
615 * \note Called from the GL API dispatcher.
618 _mesa_ProgramParameters4fvNV(GLenum target
, GLuint index
,
619 GLuint num
, const GLfloat
*params
)
621 GET_CURRENT_CONTEXT(ctx
);
622 ASSERT_OUTSIDE_BEGIN_END(ctx
);
624 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
626 if (index
+ num
> MAX_NV_VERTEX_PROGRAM_PARAMS
) {
627 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramParameters4fvNV");
630 for (i
= 0; i
< num
; i
++) {
631 COPY_4V(ctx
->VertexProgram
.Parameters
[index
+ i
], params
);
636 _mesa_error(ctx
, GL_INVALID_ENUM
, "glProgramParameters4fvNV");
644 * Setup tracking of matrices into program parameter registers.
645 * \note Called from the GL API dispatcher.
648 _mesa_TrackMatrixNV(GLenum target
, GLuint address
,
649 GLenum matrix
, GLenum transform
)
651 GET_CURRENT_CONTEXT(ctx
);
652 ASSERT_OUTSIDE_BEGIN_END(ctx
);
654 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
656 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
658 /* addr must be multiple of four */
659 _mesa_error(ctx
, GL_INVALID_VALUE
, "glTrackMatrixNV(address)");
669 case GL_MODELVIEW_PROJECTION_NV
:
678 /* OK, fallthrough */
681 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(matrix)");
688 case GL_TRANSPOSE_NV
:
689 case GL_INVERSE_TRANSPOSE_NV
:
690 /* OK, fallthrough */
693 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(transform)");
697 ctx
->VertexProgram
.TrackMatrix
[address
/ 4] = matrix
;
698 ctx
->VertexProgram
.TrackMatrixTransform
[address
/ 4] = transform
;
701 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(target)");
708 _mesa_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
709 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
711 struct gl_program
*prog
;
712 struct gl_fragment_program
*fragProg
;
715 GET_CURRENT_CONTEXT(ctx
);
716 ASSERT_OUTSIDE_BEGIN_END(ctx
);
718 FLUSH_VERTICES(ctx
, _NEW_PROGRAM_CONSTANTS
);
720 prog
= _mesa_lookup_program(ctx
, id
);
721 if (!prog
|| prog
->Target
!= GL_FRAGMENT_PROGRAM_NV
) {
722 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glProgramNamedParameterNV");
727 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramNamedParameterNV(len)");
731 fragProg
= (struct gl_fragment_program
*) prog
;
732 v
= _mesa_lookup_parameter_value(fragProg
->Base
.Parameters
, len
,
742 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramNamedParameterNV(name)");
747 _mesa_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
750 _mesa_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
755 _mesa_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
756 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
758 _mesa_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
)x
, (GLfloat
)y
,
759 (GLfloat
)z
, (GLfloat
)w
);
764 _mesa_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
767 _mesa_ProgramNamedParameter4fNV(id
, len
, name
,
768 (GLfloat
)v
[0], (GLfloat
)v
[1],
769 (GLfloat
)v
[2], (GLfloat
)v
[3]);
774 _mesa_GetProgramNamedParameterfvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
777 struct gl_program
*prog
;
778 struct gl_fragment_program
*fragProg
;
781 GET_CURRENT_CONTEXT(ctx
);
783 ASSERT_OUTSIDE_BEGIN_END(ctx
);
785 prog
= _mesa_lookup_program(ctx
, id
);
786 if (!prog
|| prog
->Target
!= GL_FRAGMENT_PROGRAM_NV
) {
787 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramNamedParameterNV");
792 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetProgramNamedParameterNV");
796 fragProg
= (struct gl_fragment_program
*) prog
;
797 v
= _mesa_lookup_parameter_value(fragProg
->Base
.Parameters
,
807 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetProgramNamedParameterNV");
812 _mesa_GetProgramNamedParameterdvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
815 GLfloat floatParams
[4];
816 _mesa_GetProgramNamedParameterfvNV(id
, len
, name
, floatParams
);
817 COPY_4V(params
, floatParams
);