summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-04-23 14:16:46 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-04-23 14:16:46 +0000
commit6d460af6af77a0d5a5b568bcd6094b98e249ba93 (patch)
tree08656028582b357d5c9730c521cc3e1770604c50 /src/mesa/tnl
parent384800fe12e368f3489111de4572dbc8846a7dea (diff)
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.
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_array_import.c4
-rw-r--r--src/mesa/tnl/t_context.c6
-rw-r--r--src/mesa/tnl/t_save_playback.c9
-rw-r--r--src/mesa/tnl/t_vb_fog.c2
-rw-r--r--src/mesa/tnl/t_vb_light.c7
-rw-r--r--src/mesa/tnl/t_vb_normals.c7
-rw-r--r--src/mesa/tnl/t_vb_points.c7
-rw-r--r--src/mesa/tnl/t_vb_program.c2
-rw-r--r--src/mesa/tnl/t_vb_texgen.c4
-rw-r--r--src/mesa/tnl/t_vb_texmat.c6
-rw-r--r--src/mesa/tnl/t_vb_vertex.c9
-rw-r--r--src/mesa/tnl/t_vtx_api.c17
-rw-r--r--src/mesa/tnl/t_vtx_eval.c6
13 files changed, 44 insertions, 42 deletions
diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c
index 7baeefe81e..0e50c6fa9a 100644
--- a/src/mesa/tnl/t_array_import.c
+++ b/src/mesa/tnl/t_array_import.c
@@ -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 );
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index 1f8c4d40fa..14a7d6089b 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -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;
}
diff --git a/src/mesa/tnl/t_save_playback.c b/src/mesa/tnl/t_save_playback.c
index 264748e9b1..dc9ffa8db4 100644
--- a/src/mesa/tnl/t_save_playback.c
+++ b/src/mesa/tnl/t_save_playback.c
@@ -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 );
diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c
index cb71e67d2f..13a2cbb4d1 100644
--- a/src/mesa/tnl/t_vb_fog.c
+++ b/src/mesa/tnl/t_vb_fog.c
@@ -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;
diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
index 1d260fafb2..cd5792e458 100644
--- a/src/mesa/tnl/t_vb_light.c
+++ b/src/mesa/tnl/t_vb_light.c
@@ -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;
diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c
index 2247313653..732e7c6f4e 100644
--- a/src/mesa/tnl/t_vb_normals.c
+++ b/src/mesa/tnl/t_vb_normals.c
@@ -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:
diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c
index 1990886479..746ea8ba7f 100644
--- a/src/mesa/tnl/t_vb_points.c
+++ b/src/mesa/tnl/t_vb_points.c
@@ -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,
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index a6c9bc8038..38b04b48f9 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -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
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index 64d569a019..e9719b3b53 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -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;
diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c
index 221dd58280..8f6ca89312 100644
--- a/src/mesa/tnl/t_vb_texmat.c
+++ b/src/mesa/tnl/t_vb_texmat.c
@@ -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++)
diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c
index 63dc653245..b483a9522d 100644
--- a/src/mesa/tnl/t_vb_vertex.c
+++ b/src/mesa/tnl/t_vb_vertex.c
@@ -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,
diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c
index 7eccacc504..1bc84ee53d 100644
--- a/src/mesa/tnl/t_vtx_api.c
+++ b/src/mesa/tnl/t_vtx_api.c
@@ -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);
diff --git a/src/mesa/tnl/t_vtx_eval.c b/src/mesa/tnl/t_vtx_eval.c
index 0878827cd9..ea9da13fe4 100644
--- a/src/mesa/tnl/t_vtx_eval.c
+++ b/src/mesa/tnl/t_vtx_eval.c
@@ -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] );