Re: Accumulation

New Message Reply Date view Thread view Subject view Author view

Bernard Leclerc (bleclerc++at++cae.ca)
Tue, 30 Jul 1996 19:02:45 -0400


On Jul 29, 2:39pm, Spencer, Dan wrote:

> I use an accumulation buffer to simulate depth of field effects on an onyx.
>
> I have set up the acsize(16) etc.
>
> I have a gl (old gl) program which calls:
>
> acbuf(AC_ACCUMULATE,1.0)
>
> And takes very little time ( less than 20 milli secs), giving me frame
> rates greater than 36 Hertz for a single pass.
>
> BUT, when I use this same call from within a Performer draw callback, it
> takes over
>
> 250 milli seconds, giving me frame rates of about 4 Hz (on a single pass).
> (It has been set up in the same way )
>
> Both programs function correctly in the same way (but of course one is MUCH
> slower than the other), and no warnings etc are produced.
>
> Is there's something extra to do in Performer ?
> Whats going on ?
>
> ( I used gettimeofday to time the actual function call).

Dan,

We had the same problem here a while ago. We discovered the accumulation is not
always done by the graphics hardware. In your case, it is obvious the acbuf is
soft!!! BTW, don't use gettimeofday(), try pfGetTime() - it's more precise.

Attached is a version of simple.C I've used to perform timing on acbuf()
operation. Notice I haven't used pfGetTime(). Instead, I use the normal stats
to compare the execution time.

--
Bernard Leclerc			CAE Electronics Ltd., 8585 Cote De Liesse
Technical Leader		Saint-Laurent, Quebec, Canada, H4L-4X4
3-D Graphics Applications	tel: +1 514 341 2000 extension 2275
bleclerc++at++cae.ca			fax: +1 514 340 5496

// acbuf.C: Based on simple.C -- to perform timing on acbuf operations

#include <stdlib.h>

#include <Performer/pf/pfChannel.h> #include <Performer/pf/pfLightSource.h> #include <Performer/pf/pfNode.h> #include <Performer/pf/pfScene.h> #include <Performer/pf/pfPipeWindow.h>

#include <Performer/pfutil.h> #include <Performer/pfdu.h>

#include <gl.h>

// Usage() -- print usage advice and exit. static void Usage (char *pgm) { pfNotify(PFNFY_FATAL, PFNFY_USAGE, "Usage: %s file.ext\n", pgm); exit(1); }

// DrawFunc() -- Channel DRAW process callback static void drawFunc(pfChannel *chan, void *data) { data;

chan->clear(); chan->drawStats();

pfDraw();

acbuf(AC_CLEAR, 0.0f); acbuf(AC_CLEAR_ACCUMULATE, 1.0f); acbuf(AC_ACCUMULATE, 1.0f); acbuf(AC_RETURN, 1.0f); acbuf(AC_MULT, 0.8f);

}

// PipeConfigFunc() -- To configure the Frame Buffer static void PipeConfigFunc(pfPipeWindow *pw) { pw->open();

stensize(1); acsize(12); RGBsize(12); zbsize(32); mssize(8,24,1); gconfig();

pfNotify(PFNFY_NOTICE, PFNFY_RESOURCE, "mssize(%d, %d, %d) Zrange %#8x - %#8x\n", getgconfig(GC_MS_SAMPLES), PF_ABS(getgconfig(GC_BITS_MS_ZBUFFER)), getgconfig(GC_BITS_MS_STENCIL), getgconfig(GC_MS_ZMIN), getgconfig(GC_MS_ZMAX));

pfNotify(PFNFY_NOTICE, PFNFY_RESOURCE, "zbsize(%d) Zrange %#8x - %#8x\n", PF_ABS(getgconfig(GC_BITS_ZBUFFER)), getgconfig(GC_ZMIN), getgconfig(GC_ZMAX));

pfNotify(PFNFY_NOTICE, PFNFY_RESOURCE, "acsize(%d) RBGsize(%d) stensize(%d)\n", getgconfig(GC_BITS_ACBUF), getgconfig(GC_BITS_RED), getgconfig(GC_BITS_STENCIL));

acbuf(AC_CLEAR,0.0f);

}

// Main() -- Main program int main (int argc, char *argv[]) { if (argc < 2) Usage(argv[0]); // Initialize Performer pfInit(); // Use default multiprocessing mode based on number of // processors. pfMultiprocess( PFMP_DEFAULT ); // Load all loader DSO's before pfConfig() forks pfdInitConverter(argv[1]);

// initiate multi-processing mode set in pfMultiprocess call // FORKs for Performer processes, CULL and DRAW, etc. happen here. pfConfig(); // Append to Performer search path, PFPATH, files in // /usr/share/Performer/data */ pfFilePath(".:/usr/share/Performer/data"); pfNode *root = pfdLoadFile(argv[1]); if (root == NULL) { pfExit(); exit(-1); } // Attach loaded file to a new pfScene pfScene *scene = new pfScene; scene->addChild(root); // Create a pfLightSource and attach it to scene scene->addChild(new pfLightSource); // Configure and open GL window pfPipe *p = pfGetPipe(0); pfPipeWindow *pw = new pfPipeWindow(p); //pw->setWinType(PFPWIN_TYPE_X); pw->setName("IRIS Performer"); pw->setOriginSize(0,0,640,480); pw->setConfigFunc(PipeConfigFunc); pw->config(); // Create and configure a pfChannel. pfChannel *chan = new pfChannel(p); chan->setScene(scene); chan->setFOV(45.0f, 0.0f); chan->setTravFunc(PFTRAV_DRAW,drawFunc); // determine extent of scene's geometry pfSphere bsphere; root->getBound(&bsphere); chan->setNearFar(1.0f, 10.0f * bsphere.radius); // Simulate for twenty seconds. float t = 0.0f; while (t < 20.0f) { pfCoord view; float s, c; // Go to sleep until next frame time. pfSync(); // Initiate cull/draw for this frame. pfFrame(); // Compute new view position. t = pfGetTime(); pfSinCos(45.0f*t, &s, &c); view.hpr.set(45.0f*t, -10.0f, 0); view.xyz.set(2.0f * bsphere.radius * s, -2.0f * bsphere.radius *c, 0.5f * bsphere.radius); chan->setView(view.xyz, view.hpr); } // Terminate parallel processes and exit pfExit(); return 0; }

======================================================================= List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/ Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:53:14 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.