コード例 #1
0
ファイル: vbo_exec_eval.c プロジェクト: MaikuMori/mesa
void vbo_exec_eval_update( struct vbo_exec_context *exec )
{
    struct gl_context *ctx = exec->ctx;
    GLuint attr;

    /* Vertex program maps have priority over conventional attribs */

    for (attr = 0; attr < VBO_ATTRIB_FIRST_MATERIAL; attr++) {
        clear_active_eval1( exec, attr );
        clear_active_eval2( exec, attr );
    }

    if (ctx->Eval.Map1Color4)
        set_active_eval1( exec, VBO_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map1Color4 );

    if (ctx->Eval.Map2Color4)
        set_active_eval2( exec, VBO_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map2Color4 );

    if (ctx->Eval.Map1TextureCoord4)
        set_active_eval1( exec, VBO_ATTRIB_TEX0, 4, &ctx->EvalMap.Map1Texture4 );
    else if (ctx->Eval.Map1TextureCoord3)
        set_active_eval1( exec, VBO_ATTRIB_TEX0, 3, &ctx->EvalMap.Map1Texture3 );
    else if (ctx->Eval.Map1TextureCoord2)
        set_active_eval1( exec, VBO_ATTRIB_TEX0, 2, &ctx->EvalMap.Map1Texture2 );
    else if (ctx->Eval.Map1TextureCoord1)
        set_active_eval1( exec, VBO_ATTRIB_TEX0, 1, &ctx->EvalMap.Map1Texture1 );

    if (ctx->Eval.Map2TextureCoord4)
        set_active_eval2( exec, VBO_ATTRIB_TEX0, 4, &ctx->EvalMap.Map2Texture4 );
    else if (ctx->Eval.Map2TextureCoord3)
        set_active_eval2( exec, VBO_ATTRIB_TEX0, 3, &ctx->EvalMap.Map2Texture3 );
    else if (ctx->Eval.Map2TextureCoord2)
        set_active_eval2( exec, VBO_ATTRIB_TEX0, 2, &ctx->EvalMap.Map2Texture2 );
    else if (ctx->Eval.Map2TextureCoord1)
        set_active_eval2( exec, VBO_ATTRIB_TEX0, 1, &ctx->EvalMap.Map2Texture1 );

    if (ctx->Eval.Map1Normal)
        set_active_eval1( exec, VBO_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map1Normal );

    if (ctx->Eval.Map2Normal)
        set_active_eval2( exec, VBO_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map2Normal );

    if (ctx->Eval.Map1Vertex4)
        set_active_eval1( exec, VBO_ATTRIB_POS, 4, &ctx->EvalMap.Map1Vertex4 );
    else if (ctx->Eval.Map1Vertex3)
        set_active_eval1( exec, VBO_ATTRIB_POS, 3, &ctx->EvalMap.Map1Vertex3 );

    if (ctx->Eval.Map2Vertex4)
        set_active_eval2( exec, VBO_ATTRIB_POS, 4, &ctx->EvalMap.Map2Vertex4 );
    else if (ctx->Eval.Map2Vertex3)
        set_active_eval2( exec, VBO_ATTRIB_POS, 3, &ctx->EvalMap.Map2Vertex3 );

    exec->eval.recalculate_maps = GL_FALSE;
}
コード例 #2
0
ファイル: vbo_exec_eval.c プロジェクト: venkatarajasekhar/Qt
void vbo_exec_eval_update( struct vbo_exec_context *exec )
{
   struct gl_context *ctx = exec->ctx;
   GLuint attr;

   /* Vertex program maps have priority over conventional attribs */

   for (attr = 0; attr < VBO_ATTRIB_FIRST_MATERIAL; attr++) {
      clear_active_eval1( exec, attr );
      clear_active_eval2( exec, attr );
   }

   if (ctx->Eval.Map1Color4) 
      set_active_eval1( exec, VBO_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map1Color4 );
      
   if (ctx->Eval.Map2Color4) 
      set_active_eval2( exec, VBO_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map2Color4 );

   if (ctx->Eval.Map1TextureCoord4) 
      set_active_eval1( exec, VBO_ATTRIB_TEX0, 4, &ctx->EvalMap.Map1Texture4 );
   else if (ctx->Eval.Map1TextureCoord3) 
      set_active_eval1( exec, VBO_ATTRIB_TEX0, 3, &ctx->EvalMap.Map1Texture3 );
   else if (ctx->Eval.Map1TextureCoord2) 
      set_active_eval1( exec, VBO_ATTRIB_TEX0, 2, &ctx->EvalMap.Map1Texture2 );
   else if (ctx->Eval.Map1TextureCoord1) 
      set_active_eval1( exec, VBO_ATTRIB_TEX0, 1, &ctx->EvalMap.Map1Texture1 );

   if (ctx->Eval.Map2TextureCoord4) 
      set_active_eval2( exec, VBO_ATTRIB_TEX0, 4, &ctx->EvalMap.Map2Texture4 );
   else if (ctx->Eval.Map2TextureCoord3) 
      set_active_eval2( exec, VBO_ATTRIB_TEX0, 3, &ctx->EvalMap.Map2Texture3 );
   else if (ctx->Eval.Map2TextureCoord2) 
      set_active_eval2( exec, VBO_ATTRIB_TEX0, 2, &ctx->EvalMap.Map2Texture2 );
   else if (ctx->Eval.Map2TextureCoord1) 
      set_active_eval2( exec, VBO_ATTRIB_TEX0, 1, &ctx->EvalMap.Map2Texture1 );

   if (ctx->Eval.Map1Normal) 
      set_active_eval1( exec, VBO_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map1Normal );

   if (ctx->Eval.Map2Normal) 
      set_active_eval2( exec, VBO_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map2Normal );

   if (ctx->Eval.Map1Vertex4) 
      set_active_eval1( exec, VBO_ATTRIB_POS, 4, &ctx->EvalMap.Map1Vertex4 );
   else if (ctx->Eval.Map1Vertex3) 
      set_active_eval1( exec, VBO_ATTRIB_POS, 3, &ctx->EvalMap.Map1Vertex3 );

   if (ctx->Eval.Map2Vertex4) 
      set_active_eval2( exec, VBO_ATTRIB_POS, 4, &ctx->EvalMap.Map2Vertex4 );
   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;
}