示例#1
0
文件: t_imm_exec.c 项目: aosm/X11
/**
 * Setup vector pointers that will be used to bind immediates to VB's.
 */
void _tnl_imm_init( GLcontext *ctx )
{
   TNLcontext *tnl = TNL_CONTEXT(ctx);
   struct vertex_arrays *tmp = &tnl->imm_inputs;
   GLuint i;
   static int firsttime = 1;

   if (firsttime) {
      firsttime = 0;
      _tnl_imm_elt_init();
   }

   ctx->swtnl_im = _tnl_alloc_immediate( ctx );
   TNL_CURRENT_IM(ctx)->ref_count++;

   tnl->ExecCopyTexSize = 0;
   tnl->ExecCopyCount = 0;
   tnl->ExecCopySource = 0;

   TNL_CURRENT_IM(ctx)->CopyStart = IMM_MAX_COPIED_VERTS;

   _mesa_vector4f_init( &tmp->Obj, 0, 0 );
   _mesa_vector4f_init( &tmp->Normal, 0, 0 );

   tmp->Color.Ptr = NULL;
   tmp->Color.Type = GL_FLOAT;
   tmp->Color.Size = 4;
   tmp->Color.Stride = 0;
   tmp->Color.StrideB = 4 * sizeof(GLfloat);
   tmp->Color.Flags = 0;

   tmp->SecondaryColor.Ptr = NULL;
   tmp->SecondaryColor.Type = GL_FLOAT;
   tmp->SecondaryColor.Size = 4;
   tmp->SecondaryColor.Stride = 0;
   tmp->SecondaryColor.StrideB = 4 * sizeof(GLfloat);
   tmp->SecondaryColor.Flags = 0;

   _mesa_vector4f_init( &tmp->FogCoord, 0, 0 );
   _mesa_vector1ui_init( &tmp->Index, 0, 0 );
   _mesa_vector1ub_init( &tmp->EdgeFlag, 0, 0 );

   for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
      _mesa_vector4f_init( &tmp->TexCoord[i], 0, 0);

   /* Install the first immediate.  Intially outside begin/end.
    */
   _tnl_reset_exec_input( ctx, IMM_MAX_COPIED_VERTS, 0, 0 );
   tnl->ReplayHardBeginEnd = 0;

   _tnl_imm_vtxfmt_init( ctx );
}
示例#2
0
/**
 * Initialize the display list compiler
 */
void _tnl_save_init( GLcontext *ctx )
{
   TNLcontext *tnl = TNL_CONTEXT(ctx);
   struct tnl_vertex_arrays *tmp = &tnl->save_inputs;
   GLuint i;


   for (i = 0; i < _TNL_ATTRIB_MAX; i++)
      _mesa_vector4f_init( &tmp->Attribs[i], 0, 0);

   tnl->save.opcode_vertex_list =
      _mesa_alloc_opcode( ctx,
			  sizeof(struct tnl_vertex_list),
			  _tnl_playback_vertex_list,
			  _tnl_destroy_vertex_list,
			  _tnl_print_vertex_list );

   ctx->Driver.NotifySaveBegin = _save_NotifyBegin;

   _save_vtxfmt_init( ctx );
   _save_current_init( ctx );

   /* Hook our array functions into the outside-begin-end vtxfmt in 
    * ctx->ListState.
    */
   ctx->ListState.ListVtxfmt.Rectf = _save_OBE_Rectf;
   ctx->ListState.ListVtxfmt.DrawArrays = _save_OBE_DrawArrays;
   ctx->ListState.ListVtxfmt.DrawElements = _save_OBE_DrawElements;
   ctx->ListState.ListVtxfmt.DrawRangeElements = _save_OBE_DrawRangeElements;
   _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
}
示例#3
0
/* Called the first time stage->run() is invoked.
 */
static GLboolean
alloc_fog_data(GLcontext *ctx, struct tnl_pipeline_stage *stage)
{
   TNLcontext *tnl = TNL_CONTEXT(ctx);
   struct fog_stage_data *store;
   stage->privatePtr = MALLOC(sizeof(*store));
   store = FOG_STAGE_DATA(stage);
   if (!store)
      return GL_FALSE;

   _mesa_vector4f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 );
   _mesa_vector4f_init( &store->input, 0, NULL );

   if (!inited)
      init_static_data();

   return GL_TRUE;
}
示例#4
0
void _tnl_vtx_init( GLcontext *ctx )
{
   TNLcontext *tnl = TNL_CONTEXT(ctx); 
   struct tnl_vertex_arrays *tmp = &tnl->vtx_inputs;
   GLuint i;
   static int firsttime = 1;
   
   if (firsttime) {
      firsttime = 0;

      INIT_CHOOSERS( 0 );
      INIT_CHOOSERS( 1 );
      INIT_CHOOSERS( 2 );
      INIT_CHOOSERS( 3 );
      INIT_CHOOSERS( 4 );
      INIT_CHOOSERS( 5 );
      INIT_CHOOSERS( 6 );
      INIT_CHOOSERS( 7 );
      INIT_CHOOSERS( 8 );
      INIT_CHOOSERS( 9 );
      INIT_CHOOSERS( 10 );
      INIT_CHOOSERS( 11 );
      INIT_CHOOSERS( 12 );
      INIT_CHOOSERS( 13 );
      INIT_CHOOSERS( 14 );
      INIT_CHOOSERS( 15 );

      choose[ERROR_ATTRIB][0] = error_attrib;
      choose[ERROR_ATTRIB][1] = error_attrib;
      choose[ERROR_ATTRIB][2] = error_attrib;
      choose[ERROR_ATTRIB][3] = error_attrib;

#ifdef USE_X86_ASM
      if (tnl->AllowCodegen) {
         _tnl_x86choosers(choose, do_choose); /* x86 INIT_CHOOSERS */
      }
#endif

      _tnl_generic_attr_table_init( generic_attr_func );
   }

   for (i = 0; i < _TNL_ATTRIB_INDEX; i++)
      _mesa_vector4f_init( &tmp->Attribs[i], 0, NULL);

   for (i = 0; i < 4; i++) {
      make_empty_list( &tnl->vtx.cache.Vertex[i] );
      make_empty_list( &tnl->vtx.cache.Attribute[i] );
      tnl->vtx.gen.Vertex[i] = no_codegen;
      tnl->vtx.gen.Attribute[i] = no_codegen;
   }

#ifdef USE_X86_ASM
   _tnl_InitX86Codegen( &tnl->vtx.gen );
#endif

   _tnl_current_init( ctx );
   _tnl_exec_vtxfmt_init( ctx );
   _tnl_generic_exec_vtxfmt_init( ctx );
#ifdef USE_X86_ASM
   if (tnl->AllowCodegen) {
      _tnl_x86_exec_vtxfmt_init( ctx ); /* x86 DISPATCH_ATTRFV */
   }
#endif

   _mesa_install_exec_vtxfmt( ctx, &tnl->exec_vtxfmt );

   _mesa_memcpy( tnl->vtx.tabfv, choose, sizeof(choose) );

   for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) 
      tnl->vtx.attrsz[i] = 0;

   tnl->vtx.vertex_size = 0;
   tnl->vtx.have_materials = 0;
}