X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fvbo%2Fvbo_exec_eval.c;h=1e8c3c45bb53fea51955fabfd884cdf5a3fd8156;hb=038d654bcb4e9d88eab420cefc3169d4845db4c9;hp=0ba5585d246a9321debfb574fc50836bfe04b77e;hpb=f0aa6654e27b279ecb29e9fd19c140cb1ac7946f;p=mesa.git diff --git a/src/mesa/vbo/vbo_exec_eval.c b/src/mesa/vbo/vbo_exec_eval.c index 0ba5585d246..1e8c3c45bb5 100644 --- a/src/mesa/vbo/vbo_exec_eval.c +++ b/src/mesa/vbo/vbo_exec_eval.c @@ -26,27 +26,29 @@ */ #include "main/glheader.h" -#include "main/api_eval.h" #include "main/context.h" #include "main/macros.h" #include "math/m_eval.h" -#include "glapi/dispatch.h" +#include "main/dispatch.h" #include "vbo_exec.h" static void clear_active_eval1( struct vbo_exec_context *exec, GLuint attr ) { + assert(attr < Elements(exec->eval.map1)); exec->eval.map1[attr].map = NULL; } static void clear_active_eval2( struct vbo_exec_context *exec, GLuint attr ) { + assert(attr < Elements(exec->eval.map2)); exec->eval.map2[attr].map = NULL; } static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint dim, struct gl_1d_map *map ) { + assert(attr < Elements(exec->eval.map1)); if (!exec->eval.map1[attr].map) { exec->eval.map1[attr].map = map; exec->eval.map1[attr].sz = dim; @@ -56,6 +58,7 @@ static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint static void set_active_eval2( struct vbo_exec_context *exec, GLuint attr, GLuint dim, struct gl_2d_map *map ) { + assert(attr < Elements(exec->eval.map2)); if (!exec->eval.map2[attr].map) { exec->eval.map2[attr].map = map; exec->eval.map2[attr].sz = dim; @@ -64,7 +67,7 @@ static void set_active_eval2( struct vbo_exec_context *exec, GLuint attr, GLuint void vbo_exec_eval_update( struct vbo_exec_context *exec ) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; GLuint attr; /* Vertex program maps have priority over conventional attribs */ @@ -74,18 +77,6 @@ void vbo_exec_eval_update( struct vbo_exec_context *exec ) clear_active_eval2( exec, attr ); } - /* _NEW_PROGRAM */ - if (ctx->VertexProgram._Enabled) { - for (attr = 0; attr < VBO_ATTRIB_FIRST_MATERIAL; attr++) { - /* _NEW_EVAL */ - if (ctx->Eval.Map1Attrib[attr]) - set_active_eval1( exec, attr, 4, &ctx->EvalMap.Map1Attrib[attr] ); - - if (ctx->Eval.Map2Attrib[attr]) - set_active_eval2( exec, attr, 4, &ctx->EvalMap.Map2Attrib[attr] ); - } - } - if (ctx->Eval.Map1Color4) set_active_eval1( exec, VBO_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map1Color4 ); @@ -126,6 +117,23 @@ void vbo_exec_eval_update( struct vbo_exec_context *exec ) else if (ctx->Eval.Map2Vertex3) set_active_eval2( exec, VBO_ATTRIB_POS, 3, &ctx->EvalMap.Map2Vertex3 ); + /* _NEW_PROGRAM */ + if (ctx->VertexProgram._Enabled) { + /* These are the 16 evaluators which GL_NV_vertex_program defines. + * They alias and override the conventional vertex attributs. + */ + for (attr = 0; attr < 16; attr++) { + /* _NEW_EVAL */ + assert(attr < Elements(ctx->Eval.Map1Attrib)); + if (ctx->Eval.Map1Attrib[attr]) + set_active_eval1( exec, attr, 4, &ctx->EvalMap.Map1Attrib[attr] ); + + assert(attr < Elements(ctx->Eval.Map2Attrib)); + if (ctx->Eval.Map2Attrib[attr]) + set_active_eval2( exec, attr, 4, &ctx->EvalMap.Map2Attrib[attr] ); + } + } + exec->eval.recalculate_maps = 0; }