2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2008 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.
30 * This file manages recalculation of derived values in GLcontext.
39 #include "ffvertex_prog.h"
40 #include "framebuffer.h"
43 #if FEATURE_pixel_transfer
46 #include "shader/program.h"
47 #include "shader/prog_parameter.h"
50 #include "texenvprogram.h"
57 update_separate_specular(GLcontext
*ctx
)
59 if (NEED_SECONDARY_COLOR(ctx
))
60 ctx
->_TriangleCaps
|= DD_SEPARATE_SPECULAR
;
62 ctx
->_TriangleCaps
&= ~DD_SEPARATE_SPECULAR
;
67 * Update state dependent on vertex arrays.
70 update_arrays( GLcontext
*ctx
)
74 /* find min of _MaxElement values for all enabled arrays */
77 if (ctx
->VertexProgram
._Current
78 && ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_POS
].Enabled
) {
79 min
= ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_POS
]._MaxElement
;
81 else if (ctx
->Array
.ArrayObj
->Vertex
.Enabled
) {
82 min
= ctx
->Array
.ArrayObj
->Vertex
._MaxElement
;
85 /* can't draw anything without vertex positions! */
90 if (ctx
->VertexProgram
._Enabled
91 && ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_WEIGHT
].Enabled
) {
92 min
= MIN2(min
, ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_WEIGHT
]._MaxElement
);
94 /* no conventional vertex weight array */
97 if (ctx
->VertexProgram
._Enabled
98 && ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_NORMAL
].Enabled
) {
99 min
= MIN2(min
, ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_NORMAL
]._MaxElement
);
101 else if (ctx
->Array
.ArrayObj
->Normal
.Enabled
) {
102 min
= MIN2(min
, ctx
->Array
.ArrayObj
->Normal
._MaxElement
);
106 if (ctx
->VertexProgram
._Enabled
107 && ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_COLOR0
].Enabled
) {
108 min
= MIN2(min
, ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_COLOR0
]._MaxElement
);
110 else if (ctx
->Array
.ArrayObj
->Color
.Enabled
) {
111 min
= MIN2(min
, ctx
->Array
.ArrayObj
->Color
._MaxElement
);
115 if (ctx
->VertexProgram
._Enabled
116 && ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_COLOR1
].Enabled
) {
117 min
= MIN2(min
, ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_COLOR1
]._MaxElement
);
119 else if (ctx
->Array
.ArrayObj
->SecondaryColor
.Enabled
) {
120 min
= MIN2(min
, ctx
->Array
.ArrayObj
->SecondaryColor
._MaxElement
);
124 if (ctx
->VertexProgram
._Enabled
125 && ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_FOG
].Enabled
) {
126 min
= MIN2(min
, ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_FOG
]._MaxElement
);
128 else if (ctx
->Array
.ArrayObj
->FogCoord
.Enabled
) {
129 min
= MIN2(min
, ctx
->Array
.ArrayObj
->FogCoord
._MaxElement
);
133 if (ctx
->VertexProgram
._Enabled
134 && ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_COLOR_INDEX
].Enabled
) {
135 min
= MIN2(min
, ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_COLOR_INDEX
]._MaxElement
);
137 else if (ctx
->Array
.ArrayObj
->Index
.Enabled
) {
138 min
= MIN2(min
, ctx
->Array
.ArrayObj
->Index
._MaxElement
);
143 if (ctx
->VertexProgram
._Enabled
144 && ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_EDGEFLAG
].Enabled
) {
145 min
= MIN2(min
, ctx
->Array
.ArrayObj
->VertexAttrib
[VERT_ATTRIB_EDGEFLAG
]._MaxElement
);
149 for (i
= VERT_ATTRIB_TEX0
; i
<= VERT_ATTRIB_TEX7
; i
++) {
150 if (ctx
->VertexProgram
._Enabled
151 && ctx
->Array
.ArrayObj
->VertexAttrib
[i
].Enabled
) {
152 min
= MIN2(min
, ctx
->Array
.ArrayObj
->VertexAttrib
[i
]._MaxElement
);
154 else if (i
- VERT_ATTRIB_TEX0
< ctx
->Const
.MaxTextureCoordUnits
155 && ctx
->Array
.ArrayObj
->TexCoord
[i
- VERT_ATTRIB_TEX0
].Enabled
) {
156 min
= MIN2(min
, ctx
->Array
.ArrayObj
->TexCoord
[i
- VERT_ATTRIB_TEX0
]._MaxElement
);
161 if (ctx
->VertexProgram
._Current
) {
162 for (i
= 0; i
< Elements(ctx
->Array
.ArrayObj
->VertexAttrib
); i
++) {
163 if (ctx
->Array
.ArrayObj
->VertexAttrib
[i
].Enabled
) {
164 min
= MIN2(min
, ctx
->Array
.ArrayObj
->VertexAttrib
[i
]._MaxElement
);
169 if (ctx
->Array
.ArrayObj
->EdgeFlag
.Enabled
) {
170 min
= MIN2(min
, ctx
->Array
.ArrayObj
->EdgeFlag
._MaxElement
);
173 /* _MaxElement is one past the last legal array element */
174 ctx
->Array
._MaxElement
= min
;
179 * Update the following fields:
180 * ctx->VertexProgram._Enabled
181 * ctx->FragmentProgram._Enabled
182 * ctx->ATIFragmentShader._Enabled
183 * This needs to be done before texture state validation.
186 update_program_enables(GLcontext
*ctx
)
188 /* These _Enabled flags indicate if the program is enabled AND valid. */
189 ctx
->VertexProgram
._Enabled
= ctx
->VertexProgram
.Enabled
190 && ctx
->VertexProgram
.Current
->Base
.Instructions
;
191 ctx
->FragmentProgram
._Enabled
= ctx
->FragmentProgram
.Enabled
192 && ctx
->FragmentProgram
.Current
->Base
.Instructions
;
193 ctx
->ATIFragmentShader
._Enabled
= ctx
->ATIFragmentShader
.Enabled
194 && ctx
->ATIFragmentShader
.Current
->Instructions
[0];
199 * Update vertex/fragment program state. In particular, update these fields:
200 * ctx->VertexProgram._Current
201 * ctx->VertexProgram._TnlProgram,
202 * These point to the highest priority enabled vertex/fragment program or are
203 * NULL if fixed-function processing is to be done.
205 * This function needs to be called after texture state validation in case
206 * we're generating a fragment program from fixed-function texture state.
208 * \return bitfield which will indicate _NEW_PROGRAM state if a new vertex
209 * or fragment program is being used.
212 update_program(GLcontext
*ctx
)
214 const struct gl_shader_program
*shProg
= ctx
->Shader
.CurrentProgram
;
215 const struct gl_vertex_program
*prevVP
= ctx
->VertexProgram
._Current
;
216 const struct gl_fragment_program
*prevFP
= ctx
->FragmentProgram
._Current
;
217 GLbitfield new_state
= 0x0;
220 * Set the ctx->VertexProgram._Current and ctx->FragmentProgram._Current
221 * pointers to the programs that should be used for rendering. If either
222 * is NULL, use fixed-function code paths.
224 * These programs may come from several sources. The priority is as
226 * 1. OpenGL 2.0/ARB vertex/fragment shaders
227 * 2. ARB/NV vertex/fragment programs
228 * 3. Programs derived from fixed-function state.
230 * Note: it's possible for a vertex shader to get used with a fragment
231 * program (and vice versa) here, but in practice that shouldn't ever
232 * come up, or matter.
235 if (shProg
&& shProg
->LinkStatus
&& shProg
->FragmentProgram
) {
236 /* Use shader programs */
237 _mesa_reference_fragprog(ctx
, &ctx
->FragmentProgram
._Current
,
238 shProg
->FragmentProgram
);
240 else if (ctx
->FragmentProgram
._Enabled
) {
241 /* use user-defined vertex program */
242 _mesa_reference_fragprog(ctx
, &ctx
->FragmentProgram
._Current
,
243 ctx
->FragmentProgram
.Current
);
245 else if (ctx
->FragmentProgram
._MaintainTexEnvProgram
) {
246 /* Use fragment program generated from fixed-function state.
248 _mesa_reference_fragprog(ctx
, &ctx
->FragmentProgram
._Current
,
249 _mesa_get_fixed_func_fragment_program(ctx
));
250 _mesa_reference_fragprog(ctx
, &ctx
->FragmentProgram
._TexEnvProgram
,
251 ctx
->FragmentProgram
._Current
);
254 /* no fragment program */
255 _mesa_reference_fragprog(ctx
, &ctx
->FragmentProgram
._Current
, NULL
);
258 /* Examine vertex program after fragment program as
259 * _mesa_get_fixed_func_vertex_program() needs to know active
262 if (shProg
&& shProg
->LinkStatus
&& shProg
->VertexProgram
) {
263 /* Use shader programs */
264 _mesa_reference_vertprog(ctx
, &ctx
->VertexProgram
._Current
,
265 shProg
->VertexProgram
);
267 else if (ctx
->VertexProgram
._Enabled
) {
268 /* use user-defined vertex program */
269 _mesa_reference_vertprog(ctx
, &ctx
->VertexProgram
._Current
,
270 ctx
->VertexProgram
.Current
);
272 else if (ctx
->VertexProgram
._MaintainTnlProgram
) {
273 /* Use vertex program generated from fixed-function state.
275 _mesa_reference_vertprog(ctx
, &ctx
->VertexProgram
._Current
,
276 _mesa_get_fixed_func_vertex_program(ctx
));
277 _mesa_reference_vertprog(ctx
, &ctx
->VertexProgram
._TnlProgram
,
278 ctx
->VertexProgram
._Current
);
281 /* no vertex program */
282 _mesa_reference_vertprog(ctx
, &ctx
->VertexProgram
._Current
, NULL
);
285 /* Let the driver know what's happening:
287 if (ctx
->FragmentProgram
._Current
!= prevFP
) {
288 new_state
|= _NEW_PROGRAM
;
289 if (ctx
->Driver
.BindProgram
) {
290 ctx
->Driver
.BindProgram(ctx
, GL_FRAGMENT_PROGRAM_ARB
,
291 (struct gl_program
*) ctx
->FragmentProgram
._Current
);
295 if (ctx
->VertexProgram
._Current
!= prevVP
) {
296 new_state
|= _NEW_PROGRAM
;
297 if (ctx
->Driver
.BindProgram
) {
298 ctx
->Driver
.BindProgram(ctx
, GL_VERTEX_PROGRAM_ARB
,
299 (struct gl_program
*) ctx
->VertexProgram
._Current
);
308 * Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0.
311 update_program_constants(GLcontext
*ctx
)
313 GLbitfield new_state
= 0x0;
315 if (ctx
->FragmentProgram
._Current
) {
316 const struct gl_program_parameter_list
*params
=
317 ctx
->FragmentProgram
._Current
->Base
.Parameters
;
318 if (params
&& params
->StateFlags
& ctx
->NewState
) {
319 new_state
|= _NEW_PROGRAM_CONSTANTS
;
323 if (ctx
->VertexProgram
._Current
) {
324 const struct gl_program_parameter_list
*params
=
325 ctx
->VertexProgram
._Current
->Base
.Parameters
;
326 if (params
&& params
->StateFlags
& ctx
->NewState
) {
327 new_state
|= _NEW_PROGRAM_CONSTANTS
;
338 update_viewport_matrix(GLcontext
*ctx
)
340 const GLfloat depthMax
= ctx
->DrawBuffer
->_DepthMaxF
;
342 ASSERT(depthMax
> 0);
344 /* Compute scale and bias values. This is really driver-specific
345 * and should be maintained elsewhere if at all.
346 * NOTE: RasterPos uses this.
348 _math_matrix_viewport(&ctx
->Viewport
._WindowMap
,
349 ctx
->Viewport
.X
, ctx
->Viewport
.Y
,
350 ctx
->Viewport
.Width
, ctx
->Viewport
.Height
,
351 ctx
->Viewport
.Near
, ctx
->Viewport
.Far
,
357 * Update derived multisample state.
360 update_multisample(GLcontext
*ctx
)
362 ctx
->Multisample
._Enabled
= GL_FALSE
;
363 if (ctx
->Multisample
.Enabled
&&
365 ctx
->DrawBuffer
->Visual
.sampleBuffers
)
366 ctx
->Multisample
._Enabled
= GL_TRUE
;
371 * Update derived color/blend/logicop state.
374 update_color(GLcontext
*ctx
)
376 /* This is needed to support 1.1's RGB logic ops AND
377 * 1.0's blending logicops.
379 ctx
->Color
._LogicOpEnabled
= RGBA_LOGICOP_ENABLED(ctx
);
384 * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET
385 * in ctx->_TriangleCaps if needed.
388 update_polygon(GLcontext
*ctx
)
390 ctx
->_TriangleCaps
&= ~(DD_TRI_CULL_FRONT_BACK
| DD_TRI_OFFSET
);
392 if (ctx
->Polygon
.CullFlag
&& ctx
->Polygon
.CullFaceMode
== GL_FRONT_AND_BACK
)
393 ctx
->_TriangleCaps
|= DD_TRI_CULL_FRONT_BACK
;
395 if ( ctx
->Polygon
.OffsetPoint
396 || ctx
->Polygon
.OffsetLine
397 || ctx
->Polygon
.OffsetFill
)
398 ctx
->_TriangleCaps
|= DD_TRI_OFFSET
;
403 * Update the ctx->_TriangleCaps bitfield.
404 * XXX that bitfield should really go away someday!
405 * This function must be called after other update_*() functions since
406 * there are dependencies on some other derived values.
410 update_tricaps(GLcontext
*ctx
, GLbitfield new_state
)
412 ctx
->_TriangleCaps
= 0;
417 if (1/*new_state & _NEW_POINT*/) {
418 if (ctx
->Point
.SmoothFlag
)
419 ctx
->_TriangleCaps
|= DD_POINT_SMOOTH
;
420 if (ctx
->Point
.Size
!= 1.0F
)
421 ctx
->_TriangleCaps
|= DD_POINT_SIZE
;
422 if (ctx
->Point
._Attenuated
)
423 ctx
->_TriangleCaps
|= DD_POINT_ATTEN
;
429 if (1/*new_state & _NEW_LINE*/) {
430 if (ctx
->Line
.SmoothFlag
)
431 ctx
->_TriangleCaps
|= DD_LINE_SMOOTH
;
432 if (ctx
->Line
.StippleFlag
)
433 ctx
->_TriangleCaps
|= DD_LINE_STIPPLE
;
434 if (ctx
->Line
.Width
!= 1.0)
435 ctx
->_TriangleCaps
|= DD_LINE_WIDTH
;
441 if (1/*new_state & _NEW_POLYGON*/) {
442 if (ctx
->Polygon
.SmoothFlag
)
443 ctx
->_TriangleCaps
|= DD_TRI_SMOOTH
;
444 if (ctx
->Polygon
.StippleFlag
)
445 ctx
->_TriangleCaps
|= DD_TRI_STIPPLE
;
446 if (ctx
->Polygon
.FrontMode
!= GL_FILL
447 || ctx
->Polygon
.BackMode
!= GL_FILL
)
448 ctx
->_TriangleCaps
|= DD_TRI_UNFILLED
;
449 if (ctx
->Polygon
.CullFlag
450 && ctx
->Polygon
.CullFaceMode
== GL_FRONT_AND_BACK
)
451 ctx
->_TriangleCaps
|= DD_TRI_CULL_FRONT_BACK
;
452 if (ctx
->Polygon
.OffsetPoint
||
453 ctx
->Polygon
.OffsetLine
||
454 ctx
->Polygon
.OffsetFill
)
455 ctx
->_TriangleCaps
|= DD_TRI_OFFSET
;
459 * Lighting and shading
461 if (ctx
->Light
.Enabled
&& ctx
->Light
.Model
.TwoSide
)
462 ctx
->_TriangleCaps
|= DD_TRI_LIGHT_TWOSIDE
;
463 if (ctx
->Light
.ShadeModel
== GL_FLAT
)
464 ctx
->_TriangleCaps
|= DD_FLATSHADE
;
465 if (NEED_SECONDARY_COLOR(ctx
))
466 ctx
->_TriangleCaps
|= DD_SEPARATE_SPECULAR
;
471 if (ctx
->Stencil
._TestTwoSide
)
472 ctx
->_TriangleCaps
|= DD_TRI_TWOSTENCIL
;
478 * Compute derived GL state.
479 * If __GLcontextRec::NewState is non-zero then this function \b must
480 * be called before rendering anything.
482 * Calls dd_function_table::UpdateState to perform any internal state
483 * management necessary.
485 * \sa _mesa_update_modelview_project(), _mesa_update_texture(),
486 * _mesa_update_buffer_bounds(),
487 * _mesa_update_lighting() and _mesa_update_tnl_spaces().
490 _mesa_update_state_locked( GLcontext
*ctx
)
492 GLbitfield new_state
= ctx
->NewState
;
493 GLbitfield prog_flags
= _NEW_PROGRAM
;
494 GLbitfield new_prog_state
= 0x0;
496 if (new_state
== _NEW_CURRENT_ATTRIB
)
499 if (MESA_VERBOSE
& VERBOSE_STATE
)
500 _mesa_print_state("_mesa_update_state", new_state
);
502 /* Determine which state flags effect vertex/fragment program state */
503 if (ctx
->FragmentProgram
._MaintainTexEnvProgram
) {
504 prog_flags
|= (_NEW_TEXTURE
| _NEW_FOG
| _DD_NEW_SEPARATE_SPECULAR
|
505 _NEW_ARRAY
| _NEW_LIGHT
| _NEW_POINT
| _NEW_RENDERMODE
);
507 if (ctx
->VertexProgram
._MaintainTnlProgram
) {
508 prog_flags
|= (_NEW_ARRAY
| _NEW_TEXTURE
| _NEW_TEXTURE_MATRIX
|
509 _NEW_TRANSFORM
| _NEW_POINT
|
510 _NEW_FOG
| _NEW_LIGHT
|
511 _MESA_NEW_NEED_EYE_COORDS
);
515 * Now update derived state info
518 if (new_state
& prog_flags
)
519 update_program_enables( ctx
);
521 if (new_state
& (_NEW_MODELVIEW
|_NEW_PROJECTION
))
522 _mesa_update_modelview_project( ctx
, new_state
);
524 if (new_state
& (_NEW_PROGRAM
|_NEW_TEXTURE
|_NEW_TEXTURE_MATRIX
))
525 _mesa_update_texture( ctx
, new_state
);
527 if (new_state
& _NEW_BUFFERS
)
528 _mesa_update_framebuffer(ctx
);
530 if (new_state
& (_NEW_SCISSOR
| _NEW_BUFFERS
| _NEW_VIEWPORT
))
531 _mesa_update_draw_buffer_bounds( ctx
);
533 if (new_state
& _NEW_POLYGON
)
534 update_polygon( ctx
);
536 if (new_state
& _NEW_LIGHT
)
537 _mesa_update_lighting( ctx
);
539 if (new_state
& (_NEW_STENCIL
| _NEW_BUFFERS
))
540 _mesa_update_stencil( ctx
);
542 #if FEATURE_pixel_transfer
543 if (new_state
& _MESA_NEW_TRANSFER_STATE
)
544 _mesa_update_pixel( ctx
, new_state
);
547 if (new_state
& _DD_NEW_SEPARATE_SPECULAR
)
548 update_separate_specular( ctx
);
550 if (new_state
& (_NEW_ARRAY
| _NEW_PROGRAM
))
551 update_arrays( ctx
);
553 if (new_state
& (_NEW_BUFFERS
| _NEW_VIEWPORT
))
554 update_viewport_matrix(ctx
);
556 if (new_state
& _NEW_MULTISAMPLE
)
557 update_multisample( ctx
);
559 if (new_state
& _NEW_COLOR
)
563 if (new_state
& (_NEW_POINT
| _NEW_LINE
| _NEW_POLYGON
| _NEW_LIGHT
564 | _NEW_STENCIL
| _DD_NEW_SEPARATE_SPECULAR
))
565 update_tricaps( ctx
, new_state
);
568 /* ctx->_NeedEyeCoords is now up to date.
570 * If the truth value of this variable has changed, update for the
571 * new lighting space and recompute the positions of lights and the
574 * If the lighting space hasn't changed, may still need to recompute
575 * light positions & normal transforms for other reasons.
577 if (new_state
& _MESA_NEW_NEED_EYE_COORDS
)
578 _mesa_update_tnl_spaces( ctx
, new_state
);
580 if (new_state
& prog_flags
) {
581 /* When we generate programs from fixed-function vertex/fragment state
582 * this call may generate/bind a new program. If so, we need to
583 * propogate the _NEW_PROGRAM flag to the driver.
585 new_prog_state
|= update_program( ctx
);
590 new_prog_state
|= update_program_constants(ctx
);
593 * Give the driver a chance to act upon the new_state flags.
594 * The driver might plug in different span functions, for example.
595 * Also, this is where the driver can invalidate the state of any
596 * active modules (such as swrast_setup, swrast, tnl, etc).
598 * Set ctx->NewState to zero to avoid recursion if
599 * Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?)
601 new_state
= ctx
->NewState
| new_prog_state
;
603 ctx
->Driver
.UpdateState(ctx
, new_state
);
604 ctx
->Array
.NewState
= 0;
608 /* This is the usual entrypoint for state updates:
611 _mesa_update_state( GLcontext
*ctx
)
613 _mesa_lock_context_textures(ctx
);
614 _mesa_update_state_locked(ctx
);
615 _mesa_unlock_context_textures(ctx
);
622 * Want to figure out which fragment program inputs are actually
623 * constant/current values from ctx->Current. These should be
624 * referenced as a tracked state variable rather than a fragment
625 * program input, to save the overhead of putting a constant value in
626 * every submitted vertex, transferring it to hardware, interpolating
627 * it across the triangle, etc...
629 * When there is a VP bound, just use vp->outputs. But when we're
630 * generating vp from fixed function state, basically want to
633 * vp_out_2_fp_in( vp_in_2_vp_out( varying_inputs ) |
634 * potential_vp_outputs )
636 * Where potential_vp_outputs is calculated by looking at enabled
639 * The generated fragment program should then only declare inputs that
640 * may vary or otherwise differ from the ctx->Current values.
641 * Otherwise, the fp should track them as state values instead.
644 _mesa_set_varying_vp_inputs( GLcontext
*ctx
,
645 GLbitfield varying_inputs
)
647 if (ctx
->varying_vp_inputs
!= varying_inputs
) {
648 ctx
->varying_vp_inputs
= varying_inputs
;
649 ctx
->NewState
|= _NEW_ARRAY
;
650 /*_mesa_printf("%s %x\n", __FUNCTION__, varying_inputs);*/
656 * Used by drivers to tell core Mesa that the driver is going to
657 * install/ use its own vertex program. In particular, this will
658 * prevent generated fragment programs from using state vars instead
659 * of ordinary varyings/inputs.
662 _mesa_set_vp_override(GLcontext
*ctx
, GLboolean flag
)
664 if (ctx
->VertexProgram
._Overriden
!= flag
) {
665 ctx
->VertexProgram
._Overriden
= flag
;
667 /* Set one of the bits which will trigger fragment program
670 ctx
->NewState
|= _NEW_ARRAY
;