pb_bufmgr_alt.c File Reference

Allocate buffers from two alternative buffer providers. More...

Include dependency graph for pb_bufmgr_alt.c:

Go to the source code of this file.

Data Structures

struct  pb_alt_manager

Functions

static struct pb_alt_managerpb_alt_manager (struct pb_manager *mgr)
static struct pb_bufferpb_alt_manager_create_buffer (struct pb_manager *_mgr, size_t size, const struct pb_desc *desc)
static void pb_alt_manager_flush (struct pb_manager *_mgr)
static void pb_alt_manager_destroy (struct pb_manager *mgr)
struct pb_managerpb_alt_manager_create (struct pb_manager *provider1, struct pb_manager *provider2)


Detailed Description

Allocate buffers from two alternative buffer providers.

Author:
Jose Fonseca <jrfonseca@tungstengraphics.com>

Definition in file pb_bufmgr_alt.c.


Function Documentation

static struct pb_alt_manager* pb_alt_manager ( struct pb_manager mgr  )  [static, read]

Definition at line 54 of file pb_bufmgr_alt.c.

References assert.

00055 {
00056    assert(mgr);
00057    return (struct pb_alt_manager *)mgr;
00058 }

struct pb_manager* pb_alt_manager_create ( struct pb_manager provider1,
struct pb_manager provider2 
) [read]

Definition at line 101 of file pb_bufmgr_alt.c.

References pb_alt_manager::base, CALLOC_STRUCT, pb_manager::create_buffer, pb_manager::destroy, pb_manager::flush, pb_alt_manager_create_buffer(), pb_alt_manager_destroy(), pb_alt_manager_flush(), pb_alt_manager::provider1, and pb_alt_manager::provider2.

00103 {
00104    struct pb_alt_manager *mgr;
00105 
00106    if(!provider1 || !provider2)
00107       return NULL;
00108    
00109    mgr = CALLOC_STRUCT(pb_alt_manager);
00110    if (!mgr)
00111       return NULL;
00112 
00113    mgr->base.destroy = pb_alt_manager_destroy;
00114    mgr->base.create_buffer = pb_alt_manager_create_buffer;
00115    mgr->base.flush = pb_alt_manager_flush;
00116    mgr->provider1 = provider1;
00117    mgr->provider2 = provider2;
00118       
00119    return &mgr->base;
00120 }

static struct pb_buffer* pb_alt_manager_create_buffer ( struct pb_manager _mgr,
size_t  size,
const struct pb_desc desc 
) [static, read]

Definition at line 62 of file pb_bufmgr_alt.c.

References pb_manager::create_buffer, pb_alt_manager(), pb_alt_manager::provider1, and pb_alt_manager::provider2.

00065 {
00066    struct pb_alt_manager *mgr = pb_alt_manager(_mgr);
00067    struct pb_buffer *buf;
00068    
00069    buf = mgr->provider1->create_buffer(mgr->provider1, size, desc);
00070    if(buf)
00071       return buf;
00072    
00073    buf = mgr->provider2->create_buffer(mgr->provider2, size, desc);
00074    return buf;
00075 }

static void pb_alt_manager_destroy ( struct pb_manager mgr  )  [static]

Definition at line 94 of file pb_bufmgr_alt.c.

References FREE.

00095 {
00096    FREE(mgr);
00097 }

static void pb_alt_manager_flush ( struct pb_manager _mgr  )  [static]

Definition at line 79 of file pb_bufmgr_alt.c.

References assert, pb_manager::flush, pb_alt_manager(), pb_alt_manager::provider1, and pb_alt_manager::provider2.

00080 {
00081    struct pb_alt_manager *mgr = pb_alt_manager(_mgr);
00082    
00083    assert(mgr->provider1->flush);
00084    if(mgr->provider1->flush)
00085       mgr->provider1->flush(mgr->provider1);
00086    
00087    assert(mgr->provider2->flush);
00088    if(mgr->provider2->flush)
00089       mgr->provider2->flush(mgr->provider2);
00090 }


Generated on Tue Sep 29 06:25:24 2009 for Gallium3D by  doxygen 1.5.4