From: Yair Kurzion (yair++at++polygon.engr.sgi.com)
Date: 04/19/2000 15:59:03
Hello There !
> 2) I want to move my streamline calculations into the COMPUTE process. My
> machine has 8 CPUs and I am only doing one CULL_DRAW process, so I should
> have plenty of CPUs for it. The documentation on the COMPUTE process is
> sketchy at best, and I couldn't find any examples on how to do it. Can
> someone give me some pointers on using it? In particular, how, when, and
> where do I set it up, and how do I pass data into and out of it.
'man pfCompute' contains all the relevant API.
Using a COMPUTE process is almost identical to using a DBASE process, so any
DBASE process sample code should help too.
> Also, how
> can I turn it on and off. I only want to recalculate when the streamlines
> are being moved.
Every time a COMPUTE frame finishes, the next APP frame will send COMPUTE for
another frame. Your function gets called once every COMPUTE frame, so you can
decide how much work it should do based on flags that your APP sets. If it
doesn't do any work, it will sleep until the APP process starts a new APP frame
and dispatches COMPUTE for a new frame.
> An example would be extremely helpful. Particularly a
> simple but non-trivial example.
Take a look at /usr/share/Performer/src/pguide/libpf/C/flux_chase.c
It uses a DBASE process but is very similar to what you need.
Since you want to perform all your computations in an asynchronous process
(COMPUTE), all the output of your asynchronous frame should be in pfFlux
buffers. If you currently control your sphere geometry with a pfDCS, you have
to use a pfFCS instead (see man page).
One more note on using Asynchronous Performer processes and pfFlux buffers: If
your asynchronous process stores its results in more than one output buffer,
you may wish to sync all these output buffers together. In your case, you
produce two outputs:
1. The eye point sphere.
2. The streamline geometry.
Since COMPUTE (or any other Asynchronous process) may take more than a single
APP frame to finish, you want to make sure that its two outputs become visible
at exactly the same APP frame. You can achieve this by using a SyncGroup on
your output pfFlux buffers (see man pfFlux).
The program flux_chase.c shows how to enable a sync-group in order to
synchronize the changes of a collection of pfFlux buffers - all modified in the
DBASE process.
-yair
--
\_________ \_____ \__ \__ \_____ Yair Kurzion
\_________ \_____ \__ \__ \_____ yair++at++sgi.com
\__ \__ \____\__ \__ http://reality.sgi.com/yair
\__ \__ \__ Work: (650) 933-6502
\__ \__ \__ Home: (408) 226-9771
\__ \__ \__
This archive was generated by hypermail 2b29 : Wed Apr 19 2000 - 15:59:27 PDT