예제 #1
0
struct u_vbuf *
u_vbuf_create(struct pipe_context *pipe,
              struct u_vbuf_caps *caps, unsigned aux_vertex_buffer_index)
{
   struct u_vbuf *mgr = CALLOC_STRUCT(u_vbuf);

   mgr->caps = *caps;
   mgr->aux_vertex_buffer_slot = aux_vertex_buffer_index;
   mgr->pipe = pipe;
   mgr->cso_cache = cso_cache_create();
   mgr->translate_cache = translate_cache_create();
   memset(mgr->fallback_vbs, ~0, sizeof(mgr->fallback_vbs));

   return mgr;
}
예제 #2
0
struct pt_fetch *draw_pt_fetch_create( struct draw_context *draw )
{
   struct pt_fetch *fetch = CALLOC_STRUCT(pt_fetch);
   if (!fetch)
      return NULL;

   fetch->draw = draw;
   fetch->cache = translate_cache_create();
   if (!fetch->cache) {
      FREE(fetch);
      return NULL;
   }

   return fetch;
}
예제 #3
0
struct pt_emit *draw_pt_emit_create( struct draw_context *draw )
{
   struct pt_emit *emit = CALLOC_STRUCT(pt_emit);
   if (!emit)
      return NULL;

   emit->draw = draw;
   emit->cache = translate_cache_create();
   if (!emit->cache) {
      FREE(emit);
      return NULL;
   }

   return emit;
}
예제 #4
0
파일: u_vbuf.c 프로젝트: UIKit0/mesa
struct u_vbuf *
u_vbuf_create(struct pipe_context *pipe,
              struct u_vbuf_caps *caps)
{
   struct u_vbuf *mgr = CALLOC_STRUCT(u_vbuf);

   mgr->caps = *caps;
   mgr->pipe = pipe;
   mgr->cso_cache = cso_cache_create();
   mgr->translate_cache = translate_cache_create();
   memset(mgr->fallback_vbs, ~0, sizeof(mgr->fallback_vbs));

   mgr->uploader = u_upload_create(pipe, 1024 * 1024, 4,
                                   PIPE_BIND_VERTEX_BUFFER);

   return mgr;
}
예제 #5
0
/**
 * Create a new primitive vbuf/render stage.
 */
struct draw_stage *draw_vbuf_stage( struct draw_context *draw,
                                    struct vbuf_render *render )
{
   struct vbuf_stage *vbuf = CALLOC_STRUCT(vbuf_stage);
   if (!vbuf)
      goto fail;

   vbuf->stage.draw = draw;
   vbuf->stage.name = "vbuf";
   vbuf->stage.point = vbuf_first_point;
   vbuf->stage.line = vbuf_first_line;
   vbuf->stage.tri = vbuf_first_tri;
   vbuf->stage.flush = vbuf_flush;
   vbuf->stage.reset_stipple_counter = vbuf_reset_stipple_counter;
   vbuf->stage.destroy = vbuf_destroy;

   vbuf->render = render;
   vbuf->max_indices = MIN2(render->max_indices, UNDEFINED_VERTEX_ID-1);

   vbuf->indices = (ushort *) align_malloc(vbuf->max_indices *
                    sizeof(vbuf->indices[0]),
                    16);
   if (!vbuf->indices)
      goto fail;

   vbuf->cache = translate_cache_create();
   if (!vbuf->cache)
      goto fail;

   vbuf->vertices = NULL;
   vbuf->vertex_ptr = vbuf->vertices;

   vbuf->zero4[0] = vbuf->zero4[1] = vbuf->zero4[2] = vbuf->zero4[3] = 0.0f;

   return &vbuf->stage;

fail:
   if (vbuf)
      vbuf_destroy(&vbuf->stage);

   return NULL;
}
예제 #6
0
struct draw_pt_middle_end *draw_pt_fetch_emit( struct draw_context *draw )
{
   struct fetch_emit_middle_end *fetch_emit = CALLOC_STRUCT( fetch_emit_middle_end );
   if (fetch_emit == NULL)
      return NULL;

   fetch_emit->cache = translate_cache_create();
   if (!fetch_emit->cache) {
      FREE(fetch_emit);
      return NULL;
   }

   fetch_emit->base.prepare    = fetch_emit_prepare;
   fetch_emit->base.run        = fetch_emit_run;
   fetch_emit->base.run_linear = fetch_emit_run_linear;
   fetch_emit->base.run_linear_elts = fetch_emit_run_linear_elts;
   fetch_emit->base.finish     = fetch_emit_finish;
   fetch_emit->base.destroy    = fetch_emit_destroy;

   fetch_emit->draw = draw;
     
   return &fetch_emit->base;
}
예제 #7
0
파일: u_vbuf.c 프로젝트: mlankhorst/Mesa-3D
struct u_vbuf *
u_vbuf_create(struct pipe_context *pipe,
              unsigned upload_buffer_size,
              unsigned upload_buffer_alignment,
              unsigned upload_buffer_bind,
              enum u_fetch_alignment fetch_alignment)
{
   struct u_vbuf_priv *mgr = CALLOC_STRUCT(u_vbuf_priv);

   mgr->pipe = pipe;
   mgr->translate_cache = translate_cache_create();
   mgr->fallback_vb_slot = ~0;

   mgr->b.uploader = u_upload_create(pipe, upload_buffer_size,
                                     upload_buffer_alignment,
                                     upload_buffer_bind);

   mgr->b.caps.fetch_dword_unaligned =
         fetch_alignment == U_VERTEX_FETCH_BYTE_ALIGNED;

   u_vbuf_init_format_caps(mgr);

   return &mgr->b;
}