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 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 vertex_program
*)
74 _mesa_HashLookup(ctx
->Shared
->Programs
, id
);
76 if (!vprog
|| vprog
->Base
.Target
!= GL_VERTEX_STATE_PROGRAM_NV
) {
77 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glExecuteProgramNV");
81 _mesa_init_vp_per_vertex_registers(ctx
);
82 _mesa_init_vp_per_primitive_registers(ctx
);
83 COPY_4V(ctx
->VertexProgram
.Inputs
[VERT_ATTRIB_POS
], params
);
84 _mesa_exec_vertex_program(ctx
, vprog
);
89 * Determine if a set of programs is resident in hardware.
90 * \note Not compiled into display lists.
91 * \note Called from the GL API dispatcher.
93 GLboolean GLAPIENTRY
_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 program
*prog
;
109 _mesa_error(ctx
, GL_INVALID_VALUE
, "glAreProgramsResidentNV");
112 prog
= (const struct program
*)
113 _mesa_HashLookup(ctx
->Shared
->Programs
, ids
[i
]);
115 _mesa_error(ctx
, GL_INVALID_VALUE
, "glAreProgramsResidentNV");
118 if (prog
->Resident
) {
120 residences
[i
] = GL_TRUE
;
124 allResident
= GL_FALSE
;
125 for (j
= 0; j
< i
; j
++)
126 residences
[j
] = GL_TRUE
;
128 residences
[i
] = GL_FALSE
;
137 * Request that a set of programs be resident in hardware.
138 * \note Called from the GL API dispatcher.
141 _mesa_RequestResidentProgramsNV(GLsizei n
, const GLuint
*ids
)
144 GET_CURRENT_CONTEXT(ctx
);
145 ASSERT_OUTSIDE_BEGIN_END(ctx
);
148 _mesa_error(ctx
, GL_INVALID_VALUE
, "glRequestResidentProgramsNV(n)");
152 /* just error checking for now */
153 for (i
= 0; i
< n
; i
++) {
154 struct program
*prog
;
157 _mesa_error(ctx
, GL_INVALID_VALUE
, "glRequestResidentProgramsNV(id)");
161 prog
= (struct program
*) _mesa_HashLookup(ctx
->Shared
->Programs
, ids
[i
]);
163 _mesa_error(ctx
, GL_INVALID_VALUE
, "glRequestResidentProgramsNV(id)");
167 /* XXX this is really a hardware thing we should hook out */
168 prog
->Resident
= GL_TRUE
;
174 * Get a program parameter register.
175 * \note Not compiled into display lists.
176 * \note Called from the GL API dispatcher.
179 _mesa_GetProgramParameterfvNV(GLenum target
, GLuint index
,
180 GLenum pname
, GLfloat
*params
)
182 GET_CURRENT_CONTEXT(ctx
);
183 ASSERT_OUTSIDE_BEGIN_END(ctx
);
185 if (target
== GL_VERTEX_PROGRAM_NV
) {
186 if (pname
== GL_PROGRAM_PARAMETER_NV
) {
187 if (index
< MAX_NV_VERTEX_PROGRAM_PARAMS
) {
188 COPY_4V(params
, ctx
->VertexProgram
.Parameters
[index
]);
191 _mesa_error(ctx
, GL_INVALID_VALUE
,
192 "glGetProgramParameterfvNV(index)");
197 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterfvNV(pname)");
202 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterfvNV(target)");
209 * Get a program parameter register.
210 * \note Not compiled into display lists.
211 * \note Called from the GL API dispatcher.
214 _mesa_GetProgramParameterdvNV(GLenum target
, GLuint index
,
215 GLenum pname
, GLdouble
*params
)
217 GET_CURRENT_CONTEXT(ctx
);
218 ASSERT_OUTSIDE_BEGIN_END(ctx
);
220 if (target
== GL_VERTEX_PROGRAM_NV
) {
221 if (pname
== GL_PROGRAM_PARAMETER_NV
) {
222 if (index
< MAX_NV_VERTEX_PROGRAM_PARAMS
) {
223 COPY_4V(params
, ctx
->VertexProgram
.Parameters
[index
]);
226 _mesa_error(ctx
, GL_INVALID_VALUE
,
227 "glGetProgramParameterdvNV(index)");
232 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterdvNV(pname)");
237 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramParameterdvNV(target)");
244 * Get a program attribute.
245 * \note Not compiled into display lists.
246 * \note Called from the GL API dispatcher.
249 _mesa_GetProgramivNV(GLuint id
, GLenum pname
, GLint
*params
)
251 struct program
*prog
;
252 GET_CURRENT_CONTEXT(ctx
);
254 if (!ctx
->_CurrentProgram
)
255 ASSERT_OUTSIDE_BEGIN_END(ctx
);
257 prog
= (struct program
*) _mesa_HashLookup(ctx
->Shared
->Programs
, id
);
259 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramivNV");
264 case GL_PROGRAM_TARGET_NV
:
265 *params
= prog
->Target
;
267 case GL_PROGRAM_LENGTH_NV
:
268 *params
= prog
->String
?(GLint
)_mesa_strlen((char *) prog
->String
) : 0;
270 case GL_PROGRAM_RESIDENT_NV
:
271 *params
= prog
->Resident
;
274 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramivNV(pname)");
281 * Get the program source code.
282 * \note Not compiled into display lists.
283 * \note Called from the GL API dispatcher.
286 _mesa_GetProgramStringNV(GLuint id
, GLenum pname
, GLubyte
*program
)
288 struct program
*prog
;
289 GET_CURRENT_CONTEXT(ctx
);
291 if (!ctx
->_CurrentProgram
)
292 ASSERT_OUTSIDE_BEGIN_END(ctx
);
294 if (pname
!= GL_PROGRAM_STRING_NV
) {
295 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramStringNV(pname)");
299 prog
= (struct program
*) _mesa_HashLookup(ctx
->Shared
->Programs
, id
);
301 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramStringNV");
306 MEMCPY(program
, prog
->String
, _mesa_strlen((char *) prog
->String
));
315 * Get matrix tracking information.
316 * \note Not compiled into display lists.
317 * \note Called from the GL API dispatcher.
320 _mesa_GetTrackMatrixivNV(GLenum target
, GLuint address
,
321 GLenum pname
, GLint
*params
)
323 GET_CURRENT_CONTEXT(ctx
);
324 ASSERT_OUTSIDE_BEGIN_END(ctx
);
326 if (target
== GL_VERTEX_PROGRAM_NV
327 && ctx
->Extensions
.NV_vertex_program
) {
330 if ((address
& 0x3) || address
>= MAX_NV_VERTEX_PROGRAM_PARAMS
) {
331 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetTrackMatrixivNV(address)");
338 case GL_TRACK_MATRIX_NV
:
339 params
[0] = (GLint
) ctx
->VertexProgram
.TrackMatrix
[i
];
341 case GL_TRACK_MATRIX_TRANSFORM_NV
:
342 params
[0] = (GLint
) ctx
->VertexProgram
.TrackMatrixTransform
[i
];
345 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTrackMatrixivNV");
350 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTrackMatrixivNV");
357 * Get a vertex (or vertex array) attribute.
358 * \note Not compiled into display lists.
359 * \note Called from the GL API dispatcher.
362 _mesa_GetVertexAttribdvNV(GLuint index
, GLenum pname
, GLdouble
*params
)
364 GET_CURRENT_CONTEXT(ctx
);
365 ASSERT_OUTSIDE_BEGIN_END(ctx
);
367 if (index
== 0 || index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
368 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
373 case GL_ATTRIB_ARRAY_SIZE_NV
:
374 params
[0] = ctx
->Array
.VertexAttrib
[index
].Size
;
376 case GL_ATTRIB_ARRAY_STRIDE_NV
:
377 params
[0] = ctx
->Array
.VertexAttrib
[index
].Stride
;
379 case GL_ATTRIB_ARRAY_TYPE_NV
:
380 params
[0] = ctx
->Array
.VertexAttrib
[index
].Type
;
382 case GL_CURRENT_ATTRIB_NV
:
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
== 0 || 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
.VertexAttrib
[index
].Size
;
412 case GL_ATTRIB_ARRAY_STRIDE_NV
:
413 params
[0] = (GLfloat
) ctx
->Array
.VertexAttrib
[index
].Stride
;
415 case GL_ATTRIB_ARRAY_TYPE_NV
:
416 params
[0] = (GLfloat
) ctx
->Array
.VertexAttrib
[index
].Type
;
418 case GL_CURRENT_ATTRIB_NV
:
419 FLUSH_CURRENT(ctx
, 0);
420 COPY_4V(params
, ctx
->Current
.Attrib
[index
]);
423 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
429 * Get a vertex (or vertex array) attribute.
430 * \note Not compiled into display lists.
431 * \note Called from the GL API dispatcher.
434 _mesa_GetVertexAttribivNV(GLuint index
, GLenum pname
, GLint
*params
)
436 GET_CURRENT_CONTEXT(ctx
);
437 ASSERT_OUTSIDE_BEGIN_END(ctx
);
439 if (index
== 0 || index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
440 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribdvNV(index)");
445 case GL_ATTRIB_ARRAY_SIZE_NV
:
446 params
[0] = ctx
->Array
.VertexAttrib
[index
].Size
;
448 case GL_ATTRIB_ARRAY_STRIDE_NV
:
449 params
[0] = ctx
->Array
.VertexAttrib
[index
].Stride
;
451 case GL_ATTRIB_ARRAY_TYPE_NV
:
452 params
[0] = ctx
->Array
.VertexAttrib
[index
].Type
;
454 case GL_CURRENT_ATTRIB_NV
:
455 FLUSH_CURRENT(ctx
, 0);
456 params
[0] = (GLint
) ctx
->Current
.Attrib
[index
][0];
457 params
[1] = (GLint
) ctx
->Current
.Attrib
[index
][1];
458 params
[2] = (GLint
) ctx
->Current
.Attrib
[index
][2];
459 params
[3] = (GLint
) ctx
->Current
.Attrib
[index
][3];
461 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB
:
462 if (!ctx
->Extensions
.ARB_vertex_buffer_object
) {
463 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
466 params
[0] = ctx
->Array
.VertexAttrib
[index
].BufferObj
->Name
;
469 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribdvNV");
476 * Get a vertex array attribute pointer.
477 * \note Not compiled into display lists.
478 * \note Called from the GL API dispatcher.
481 _mesa_GetVertexAttribPointervNV(GLuint index
, GLenum pname
, GLvoid
**pointer
)
483 GET_CURRENT_CONTEXT(ctx
);
484 ASSERT_OUTSIDE_BEGIN_END(ctx
);
486 if (index
>= MAX_NV_VERTEX_PROGRAM_INPUTS
) {
487 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetVertexAttribPointerNV(index)");
491 if (pname
!= GL_ATTRIB_ARRAY_POINTER_NV
) {
492 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetVertexAttribPointerNV(pname)");
496 *pointer
= (GLvoid
*) ctx
->Array
.VertexAttrib
[index
].Ptr
;;
502 * Load/parse/compile a program.
503 * \note Called from the GL API dispatcher.
506 _mesa_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
507 const GLubyte
*program
)
509 struct program
*prog
;
510 GET_CURRENT_CONTEXT(ctx
);
511 ASSERT_OUTSIDE_BEGIN_END(ctx
);
514 _mesa_error(ctx
, GL_INVALID_VALUE
, "glLoadProgramNV(id)");
519 _mesa_error(ctx
, GL_INVALID_VALUE
, "glLoadProgramNV(len)");
523 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
525 prog
= (struct program
*) _mesa_HashLookup(ctx
->Shared
->Programs
, id
);
527 if (prog
&& prog
->Target
!= 0 && prog
->Target
!= target
) {
528 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glLoadProgramNV(target)");
532 if ((target
== GL_VERTEX_PROGRAM_NV
||
533 target
== GL_VERTEX_STATE_PROGRAM_NV
)
534 && ctx
->Extensions
.NV_vertex_program
) {
535 struct vertex_program
*vprog
= (struct vertex_program
*) prog
;
536 if (!vprog
|| prog
== &_mesa_DummyProgram
) {
537 vprog
= (struct vertex_program
*)
538 ctx
->Driver
.NewProgram(ctx
, target
, id
);
540 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
543 _mesa_HashInsert(ctx
->Shared
->Programs
, id
, vprog
);
545 _mesa_parse_nv_vertex_program(ctx
, target
, program
, len
, vprog
);
547 else if (target
== GL_FRAGMENT_PROGRAM_NV
548 && ctx
->Extensions
.NV_fragment_program
) {
549 struct fragment_program
*fprog
= (struct fragment_program
*) prog
;
550 if (!fprog
|| prog
== &_mesa_DummyProgram
) {
551 fprog
= (struct fragment_program
*)
552 ctx
->Driver
.NewProgram(ctx
, target
, id
);
554 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
557 _mesa_HashInsert(ctx
->Shared
->Programs
, id
, fprog
);
559 _mesa_parse_nv_fragment_program(ctx
, target
, program
, len
, fprog
);
562 _mesa_error(ctx
, GL_INVALID_ENUM
, "glLoadProgramNV(target)");
569 * Set a program parameter register.
570 * \note Called from the GL API dispatcher.
573 _mesa_ProgramParameter4dNV(GLenum target
, GLuint index
,
574 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
576 _mesa_ProgramParameter4fNV(target
, index
,
577 (GLfloat
)x
, (GLfloat
)y
, (GLfloat
)z
, (GLfloat
)w
);
582 * Set a program parameter register.
583 * \note Called from the GL API dispatcher.
586 _mesa_ProgramParameter4dvNV(GLenum target
, GLuint index
,
587 const GLdouble
*params
)
589 _mesa_ProgramParameter4fNV(target
, index
,
590 (GLfloat
)params
[0], (GLfloat
)params
[1],
591 (GLfloat
)params
[2], (GLfloat
)params
[3]);
596 * Set a program parameter register.
597 * \note Called from the GL API dispatcher.
600 _mesa_ProgramParameter4fNV(GLenum target
, GLuint index
,
601 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
603 GET_CURRENT_CONTEXT(ctx
);
604 ASSERT_OUTSIDE_BEGIN_END(ctx
);
606 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
607 if (index
< MAX_NV_VERTEX_PROGRAM_PARAMS
) {
608 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
609 ASSIGN_4V(ctx
->VertexProgram
.Parameters
[index
], x
, y
, z
, w
);
612 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramParameterNV(index)");
617 _mesa_error(ctx
, GL_INVALID_ENUM
, "glProgramParameterNV");
624 * Set a program parameter register.
625 * \note Called from the GL API dispatcher.
628 _mesa_ProgramParameter4fvNV(GLenum target
, GLuint index
,
629 const GLfloat
*params
)
631 _mesa_ProgramParameter4fNV(target
, index
,
632 params
[0], params
[1], params
[2], params
[3]);
638 * Set a sequence of program parameter registers.
639 * \note Called from the GL API dispatcher.
642 _mesa_ProgramParameters4dvNV(GLenum target
, GLuint index
,
643 GLuint num
, const GLdouble
*params
)
645 GET_CURRENT_CONTEXT(ctx
);
646 ASSERT_OUTSIDE_BEGIN_END(ctx
);
648 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
650 if (index
+ num
> MAX_NV_VERTEX_PROGRAM_PARAMS
) {
651 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramParameters4dvNV");
654 for (i
= 0; i
< num
; i
++) {
655 ctx
->VertexProgram
.Parameters
[index
+ i
][0] = (GLfloat
) params
[0];
656 ctx
->VertexProgram
.Parameters
[index
+ i
][1] = (GLfloat
) params
[1];
657 ctx
->VertexProgram
.Parameters
[index
+ i
][2] = (GLfloat
) params
[2];
658 ctx
->VertexProgram
.Parameters
[index
+ i
][3] = (GLfloat
) params
[3];
663 _mesa_error(ctx
, GL_INVALID_ENUM
, "glProgramParameters4dvNV");
670 * Set a sequence of program parameter registers.
671 * \note Called from the GL API dispatcher.
674 _mesa_ProgramParameters4fvNV(GLenum target
, GLuint index
,
675 GLuint num
, const GLfloat
*params
)
677 GET_CURRENT_CONTEXT(ctx
);
678 ASSERT_OUTSIDE_BEGIN_END(ctx
);
680 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
682 if (index
+ num
> MAX_NV_VERTEX_PROGRAM_PARAMS
) {
683 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramParameters4fvNV");
686 for (i
= 0; i
< num
; i
++) {
687 COPY_4V(ctx
->VertexProgram
.Parameters
[index
+ i
], params
);
692 _mesa_error(ctx
, GL_INVALID_ENUM
, "glProgramParameters4fvNV");
700 * Setup tracking of matrices into program parameter registers.
701 * \note Called from the GL API dispatcher.
704 _mesa_TrackMatrixNV(GLenum target
, GLuint address
,
705 GLenum matrix
, GLenum transform
)
707 GET_CURRENT_CONTEXT(ctx
);
708 ASSERT_OUTSIDE_BEGIN_END(ctx
);
710 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
712 if (target
== GL_VERTEX_PROGRAM_NV
&& ctx
->Extensions
.NV_vertex_program
) {
714 /* addr must be multiple of four */
715 _mesa_error(ctx
, GL_INVALID_VALUE
, "glTrackMatrixNV(address)");
725 case GL_MODELVIEW_PROJECTION_NV
:
734 /* OK, fallthrough */
737 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(matrix)");
744 case GL_TRANSPOSE_NV
:
745 case GL_INVERSE_TRANSPOSE_NV
:
746 /* OK, fallthrough */
749 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(transform)");
753 ctx
->VertexProgram
.TrackMatrix
[address
/ 4] = matrix
;
754 ctx
->VertexProgram
.TrackMatrixTransform
[address
/ 4] = transform
;
757 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTrackMatrixNV(target)");
764 _mesa_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
765 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
767 struct program
*prog
;
768 struct fragment_program
*fragProg
;
771 GET_CURRENT_CONTEXT(ctx
);
772 ASSERT_OUTSIDE_BEGIN_END(ctx
);
774 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
776 prog
= (struct program
*) _mesa_HashLookup(ctx
->Shared
->Programs
, id
);
777 if (!prog
|| prog
->Target
!= GL_FRAGMENT_PROGRAM_NV
) {
778 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glProgramNamedParameterNV");
783 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramNamedParameterNV(len)");
787 fragProg
= (struct fragment_program
*) prog
;
788 v
= _mesa_lookup_parameter_value(fragProg
->Base
.Parameters
, len
,
798 _mesa_error(ctx
, GL_INVALID_VALUE
, "glProgramNamedParameterNV(name)");
803 _mesa_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
806 _mesa_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
811 _mesa_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
812 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
814 _mesa_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
)x
, (GLfloat
)y
,
815 (GLfloat
)z
, (GLfloat
)w
);
820 _mesa_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
823 _mesa_ProgramNamedParameter4fNV(id
, len
, name
,
824 (GLfloat
)v
[0], (GLfloat
)v
[1],
825 (GLfloat
)v
[2], (GLfloat
)v
[3]);
830 _mesa_GetProgramNamedParameterfvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
833 struct program
*prog
;
834 struct fragment_program
*fragProg
;
837 GET_CURRENT_CONTEXT(ctx
);
839 if (!ctx
->_CurrentProgram
)
840 ASSERT_OUTSIDE_BEGIN_END(ctx
);
842 prog
= (struct program
*) _mesa_HashLookup(ctx
->Shared
->Programs
, id
);
843 if (!prog
|| prog
->Target
!= GL_FRAGMENT_PROGRAM_NV
) {
844 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetProgramNamedParameterNV");
849 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetProgramNamedParameterNV");
853 fragProg
= (struct fragment_program
*) prog
;
854 v
= _mesa_lookup_parameter_value(fragProg
->Base
.Parameters
,
864 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetProgramNamedParameterNV");
869 _mesa_GetProgramNamedParameterdvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
872 GLfloat floatParams
[4];
873 _mesa_GetProgramNamedParameterfvNV(id
, len
, name
, floatParams
);
874 COPY_4V(params
, floatParams
);