From: Siedle, Pete (P.Siedle++at++tees.ac.uk)
Date: 08/06/2001 08:41:41
pfHi
I'm starting to look at using pfFlux's to get some code I have working on a
multi-processor platform / app.
I'm having some problems understanding their use and hoped someone might be
able to shed some light on the matter. I've had a look at the Performer
examples and prog guide but they seem too complicated and sparse
(respectively) to enable me to get my head around!
The code I'm working on is for a vega app, by the way, but I'm having to
embed Performer to get the particular functionality I need!
From reading the prog guide I think I get the concept of why a flux is used
(so each process uses it's own version of the data in a flux, and so the
processes don't corrupt the 'singley' held data and thereby cause the app to
fall over).
However, once I create a pfFlux by doing
pfFlux *flux = pfNewFlux(sizeof (udata), PFFLUX_DEFAULT_NUM_BUFFERS,
vgGetSharedArena());
how do I load my data into the flux, change / alter the data in the flux,
etc?
Anyone out there with a link to a simple explanation / example of pfFlux
use?
Thanks for any help, all advice most welcome (as ever :o)
Pete
PS.
To be a little more detailed: my code has a user defined structure which
holds a load of variables for the app; eg
typedef struct
{
pfTexture *tex;
pfTexEnv *tenv;
float x;
float y;
float z;
}udata;
and in my code I do:
udata *mydata;
....
/*create data struc in shared area*/
mydata = vgMalloc(sizeof(udata), vgGetSharedArena());
/*initialise struct data*/
mydata->tex = pfNewTex(vgGetSharedArena());
if(!pfLoadTexFile(mydata->tex, "psLightmap.rgba"))printf("couldn't find
psLightmap.rgba texture to load\n");
mydata->tenv = pfNewTEnv(vgGetSharedArena());
mydata->x = 0.0; mydata->x = 1.0; mydata->x = 2.0;
Anyway, my code uses the above described data struc and works fine if the
app is run in single proc mode, but crashes out in multi-proc mode. I was
told that I need to handle the 'mydata' struct in a multi-proc manner, ie
use pfFlux's!?!?
So my question is how do you get the mydata data into a pfFlux and use it
(if this is the correct terminology)?
This archive was generated by hypermail 2b29 : Mon Aug 06 2001 - 08:42:09 PDT