Added ctx->Vertex/FragmentProgram._Enable flags. Set when vertex/fragment

program is enabled AND the currently bound program is valid.
Check _Enable instead of Enable to prevent things from blowing up
when someone calls glEnable(GL_VERTEX_PROGRAM_ARB) without actually
defining a program.
This commit is contained in:
Brian Paul
2004-04-23 14:16:46 +00:00
parent 384800fe12
commit 6d460af6af
27 changed files with 130 additions and 111 deletions

View File

@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
* Version: 6.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -72,7 +72,7 @@ static void reset_vertex( GLcontext *ctx )
{
ACcontext *ac = AC_CONTEXT(ctx);
ASSERT(ctx->Array.Vertex.Enabled
|| (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled));
|| (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled));
ac->Raw.Vertex = ctx->Array.Vertex;
STRIDE_ARRAY(ac->Raw.Vertex, ac->start);
ac->IsCached.Vertex = GL_FALSE;

View File

@@ -704,7 +704,7 @@ void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
*/
if (!ctx->Eval.Map1Vertex4 &&
!ctx->Eval.Map1Vertex3 &&
!(ctx->VertexProgram.Enabled && ctx->Eval.Map1Attrib[VERT_ATTRIB_POS]))
!(ctx->VertexProgram._Enabled && ctx->Eval.Map1Attrib[VERT_ATTRIB_POS]))
return;
du = ctx->Eval.MapGrid1du;
@@ -739,7 +739,7 @@ void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1,
*/
if (!ctx->Eval.Map2Vertex4 &&
!ctx->Eval.Map2Vertex3 &&
!(ctx->VertexProgram.Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS]))
!(ctx->VertexProgram._Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS]))
return;
du = ctx->Eval.MapGrid2du;

View File

