Ejemplo n.º 1
0
/**
 * Execute the buffer and save copied verts.
 */
void _tnl_playback_vertex_list( GLcontext *ctx, void *data )
{
   const struct tnl_vertex_list *node = (const struct tnl_vertex_list *) data;
   TNLcontext *tnl = TNL_CONTEXT(ctx);

   FLUSH_CURRENT(ctx, 0);

   if (node->prim_count > 0 && node->count > 0) {

      if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END &&
	       (node->prim[0].mode & PRIM_BEGIN)) {

	 /* Degenerate case: list is called inside begin/end pair and
	  * includes operations such as glBegin or glDrawArrays.
	  */
	 _mesa_error( ctx, GL_INVALID_OPERATION, "displaylist recursive begin");
	 _tnl_loopback_vertex_list( ctx, node );
	 return;
      }
      else if (tnl->LoopbackDListCassettes ||
	       node->dangling_attr_ref) {
	 /* Degenerate case: list references current data and would
	  * require fixup.  Take the easier option & loop it back.
	  */
	 _tnl_loopback_vertex_list( ctx, node );
	 return;
      }
      
      if (ctx->NewState)
	 _mesa_update_state( ctx );

      if (tnl->pipeline.build_state_changes)
	 _tnl_validate_pipeline( ctx );

      _tnl_bind_vertex_list( ctx, node );

      /* Invalidate all stored data before and after run:
       */
      tnl->pipeline.run_input_changes |= tnl->pipeline.inputs;
      tnl->Driver.RunPipeline( ctx );
      tnl->pipeline.run_input_changes |= tnl->pipeline.inputs;
   }

   /* Copy to current?
    */
   _playback_copy_to_current( ctx, node );
}
Ejemplo n.º 2
0
/**
 * Execute the buffer and save copied verts.
 */
void _tnl_playback_vertex_list( GLcontext *ctx, void *data )
{
   const struct tnl_vertex_list *node = (const struct tnl_vertex_list *) data;
   TNLcontext *tnl = TNL_CONTEXT(ctx);

   FLUSH_CURRENT(ctx, 0);

   if (node->prim_count > 0 && node->count > 0) {

      if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END &&
	  (node->prim[0].mode & PRIM_BEGIN)) {

	 /* Degenerate case: list is called inside begin/end pair and
	  * includes operations such as glBegin or glDrawArrays.
	  */
	 _mesa_error( ctx, GL_INVALID_OPERATION, "displaylist recursive begin");
	 _tnl_loopback_vertex_list( ctx, node );
	 return;
      }
      else if (tnl->save.replay_flags) {
	 /* Various degnerate cases: translate into immediate mode
	  * calls rather than trying to execute in place.
	  */
	 _tnl_loopback_vertex_list( ctx, node );
	 return;
      }
      
      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;
      }

      _tnl_bind_vertex_list( ctx, node );

      tnl->Driver.RunPipeline( ctx );
   }

   /* Copy to current?
    */
   _playback_copy_to_current( ctx, node );
}