예제 #1
0
//!** Buffer manager operations
void gim_create_buffer_manager(GBUFFER_MANAGER_PROTOTYPE * prototype,GUINT buffer_manager_id)
{
    GBUFFER_MANAGER_DATA * bm_data;
    bm_data = &g_buffer_managers[buffer_manager_id];

    if(bm_data->m_active==0)
    {
        if(g_buffer_managers_count<=buffer_manager_id)
        {
            g_buffer_managers_count = buffer_manager_id+1;
        }
    }
    else
    {
        gim_destroy_buffer_manager(buffer_manager_id);
    }
    bm_data->m_active = 1;
    //CREATE ARRAYS
    GIM_DYNARRAY_CREATE(GBUFFER_DATA,bm_data->m_buffer_array,G_ARRAY_GROW_SIZE);
    GIM_DYNARRAY_CREATE(GUINT,bm_data->m_free_positions,G_ARRAY_GROW_SIZE);
    //INIT PROTOTYPE
    bm_data->m_prototype.alloc_data_fn = prototype->alloc_data_fn;
    bm_data->m_prototype.alloc_fn = prototype->alloc_fn;
    bm_data->m_prototype.copy_buffers_fn = prototype->copy_buffers_fn;
    bm_data->m_prototype.download_from_buffer_fn = prototype->download_from_buffer_fn;
    bm_data->m_prototype.free_fn = prototype->free_fn;
    bm_data->m_prototype.lock_buffer_fn = prototype->lock_buffer_fn;
    bm_data->m_prototype.realloc_fn = prototype->realloc_fn;
    bm_data->m_prototype.unlock_buffer_fn = prototype->unlock_buffer_fn;
    bm_data->m_prototype.upload_to_buffer_fn = prototype->upload_to_buffer_fn;
}
예제 #2
0
//!** Buffer manager operations
void gim_create_buffer_manager(GBUFFER_MANAGER_DATA buffer_managers[],
  GUINT32 buffer_manager_id)
{
    GBUFFER_MANAGER_DATA * bm_data;
    bm_data = &buffer_managers[buffer_manager_id];

  if (_is_buffer_manager_data_active(bm_data))
  {
    gim_destroy_buffer_manager(buffer_managers, buffer_manager_id);
  }

    //CREATE ARRAYS
    GIM_DYNARRAY_CREATE(GBUFFER_DATA,bm_data->m_buffer_array,G_ARRAY_BUFFERMANAGER_INIT_SIZE);
    GIM_DYNARRAY_CREATE(GUINT32,bm_data->m_free_positions,G_ARRAY_BUFFERMANAGER_INIT_SIZE);
  bm_data->m_prototype = g_bm_prototypes + buffer_manager_id;
  bm_data->m_buffer_manager_id = buffer_manager_id;
}