@@ -1,7 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
* Version: 6.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
*
@@ -62,7 +61,7 @@ _mesa_validate_DrawElements(GLcontext *ctx,
/* Always need vertex positions */
if (!ctx->Array.Vertex.Enabled
&& !(ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled))
&& !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled))
return GL_FALSE;
/* Vertex buffer object tests */
@@ -168,7 +167,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
/* Always need vertex positions */
if (!ctx->Array.Vertex.Enabled
&& !(ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled))
&& !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled))
return GL_FALSE;
if (ctx->Const.CheckArrayBounds) {

View File

@@ -21,9 +21,9 @@
/*
* Mesa 3-D graphics library
* Version: 4.1
* Version: 6.1
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -375,9 +375,9 @@ do { \
(((CTX)->Light.Enabled && \
(CTX)->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) \
|| (CTX)->Fog.ColorSumEnabled \
|| ((CTX)->VertexProgram.Enabled && \
|| ((CTX)->VertexProgram._Enabled && \
((CTX)->VertexProgram.Current->InputsRead & VERT_BIT_COLOR1)) \
|| ((CTX)->FragmentProgram.Enabled && \
|| ((CTX)->FragmentProgram._Enabled && \
((CTX)->FragmentProgram.Current->InputsRead & FRAG_BIT_COL1)) \
)

View File

@@ -45,8 +45,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->FragmentProgram.Enabled
&& !ctx->FragmentProgram.Current->Instructions) {
if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels (invalid fragment program)");
return;
@@ -103,8 +102,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
GLint destx, desty;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->FragmentProgram.Enabled
&& !ctx->FragmentProgram.Current->Instructions) {
if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glCopyPixels (invalid fragment program)");
return;
@@ -184,8 +182,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (ctx->FragmentProgram.Enabled
&& !ctx->FragmentProgram.Current->Instructions) {
if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBitmap (invalid fragment program)");
return;

View File

@@ -1628,10 +1628,11 @@ struct program_state {
*/
struct vertex_program_state
{
GLboolean Enabled; /**< GL_VERTEX_PROGRAM_NV */
GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_NV */
GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_NV */
struct vertex_program *Current; /**< ptr to currently bound program */
GLboolean Enabled; /**< GL_VERTEX_PROGRAM_NV */
GLboolean _Enabled; /**< Really enabled? */
GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_NV */
GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_NV */
struct vertex_program *Current; /**< ptr to currently bound program */
GLenum TrackMatrix[MAX_NV_VERTEX_PROGRAM_PARAMS / 4];
GLenum TrackMatrixTransform[MAX_NV_VERTEX_PROGRAM_PARAMS / 4];
@@ -1658,6 +1659,7 @@ struct vertex_program_state
struct fragment_program_state
{
GLboolean Enabled; /* GL_VERTEX_PROGRAM_NV */
GLboolean _Enabled; /* Really enabled? */
struct fragment_program *Current; /* ptr to currently bound program */
struct fp_machine Machine; /* machine state */
GLfloat Parameters[MAX_NV_FRAGMENT_PROGRAM_PARAMS][4]; /* Env params */

View File

@@ -418,7 +418,7 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
if (ctx->NewState)
_mesa_update_state( ctx );
if (ctx->VertexProgram.Enabled) {
if (ctx->VertexProgram._Enabled) {
/* XXX implement this */
_mesa_problem(ctx, "Vertex programs not implemented for glRasterPos");
return;

View File

@@ -1,11 +1,3 @@
/**
* \file state.c
* State management.
*
* This file manages recalculation of derived values in the __GLcontextRec.
* Also, this is where we initialize the API dispatch table.
*/
/*
* Mesa 3-D graphics library
* Version: 6.1
@@ -31,6 +23,14 @@
*/
/**
* \file state.c
* State management.
*
* This file manages recalculation of derived values in the __GLcontextRec.
* Also, this is where we initialize the API dispatch table.
*/
#include "glheader.h"
#include "accum.h"
#include "api_loopback.h"
@@ -762,7 +762,7 @@ update_arrays( GLcontext *ctx )
/* find min of _MaxElement values for all enabled arrays */
/* 0 */
if (ctx->VertexProgram.Enabled
if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled) {
min = ctx->Array.VertexAttrib[VERT_ATTRIB_POS]._MaxElement;
}
@@ -775,14 +775,14 @@ update_arrays( GLcontext *ctx )
}
/* 1 */
if (ctx->VertexProgram.Enabled
if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[VERT_ATTRIB_WEIGHT].Enabled) {
min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_WEIGHT]._MaxElement);
}
/* no conventional vertex weight array */
/* 2 */
if (ctx->VertexProgram.Enabled
if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL]._MaxElement);
}
@@ -791,7 +791,7 @@ update_arrays( GLcontext *ctx )
}
/* 3 */
if (ctx->VertexProgram.Enabled
if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0]._MaxElement);
}
@@ -800,7 +800,7 @@ update_arrays( GLcontext *ctx )
}
/* 4 */
if (ctx->VertexProgram.Enabled
if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1]._MaxElement);
}
@@ -809,7 +809,7 @@ update_arrays( GLcontext *ctx )
}
/* 5 */
if (ctx->VertexProgram.Enabled
if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_FOG]._MaxElement);
}
@@ -818,20 +818,20 @@ update_arrays( GLcontext *ctx )
}
/* 6 */
if (ctx->VertexProgram.Enabled
if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[VERT_ATTRIB_SIX].Enabled) {
min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SIX]._MaxElement);
}
/* 7 */
if (ctx->VertexProgram.Enabled
if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[VERT_ATTRIB_SEVEN].Enabled) {
min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SEVEN]._MaxElement);
}
/* 8..15 */
for (i = VERT_ATTRIB_TEX0; i < VERT_ATTRIB_MAX; i++) {
if (ctx->VertexProgram.Enabled
if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[i].Enabled) {
min = MIN2(min, ctx->Array.VertexAttrib[i]._MaxElement);
}
@@ -854,6 +854,22 @@ update_arrays( GLcontext *ctx )
}
/**
* Update derived vertex/fragment program state.
*/
static void
update_program(GLcontext *ctx)
{
/* For now, just set the _Enabled (really enabled) flags.
* In the future we may have to check other state to be sure we really
* have a runable program or shader.
*/
ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
&& ctx->VertexProgram.Current->Instructions;
ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled
&& ctx->FragmentProgram.Current->Instructions;
}
/*
* If __GLcontextRec::NewState is non-zero then this function \b must be called
@@ -875,6 +891,9 @@ void _mesa_update_state( GLcontext *ctx )
if (MESA_VERBOSE & VERBOSE_STATE)
_mesa_print_state("_mesa_update_state", new_state);
if (new_state & _NEW_PROGRAM)
update_program( ctx );
if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
_mesa_update_modelview_project( ctx, new_state );

View File

@@ -2935,7 +2935,7 @@ update_texture_state( GLcontext *ctx )
texUnit->_GenFlags = 0;
/* Get the bitmask of texture enables */
if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) {
if (ctx->FragmentProgram._Enabled) {
enableBits = ctx->FragmentProgram.Current->TexturesUsed[unit];
}
else {
@@ -3099,7 +3099,7 @@ update_texture_state( GLcontext *ctx )
/* Fragment programs may need texture coordinates but not the
* corresponding texture images.
*/
if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) {
if (ctx->FragmentProgram._Enabled) {
ctx->Texture._EnabledCoordUnits |=
(ctx->FragmentProgram.Current->InputsRead >> FRAG_ATTRIB_TEX0);
}

View File

@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 6.0
* Version: 6.1
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
@@ -1142,7 +1142,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
"glGetProgramRegisterfvMESA(target)");
return;
}
if (!ctx->VertexProgram.Enabled) {
if (!ctx->VertexProgram._Enabled) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetProgramRegisterfvMESA");
return;
@@ -1194,7 +1194,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
"glGetProgramRegisterfvMESA(target)");
return;
}
if (!ctx->FragmentProgram.Enabled) {
if (!ctx->FragmentProgram._Enabled) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetProgramRegisterfvMESA");
return;
@@ -1207,7 +1207,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
"glGetProgramRegisterfvMESA(target)");
return;
}
if (!ctx->FragmentProgram.Enabled) {
if (!ctx->FragmentProgram._Enabled) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetProgramRegisterfvMESA");
return;

View File

@@ -102,7 +102,7 @@ _swrast_update_rasterflags( GLcontext *ctx )
RasterMask |= MULTI_DRAW_BIT; /* all color index bits disabled */
}
if (ctx->FragmentProgram.Enabled) {
if (ctx->FragmentProgram._Enabled) {
RasterMask |= FRAGPROG_BIT;
}
@@ -145,7 +145,7 @@ _swrast_update_fog_hint( GLcontext *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
swrast->_PreferPixelFog = (!swrast->AllowVertexFog ||
ctx->FragmentProgram.Enabled ||
ctx->FragmentProgram._Enabled ||
(ctx->Hint.Fog == GL_NICEST &&
swrast->AllowPixelFog));
}
@@ -189,7 +189,7 @@ _swrast_update_fog_state( GLcontext *ctx )
if (ctx->Fog.Enabled) {
swrast->_FogEnabled = GL_TRUE;
}
else if (ctx->FragmentProgram.Enabled &&
else if (ctx->FragmentProgram._Enabled &&
ctx->FragmentProgram.Current->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
const struct fragment_program *p;
p = (struct fragment_program *) ctx->FragmentProgram.Current;
@@ -203,7 +203,7 @@ _swrast_update_fog_state( GLcontext *ctx )
static void
_swrast_update_fragment_program( GLcontext *ctx )
{
if (ctx->FragmentProgram.Enabled) {
if (ctx->FragmentProgram._Enabled) {
struct fragment_program *program = ctx->FragmentProgram.Current;
_mesa_load_state_parameters(ctx, program->Parameters);
}
@@ -271,7 +271,7 @@ _swrast_validate_triangle( GLcontext *ctx,
if (ctx->Texture._EnabledUnits == 0
&& NEED_SECONDARY_COLOR(ctx)
&& !ctx->FragmentProgram.Enabled) {
&& !ctx->FragmentProgram._Enabled) {
/* separate specular color, but no texture */
swrast->SpecTriangle = swrast->Triangle;
swrast->Triangle = _swrast_add_spec_terms_triangle;
@@ -290,7 +290,7 @@ _swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
if (ctx->Texture._EnabledUnits == 0
&& NEED_SECONDARY_COLOR(ctx)
&& !ctx->FragmentProgram.Enabled) {
&& !ctx->FragmentProgram._Enabled) {
swrast->SpecLine = swrast->Line;
swrast->Line = _swrast_add_spec_terms_line;
}
@@ -309,7 +309,7 @@ _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 )
if (ctx->Texture._EnabledUnits == 0
&& NEED_SECONDARY_COLOR(ctx)
&& !ctx->FragmentProgram.Enabled) {
&& !ctx->FragmentProgram._Enabled) {
swrast->SpecPoint = swrast->Point;
swrast->Point = _swrast_add_spec_terms_point;
}

View File

@@ -379,7 +379,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
if (obj) {
const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel];
needLambda = (obj->MinFilter != obj->MagFilter)
|| ctx->FragmentProgram.Enabled;
|| ctx->FragmentProgram._Enabled;
texW = img->WidthScale;
texH = img->HeightScale;
}
@@ -404,7 +404,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
GLfloat r = span->tex[u][2];
GLfloat q = span->tex[u][3];
GLuint i;
if (ctx->FragmentProgram.Enabled) {
if (ctx->FragmentProgram._Enabled) {
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->dwdx;
GLfloat w = span->w;
@@ -455,7 +455,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
GLfloat r = span->tex[u][2];
GLfloat q = span->tex[u][3];
GLuint i;
if (ctx->FragmentProgram.Enabled) {
if (ctx->FragmentProgram._Enabled) {
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->dwdx;
GLfloat w = span->w;
@@ -513,7 +513,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
if (obj) {
const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel];
needLambda = (obj->MinFilter != obj->MagFilter)
|| ctx->FragmentProgram.Enabled;
|| ctx->FragmentProgram._Enabled;
texW = (GLfloat) img->WidthScale;
texH = (GLfloat) img->HeightScale;
}
@@ -538,7 +538,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
GLfloat r = span->tex[0][2];
GLfloat q = span->tex[0][3];
GLuint i;
if (ctx->FragmentProgram.Enabled) {
if (ctx->FragmentProgram._Enabled) {
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->dwdx;
GLfloat w = span->w;
@@ -589,7 +589,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
GLfloat r = span->tex[0][2];
GLfloat q = span->tex[0][3];
GLuint i;
if (ctx->FragmentProgram.Enabled) {
if (ctx->FragmentProgram._Enabled) {
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->dwdx;
GLfloat w = span->w;
@@ -1104,7 +1104,7 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span)
}
/* Fragment program */
if (ctx->FragmentProgram.Enabled) {
if (ctx->FragmentProgram._Enabled) {
/* Now we may need to interpolate the colors and texcoords */
if ((span->interpMask & SPAN_RGBA) &&
(span->arrayMask & SPAN_RGBA) == 0) {
@@ -1326,7 +1326,7 @@ _swrast_write_texture_span( GLcontext *ctx, struct sw_span *span)
span->primitive == GL_POLYGON || span->primitive == GL_BITMAP);
ASSERT(span->end <= MAX_WIDTH);
ASSERT((span->interpMask & span->arrayMask) == 0);
ASSERT(ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram.Enabled);
ASSERT(ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram._Enabled);
/*
printf("%s() interp 0x%x array 0x%x\n", __FUNCTION__, span->interpMask, span->arrayMask);
@@ -1386,7 +1386,7 @@ _swrast_write_texture_span( GLcontext *ctx, struct sw_span *span)
/* Texturing without alpha is done after depth-testing which
* gives a potential speed-up.
*/
if (ctx->FragmentProgram.Enabled)
if (ctx->FragmentProgram._Enabled)
_swrast_exec_fragment_program( ctx, span );
else
_swrast_texture_span( ctx, span );
@@ -1453,7 +1453,7 @@ _swrast_write_texture_span( GLcontext *ctx, struct sw_span *span)
interpolate_specular(ctx, span);
}
if (ctx->FragmentProgram.Enabled)
if (ctx->FragmentProgram._Enabled)
_swrast_exec_fragment_program( ctx, span );
else
_swrast_texture_span( ctx, span );

View File

@@ -1057,7 +1057,7 @@ _swrast_choose_triangle( GLcontext *ctx )
}
}
if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram.Enabled) {
if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram._Enabled) {
/* Ugh, we do a _lot_ of tests to pick the best textured tri func */
const struct gl_texture_object *texObj2D;
const struct gl_texture_image *texImg;
@@ -1072,7 +1072,7 @@ _swrast_choose_triangle( GLcontext *ctx )
/* First see if we can use an optimized 2-D texture function */
if (ctx->Texture._EnabledCoordUnits == 1
&& !ctx->FragmentProgram.Enabled
&& !ctx->FragmentProgram._Enabled
&& ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT
&& texObj2D->WrapS==GL_REPEAT
&& texObj2D->WrapT==GL_REPEAT

View File

@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.0.1
* Version: 6.1
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -291,7 +291,7 @@ void _swsetup_choose_trifuncs( GLcontext *ctx )
ind |= SS_OFFSET_BIT;
if ((ctx->Light.Enabled && ctx->Light.Model.TwoSide) ||
(ctx->VertexProgram.Enabled && ctx->VertexProgram.TwoSideEnabled))
(ctx->VertexProgram._Enabled && ctx->VertexProgram.TwoSideEnabled))
ind |= SS_TWOSIDE_BIT;
/* We piggyback the two-sided stencil front/back determination on the

View File

@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 6.0
* Version: 6.1
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
@@ -260,7 +260,7 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end)
/* When vertex program mode is enabled, the generic vertex attribute
* arrays have priority over the conventional vertex arrays.
*/
if (ctx->VertexProgram.Enabled
if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[index].Enabled) {
/* Use generic attribute array */
_tnl_import_attrib( ctx, index, GL_FALSE, GL_TRUE );

View File

@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
* Version: 6.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -192,7 +192,7 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
tnl->render_inputs |= _TNL_BIT_TEX0;
if (ctx->Point._Attenuated ||
(ctx->VertexProgram.Enabled && ctx->VertexProgram.PointSizeEnabled))
(ctx->VertexProgram._Enabled && ctx->VertexProgram.PointSizeEnabled))
tnl->render_inputs |= _TNL_BIT_POINTSIZE;
}

View File

@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 6.0
* Version: 6.1
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
@@ -199,6 +199,13 @@ void _tnl_playback_vertex_list( GLcontext *ctx, void *data )
if (ctx->NewState)
_mesa_update_state( ctx );
if ((ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) ||
(ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBegin (invalid vertex/fragment program)");
return;
}
if (tnl->pipeline.build_state_changes)
_tnl_validate_pipeline( ctx );

View File

@@ -216,7 +216,7 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
static void
check_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
{
stage->active = ctx->Fog.Enabled && !ctx->VertexProgram.Enabled;
stage->active = ctx->Fog.Enabled && !ctx->VertexProgram._Enabled;
if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT)
stage->inputs = _TNL_BIT_POS;

View File

@@ -1,9 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
* Version: 6.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -315,7 +314,7 @@ static GLboolean run_init_lighting( GLcontext *ctx,
*/
static void check_lighting( GLcontext *ctx, struct tnl_pipeline_stage *stage )
{
stage->active = ctx->Light.Enabled && !ctx->VertexProgram.Enabled;
stage->active = ctx->Light.Enabled && !ctx->VertexProgram._Enabled;
if (stage->active) {
if (stage->privatePtr)
stage->run = run_validate_lighting;

View File

@@ -1,9 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
* Version: 6.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -137,7 +136,7 @@ static GLboolean run_validate_normal_stage( GLcontext *ctx,
static void check_normal_transform( GLcontext *ctx,
struct tnl_pipeline_stage *stage )
{
stage->active = !ctx->VertexProgram.Enabled &&
stage->active = !ctx->VertexProgram._Enabled &&
(ctx->Light.Enabled || (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS));
/* Don't clobber the initialize function:

View File

@@ -1,9 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
* Version: 6.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -76,7 +75,7 @@ static GLboolean run_point_stage( GLcontext *ctx,
*/
static void check_point_size( GLcontext *ctx, struct tnl_pipeline_stage *d )
{
d->active = ctx->Point._Attenuated && !ctx->VertexProgram.Enabled;
d->active = ctx->Point._Attenuated && !ctx->VertexProgram._Enabled;
}
static GLboolean alloc_point_data( GLcontext *ctx,

View File

@@ -315,7 +315,7 @@ static GLboolean run_init_vp( GLcontext *ctx,
*/
static void check_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
{
stage->active = ctx->VertexProgram.Enabled;
stage->active = ctx->VertexProgram._Enabled;
if (stage->active) {
/* Set stage->inputs equal to the bitmask of vertex attributes

View File

@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 6.0
* Version: 6.1
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
@@ -593,7 +593,7 @@ static void check_texgen( GLcontext *ctx, struct tnl_pipeline_stage *stage )
GLuint i;
stage->active = 0;
if (ctx->Texture._TexGenEnabled && !ctx->VertexProgram.Enabled) {
if (ctx->Texture._TexGenEnabled && !ctx->VertexProgram._Enabled) {
GLuint inputs = 0;
GLuint outputs = 0;

View File

@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
* Version: 6.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -57,7 +57,7 @@ static void check_texmat( GLcontext *ctx, struct tnl_pipeline_stage *stage )
GLuint i;
stage->active = 0;
if (ctx->Texture._TexMatEnabled && !ctx->VertexProgram.Enabled) {
if (ctx->Texture._TexMatEnabled && !ctx->VertexProgram._Enabled) {
GLuint flags = 0;
for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)

View File

@@ -1,9 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 5.0
* Version: 6.1
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -135,7 +134,7 @@ static GLboolean run_vertex_stage( GLcontext *ctx,
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
ASSERT(!ctx->VertexProgram.Enabled);
ASSERT(!ctx->VertexProgram._Enabled);
if (stage->changed_inputs) {
@@ -234,7 +233,7 @@ static GLboolean run_vertex_stage( GLcontext *ctx,
static void check_vertex( GLcontext *ctx, struct tnl_pipeline_stage *stage )
{
stage->active = !ctx->VertexProgram.Enabled;
stage->active = !ctx->VertexProgram._Enabled;
}
static GLboolean init_vertex_stage( GLcontext *ctx,

View File

@@ -724,21 +724,20 @@ static void GLAPIENTRY _tnl_Begin( GLenum mode )
{
GET_CURRENT_CONTEXT( ctx );
if ((ctx->VertexProgram.Enabled
&& !ctx->VertexProgram.Current->Instructions) ||
(ctx->FragmentProgram.Enabled
&& !ctx->FragmentProgram.Current->Instructions)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBegin (invalid vertex/fragment program)");
return;
}
if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) {
TNLcontext *tnl = TNL_CONTEXT(ctx);
int i;
if (ctx->NewState) {
_mesa_update_state( ctx );
if ((ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) ||
(ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBegin (invalid vertex/fragment program)");
return;
}
if (!(tnl->Driver.NotifyBegin &&
tnl->Driver.NotifyBegin( ctx, mode )))
ctx->Exec->Begin(mode);

View File

@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
* Version: 6.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -73,7 +73,7 @@ void _tnl_update_eval( GLcontext *ctx )
clear_active_eval2( tnl, attr );
}
if (ctx->VertexProgram.Enabled) {
if (ctx->VertexProgram._Enabled) {
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
if (ctx->Eval.Map1Attrib[attr])
set_active_eval1( tnl, attr, 4, &ctx->EvalMap.Map1Attrib[attr] );