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.
46 #include "nvfragparse.h"
47 #include "program_instruction.h"
48 #include "nvvertexec.h"
49 #include "nvvertparse.h"
50 #include "nvprogram.h"
56 * Execute a vertex state program.
57 * \note Called from the GL API dispatcher.
60 _mesa_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
62 struct gl_vertex_program
*vprog
;
63 GET_CURRENT_CONTEXT(ctx
);
64 ASSERT_OUTSIDE_BEGIN_END(ctx
);
66 if (target
!= GL_VERTEX_STATE_PROGRAM_NV
) {
67 _mesa_error(ctx
, GL_INVALID_ENUM
, "glExecuteProgramNV");
71 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
73 vprog
= (struct gl_vertex_program
*) _mesa_lookup_program(ctx
, id
);
75 if (!vprog
|| vprog
->Base
.Target
!= GL_VERTEX_STATE_PROGRAM_NV
) {
76 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glExecuteProgramNV");
80 _mesa_init_vp_per_vertex_registers(ctx
);
81 _mesa_init_vp_per_primitive_registers(ctx
);
82 COPY_4V(ctx
->VertexProgram
.Machine
.Inputs
[VERT_ATTRIB_POS
], params
);
83 _mesa_exec_vertex_program(ctx
, vprog
);
88 * Determine if a set of programs is resident in hardware.
89 * \note Not compiled into display lists.
90 * \note Called from the GL API dispatcher.
93 _mesa_AreProgramsResidentNV(GLsizei n
, const GLuint
*ids
,
94 GLboolean
*residences
)
97 GLboolean allResident
= GL_TRUE
;
98 GET_CURRENT_CONTEXT(ctx
);
99 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
102 _mesa_error(ctx
, GL_INVALID_VALUE
, "glAreProgramsResidentNV(n)");
106 for (i
= 0; i
< n
; i
++) {
107 const struct gl_program
*prog
;
109 _mesa_error(ctx
, GL_INVALID_VALUE
, "glAreProgramsResidentNV");
112 prog
= _mesa_lookup_program(ctx
, ids
[i
]);
114 _mesa_error(ctx
, GL_INVALID_VALUE
, "glAreProgramsResidentNV");
117 if (prog
->Resident
) {
119 residences
[i
] = GL_TRUE
;
123 allResident
= GL_FALSE
;
124 for (j
= 0; j
< i
; j
++)
125 residences
[j
] = GL_TRUE
;
127 residences
[i
] = GL_FALSE
;
136 * Request that a set of programs be resident in hardware.
137 * \note Called from the GL API dispatcher.
140 _mesa_RequestResidentProgramsNV(GLsizei n
, const GLuint
*ids
)
143 GET_CURRENT_CONTEXT(ctx
);
144 ASSERT_OUTSIDE_BEGIN_END(ctx
);
147 _mesa_error(ctx
, GL_INVALID_VALUE
, "glRequestResidentProgramsNV(n)");
151 /* just error checking for now */
152 for (i
= 0; i
< n
; i
++) {
153 struct gl_program
*prog
;
156 _mesa_error(ctx
, GL_INVALID_VALUE
, "glRequestResidentProgramsNV(id)");
160 prog
= _mesa_lookup_program(ctx
, ids
[i
]);
162 _mesa_error(ctx
, GL_INVALID_VALUE
, "glRequestResidentProgramsNV(id)");
166 /* XXX this is really a hardware thing we should hook out */
167 prog
->Resident
= GL_TRUE
;
173 * Get a program parameter register.
174 * \note Not compiled into display lists.
175 * \note Called from the GL API dispatcher.
178 _mesa_GetProgramParameterfvNV(GLenum target
, GLuint index
,
179 GLenum pname
, GLfloat
*params
)
181 GET_CURRENT_CONTEXT(ctx
);
182 ASSERT_OUTSIDE_BEGIN_END(ctx
);
184 if (target
== GL_VERTEX_PROGRAM_NV
) {
185 if (pname
== GL_PROGRAM_PARAMETER_NV
) {
186 if (index
< MAX_NV_VERTEX_PROGRAM_PARAMS
) {
187 COPY_4V(params
, ctx
->VertexProgram
.Parameters
[index
]);
190 _mesa_error(ctx
, GL_INVALID_VALUE
,
191 "glGetProgramParameterfvNV(index)");
196 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterfvNV(pname)");
201 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterfvNV(target)");
208 * Get a program parameter register.
209 * \note Not compiled into display lists.
210 * \note Called from the GL API dispatcher.
213 _mesa_GetProgramParameterdvNV(GLenum target
, GLuint index
,
214 GLenum pname
, GLdouble
*params
)
216 GET_CURRENT_CONTEXT(ctx
);
217 ASSERT_OUTSIDE_BEGIN_END(ctx
);
219 if (target
== GL_VERTEX_PROGRAM_NV
) {
220 if (pname
== GL_PROGRAM_PARAMETER_NV
) {
221 if (index
< MAX_NV_VERTEX_PROGRAM_PARAMS
) {
222 COPY_4V(params
, ctx
->VertexProgram
.Parameters
[index
]);
225 _mesa_error(ctx
, GL_INVALID_VALUE
,
226 "glGetProgramParameterdvNV(index)");
231 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterdvNV(pname)");
236 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterdvNV(target)");
243 * Get a program attribute.
244 * \note Not compiled into display lists.
245 * \note Called from the GL API dispatcher.
248 _mesa_GetProgramivNV(GLuint id
, GLenum pname
, GLint
*params
)
250 struct gl_program
*prog
;
251 GET_CURRENT_CONTEXT(ctx
);
253 if (!ctx
->_CurrentProgram
)
254 ASSERT_OUTSIDE_BEGIN_END(ctx
);
256 prog
= _mesa_lookup_program(ctx
, id
);
258 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramivNV");
263 case GL_PROGRAM_TARGET_NV
:
264 *params
= prog
->Target
;
266 case GL_PROGRAM_LENGTH_NV
:
267 *params
= prog
->String
?(GLint
)_mesa_strlen((char *) prog
->String
) : 0;
269 case GL_PROGRAM_RESIDENT_NV
:
270 *params
= prog
->Resident
;
273 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramivNV(pname)");
280 * Get the program source code.
281 * \note Not compiled into display lists.
282 * \note Called from the GL API dispatcher.
285 _mesa_GetProgramStringNV(GLuint id
, GLenum pname
, GLubyte
*program
)
287 struct gl_program
*prog
;
288 GET_CURRENT_CONTEXT(ctx
);
290 if (!ctx
->_CurrentProgram
)
291 ASSERT_OUTSIDE_BEGIN_END(ctx
);
293 if (pname
!= GL_PROGRAM_STRING_NV
) {
294 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramStringNV(pname)");
298 prog
= _mesa_lookup_program(ctx
, id
);
300 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramStringNV");
305 MEMCPY(program
, prog
->String
, _mesa_strlen((char *) prog
->String
));
314 * Get matrix tracking information.
315 * \note Not compiled into display lists.
316 * \note Called from the GL API dispatcher.
319 _mesa_GetTrackMatrixivNV(GLenum target
, GLuint address
,
320 GLenum pname
, GLint
*params
)
322 GET_CURRENT_CONTEXT(ctx
);
323 ASSERT_OUTSIDE_BEGIN_END(ctx
);
325 if (target
== GL_VERTEX_PROGRAM_NV
326 && ctx
->Extensions
.NV_vertex_program
) {
329 if ((address
& 0x3) || address
>= MAX_NV_VERTEX_PROGRAM_PARAMS
) {
330 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetTrackMatrixivNV(address)");
337 case GL_TRACK_MATRIX_NV
:
338 params
[0] = (GLint
) ctx
->VertexProgram
.TrackMatrix
[i
];
340 case GL_TRACK_MATRIX_TRANSFORM_NV
:
341 params
[0] = (GLint
) ctx
->VertexProgram
.TrackMatrixTransform
[i
];
344 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTrackMatrixivNV");
349 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTrackMatrixivNV");
356 * Get a vertex (or vertex array) attribute.
357 * \note Not compiled into display lists.
358 * \note Called from the GL API dispatcher.
361 _mesa_GetVertexAttribdvNV(GLuint index
, GLenum pname
, GLdouble
*params
)
363 GET_CURRENT_CONTEXT(ctx
);
364 ASSERT_OUTSIDE_BEGIN_END(ctx
);
366 if (index
== 0 || index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
367 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
372 case GL_ATTRIB_ARRAY_SIZE_NV
:
373 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Size
;
375 case GL_ATTRIB_ARRAY_STRIDE_NV
:
376 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Stride
;
378 case GL_ATTRIB_ARRAY_TYPE_NV
:
379 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Type
;
381 case GL_CURRENT_ATTRIB_NV
:
382 FLUSH_CURRENT(ctx
, 0);
383 COPY_4V(params
, ctx
->Current
.Attrib
[index
]);
386 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
392 * Get a vertex (or vertex array) attribute.
393 * \note Not compiled into display lists.
394 * \note Called from the GL API dispatcher.
397 _mesa_GetVertexAttribfvNV(GLuint index
, GLenum pname
, GLfloat
*params
)
399 GET_CURRENT_CONTEXT(ctx
);
400 ASSERT_OUTSIDE_BEGIN_END(ctx
);
402 if (index
== 0 || index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
403 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
408 case GL_ATTRIB_ARRAY_SIZE_NV
:
409 params
[0] = (GLfloat
) ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Size
;
411 case GL_ATTRIB_ARRAY_STRIDE_NV
:
412 params
[0] = (GLfloat
) ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Stride
;
414 case GL_ATTRIB_ARRAY_TYPE_NV
:
415 params
[0] = (GLfloat
) ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Type
;
417 case GL_CURRENT_ATTRIB_NV
:
418 FLUSH_CURRENT(ctx
, 0);
419 COPY_4V(params
, ctx
->Current
.Attrib
[index
]);
422 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
428 * Get a vertex (or vertex array) attribute.
429 * \note Not compiled into display lists.
430 * \note Called from the GL API dispatcher.
433 _mesa_GetVertexAttribivNV(GLuint index
, GLenum pname
, GLint
*params
)
435 GET_CURRENT_CONTEXT(ctx
);
436 ASSERT_OUTSIDE_BEGIN_END(ctx
);
438 if (index
== 0 || index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
439 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
444 case GL_ATTRIB_ARRAY_SIZE_NV
:
445 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Size
;
447 case GL_ATTRIB_ARRAY_STRIDE_NV
:
448 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Stride
;
450 case GL_ATTRIB_ARRAY_TYPE_NV
:
451 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Type
;
453 case GL_CURRENT_ATTRIB_NV
:
454 FLUSH_CURRENT(ctx
, 0);
455 params
[0] = (GLint
) ctx
->Current
.Attrib
[index
][0];
456 params
[1] = (GLint
) ctx
->Current
.Attrib
[index
][1];
457 params
[2] = (GLint
) ctx
->Current
.Attrib
[index
][2];
458 params
[3] = (GLint
) ctx
->Current
.Attrib
[index
][3];
460 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB
:
461 if (!ctx
->Extensions
.ARB_vertex_buffer_object
) {
462 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
465 params
[0] = ctx
->Array
.ArrayObj
->VertexAttrib
[index
].BufferObj
->Name
;
468 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
475 * Get a vertex array attribute pointer.
476 * \note Not compiled into display lists.
477 * \note Called from the GL API dispatcher.
480 _mesa_GetVertexAttribPointervNV(GLuint index
, GLenum pname
, GLvoid
**pointer
)
482 GET_CURRENT_CONTEXT(ctx
);
483 ASSERT_OUTSIDE_BEGIN_END(ctx
);
485 if (index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
486 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribPointerNV(index)");
490 if (pname
!= GL_ATTRIB_ARRAY_POINTER_NV
) {
491 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribPointerNV(pname)");
495 *pointer
= (GLvoid
*) ctx
->Array
.ArrayObj
->VertexAttrib
[index
].Ptr
;
501 * Load/parse/compile a program.
502 * \note Called from the GL API dispatcher.
505 _mesa_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
506 const GLubyte
*program
)
508 struct gl_program
*prog
;
509 GET_CURRENT_CONTEXT(ctx
);
510 ASSERT_OUTSIDE_BEGIN_END(ctx
);
513 _mesa_error(ctx
, GL_INVALID_VALUE
, "glLoadProgramNV(id)");
518 _mesa_error(ctx
, GL_INVALID_VALUE
, "glLoadProgramNV(len)");
522 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
524 prog
= _mesa_lookup_program(ctx
, id
);
526 if (prog
&& prog
->Target
!= 0 && prog
->Target
!= target
) {
527 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glLoadProgramNV(target)");
531 if ((target
== GL_VERTEX_PROGRAM_NV
||
532 target
== GL_VERTEX_STATE_PROGRAM_NV
)
533 && ctx
->Extensions
.NV_vertex_program
) {
534 struct gl_vertex_program
*vprog
= (struct gl_vertex_program
*) prog
;
535 if (!vprog
|| prog
== &_mesa_DummyProgram
) {
536 vprog
= (struct gl_vertex_program
*)
537 ctx
->Driver
.NewProgram(ctx
, target
, id
);
539 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
542 _mesa_HashInsert(ctx
->Shared
->Programs
, id
, vprog
);
544 _mesa_parse_nv_vertex_program(ctx
, target
, program
, len
, vprog
);
546 else if (target
== GL_FRAGMENT_PROGRAM_NV
547 && ctx
->Extensions
.NV_fragment_program
) {
548 struct gl_fragment_program
*fprog
= (struct gl_fragment_program
*) prog
;
549 if (!fprog
|| prog
== &_mesa_DummyProgram
) {
550 fprog
= (struct gl_fragment_program
*)
551 ctx
->Driver
.NewProgram(ctx
, target
, id
);
553 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
556 _mesa_HashInsert(ctx
->Shared
->Programs
, id
, fprog
);
558 _mesa_parse_nv_fragment_program(ctx
, target
, program
, len
, fprog
);
561 _mesa_error(ctx
, GL_INVALID_ENUM
, "glLoadProgramNV(target)");
568 * Set a program parameter register.
569 * \note Called from the GL API dispatcher.
572 _mesa_ProgramParameter4dNV(GLenum target
, GLuint index
,
573 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
575 _mesa_ProgramParameter4fNV(target
, index
,
576 (GLfloat
)x
, (GLfloat
)y
, (GLfloat
)z
, (GLfloat
)w
);
581 * Set a program parameter register.
582 * \note Called from the GL API dispatcher.
585 _mesa_ProgramParameter4dvNV(GLenum target
, GLuint index
,
586 const GLdouble
*params
)
588 _mesa_ProgramParameter4fNV(target
, index
,
589 (GLfloat
)params
[0], (GLfloat
)params
[1],
590 (GLfloat
)params
[2], (GLfloat
)params
[3]);
595 * Set a program parameter register.
596 * \note Called from the GL API dispatcher.
599 _mesa_ProgramParameter4fNV(GLenum target
, GLuint index
,
600 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
602 GET_CURRENT_CONTEXT(ctx
);
603 ASSERT_OUTSIDE_BEGIN_END(ctx
);
605 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
606 if (index
< MAX_NV_VERTEX_PROGRAM_PARAMS
) {
607 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
608 ASSIGN_4V(ctx
->VertexProgram
.Parameters
[index
], x
, y
, z
, w
);
611 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramParameterNV(index)");
616 _mesa_error(ctx
, GL_INVALID_ENUM
, "glProgramParameterNV");
623 * Set a program parameter register.
624 * \note Called from the GL API dispatcher.
627 _mesa_ProgramParameter4fvNV(GLenum target
, GLuint index
,
628 const GLfloat
*params
)
630 _mesa_ProgramParameter4fNV(target
, index
,
631 params
[0], params
[1], params
[2], params
[3]);
637 * Set a sequence of program parameter registers.
638 * \note Called from the GL API dispatcher.
641 _mesa_ProgramParameters4dvNV(GLenum target
, GLuint index
,
642 GLuint num
, const GLdouble
*params
)
644 GET_CURRENT_CONTEXT(ctx
);
645 ASSERT_OUTSIDE_BEGIN_END(ctx
);
647 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
649 if (index
+ num
> MAX_NV_VERTEX_PROGRAM_PARAMS
) {
650 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramParameters4dvNV");
653 for (i
= 0; i
< num
; i
++) {
654 ctx
->VertexProgram
.Parameters
[index
+ i
][0] = (GLfloat
) params
[0];
655 ctx
->VertexProgram
.Parameters
[index
+ i
][1] = (GLfloat
) params
[1];
656 ctx
->VertexProgram
.Parameters
[index
+ i
][2] = (GLfloat
) params
[2];
657 ctx
->VertexProgram
.Parameters
[index
+ i
][3] = (GLfloat
) params
[3];
662 _mesa_error(ctx
, GL_INVALID_ENUM
, "glProgramParameters4dvNV");
669 * Set a sequence of program parameter registers.
670 * \note Called from the GL API dispatcher.
673 _mesa_ProgramParameters4fvNV(GLenum target
, GLuint index
,
674 GLuint num
, const GLfloat
*params
)
676 GET_CURRENT_CONTEXT(ctx
);
677 ASSERT_OUTSIDE_BEGIN_END(ctx
);
679 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
681 if (index
+ num
> MAX_NV_VERTEX_PROGRAM_PARAMS
) {
682 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramParameters4fvNV");
685 for (i
= 0; i
< num
; i
++) {
686 COPY_4V(ctx
->VertexProgram
.Parameters
[index
+ i
], params
);
691 _mesa_error(ctx
, GL_INVALID_ENUM
, "glProgramParameters4fvNV");
699 * Setup tracking of matrices into program parameter registers.
700 * \note Called from the GL API dispatcher.
703 _mesa_TrackMatrixNV(GLenum target
, GLuint address
,
704 GLenum matrix
, GLenum transform
)
706 GET_CURRENT_CONTEXT(ctx
);
707 ASSERT_OUTSIDE_BEGIN_END(ctx
);
709 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
711 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
713 /* addr must be multiple of four */
714 _mesa_error(ctx
, GL_INVALID_VALUE
, "glTrackMatrixNV(address)");
724 case GL_MODELVIEW_PROJECTION_NV
:
733 /* OK, fallthrough */
736 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(matrix)");
743 case GL_TRANSPOSE_NV
:
744 case GL_INVERSE_TRANSPOSE_NV
:
745 /* OK, fallthrough */
748 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(transform)");
752 ctx
->VertexProgram
.TrackMatrix
[address
/ 4] = matrix
;
753 ctx
->VertexProgram
.TrackMatrixTransform
[address
/ 4] = transform
;
756 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(target)");
763 _mesa_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
764 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
766 struct gl_program
*prog
;
767 struct gl_fragment_program
*fragProg
;
770 GET_CURRENT_CONTEXT(ctx
);
771 ASSERT_OUTSIDE_BEGIN_END(ctx
);
773 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
775 prog
= _mesa_lookup_program(ctx
, id
);
776 if (!prog
|| prog
->Target
!= GL_FRAGMENT_PROGRAM_NV
) {
777 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glProgramNamedParameterNV");
782 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramNamedParameterNV(len)");
786 fragProg
= (struct gl_fragment_program
*) prog
;
787 v
= _mesa_lookup_parameter_value(fragProg
->Base
.Parameters
, len
,
797 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramNamedParameterNV(name)");
802 _mesa_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
805 _mesa_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
810 _mesa_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
811 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
813 _mesa_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
)x
, (GLfloat
)y
,
814 (GLfloat
)z
, (GLfloat
)w
);
819 _mesa_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
822 _mesa_ProgramNamedParameter4fNV(id
, len
, name
,
823 (GLfloat
)v
[0], (GLfloat
)v
[1],
824 (GLfloat
)v
[2], (GLfloat
)v
[3]);
829 _mesa_GetProgramNamedParameterfvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
832 struct gl_program
*prog
;
833 struct gl_fragment_program
*fragProg
;
836 GET_CURRENT_CONTEXT(ctx
);
838 if (!ctx
->_CurrentProgram
)
839 ASSERT_OUTSIDE_BEGIN_END(ctx
);
841 prog
= _mesa_lookup_program(ctx
, id
);
842 if (!prog
|| prog
->Target
!= GL_FRAGMENT_PROGRAM_NV
) {
843 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramNamedParameterNV");
848 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetProgramNamedParameterNV");
852 fragProg
= (struct gl_fragment_program
*) prog
;
853 v
= _mesa_lookup_parameter_value(fragProg
->Base
.Parameters
,
863 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetProgramNamedParameterNV");
868 _mesa_GetProgramNamedParameterdvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
871 GLfloat floatParams
[4];
872 _mesa_GetProgramNamedParameterfvNV(id
, len
, name
, floatParams
);
873 COPY_4V(params
, floatParams
);