pfNode::isect() problems

New Message Reply Date view Thread view Subject view Author view

From: Jason Daly (jdaly++at++ist.ucf.edu)
Date: 07/05/2001 13:11:37


Hello all,

We seem to run into problems when we run a pfNode::isect() that would return
a pfPath object longer than 32 entries (we are including PFTRAV_IS_PATH).
The next call to pfFrame() after the call to isect() crashes the program
with a seg fault. dbx says the seg fault occurs in nb_cull and it seems to be
at one of the nodes that was intersected with (based on pointer addresses).

To test, we created a scene that had up to 40 pfGroups in the hierarchy
above the pfGeode. The magic number appears to be 32. Any deeper than this,
and the program crashes.

We're only using one segment in the intersection test, and we're not using
a discriminator callback (relevant code below). We get the same behavior on
an O2, an Octane MXE, and an Onyx RE2. All machines are running IRIX 6.5.11
with Performer 2.4. I tried running the program with PFNFYLEVEL at 7, but I
didn't see anything out of the ordinary. I also tried under Linux (both 2.3.1
and 2.4). Oddly enough, I get similar behavior under 2.3.1, but 2.4 for Linux
works fine.

Any insight into this problem would be greatly appreciated.
Thanks!

Code snippet:

    // Do all of the intersection stuff that we set out to do
    pfSegSet segset;
    pfVec3 startPt, endPt;
    pfHit **hits[PFIS_MAX_SEGS];
    int sectFlags;
    pfPath *hitPath;

    segset.mode = PFTRAV_IS_PRIM | PFTRAV_IS_NORM | PFTRAV_IS_PATH;
    segset.userData = NULL;
    segset.activeMask = 0x0001;
    segset.isectMask = 0xFFFFFFFF;
    segset.bound = NULL;
    segset.discFunc = NULL;
    startPt.set(0.0, 0.0, -100.0);
    endPt.set(0.0, 0.0, 100.0);
    segset.segs[0].makePts(startPt, endPt);

    // Simulate for twenty seconds.
    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);

        scene->isect(&segset, hits);

        (hits[0][0])->query(PFQHIT_FLAGS, &sectFlags);
        if (sectFlags & PFHIT_POINT)
        {
            (hits[0][0])->query(PFQHIT_PATH, &hitPath);
            if (hitPath)
            {
                for (int loop = 0; loop < hitPath->getNum(); loop++)
                    printf("pfPath: %p\n", hitPath->get(loop));
                printf("\n");
            }

        }
    }

Debug output of the program (on an O2):

pfPath (0): 64083d90
pfPath (1): 64037ee0
pfPath (2): 6403aed0
pfPath (3): 6403af50
pfPath (4): 6403afd0
pfPath (5): 6403b050
pfPath (6): 6403b0d0
pfPath (7): 6403b150
pfPath (8): 6403b1d0
pfPath (9): 6403b250
pfPath (10): 6403b2d0
pfPath (11): 6403b350
pfPath (12): 6403b3d0
pfPath (13): 6403b450
pfPath (14): 6403b4d0
pfPath (15): 6403bbc0
pfPath (16): 6403bc40
pfPath (17): 6403bcc0
pfPath (18): 6403bd40
pfPath (19): 6403bdc0
pfPath (20): 6403be40
pfPath (21): 6403bec0
pfPath (22): 6403bf40
pfPath (23): 6403bfc0
pfPath (24): 6403c040
pfPath (25): 6403c0c0
pfPath (26): 6403c140
pfPath (27): 6403c1c0
pfPath (28): 6403c240
pfPath (29): 6403c2c0
pfPath (30): 6403c340
pfPath (31): 6403c3c0
pfPath (32): 6403c440
pfPath (33): 6403c4c0
pfPath (34): 6403c540
pfPath (35): 6403c5c0
pfPath (36): 6403c640
pfPath (37): 6403c6c0
pfPath (38): 6403c740
pfPath (39): 6403c7c0
pfPath (40): 6403c840
pfPath (41): 64042cb0
pfPath (42): 64045540

Stack trace from dbx:

(dbx) where
> 0 pfGroup::nb_cull(int,int,_pfCuller*)(0x6403c4c0, 0x7, 0xc000003, 0x640c6020, 0x0, 0x0, 0x22, 0x0) ["/build/perfbuild/perftot0/perf/lib/libpf/pfGroup.C":286, 0x3a2a377c]
   1 pfGroup::nb_cull(int,int,_pfCuller*)(0x6403c440, 0x7, 0xc000003, 0x640c6020, 0x0, 0x0, 0x22, 0x0) ["/build/perfbuild/perftot0/perf/lib/libpf/pfGroup.C":286, 0x3a2a3774]

   (next 30 levels are almost the same)

   32 pfGroup::nb_cull(int,int,_pfCuller*)(0x64037ee0, 0x7, 0xc000003, 0x640c6020, 0x0, 0x0, 0x22, 0x0) ["/build/perfbuild/perftot0/perf/lib/libpf/pfGroup.C":286, 0x3a2a3774]
   33 pfScene::nb_cull(int,int,_pfCuller*)(0x64083d90, 0x7, 0xc000003, 0x640c6020, 0x6403c540, 0xffffffff, 0x0, 0x6403c540) ["/build/perfbuild/perftot0/perf/lib/libpf/pfScene.C":293, 0x3a2df0d8]
   34 _pfCuller::nb_cull(void)(0x640c6020, 0x7, 0xc000003, 0x640c6020, 0x6403c540, 0x288, 0x22, 0x6403c540) ["/build/perfbuild/perftot0/perf/lib/libpf/pfCuller.C":216, 0x3a324c80]
   35 ::beginDraw(int)(0x6403c53f, 0x7, 0xc000003, 0x640c6020, 0x6403c540, 0x288, 0x22, 0x6403c540) ["/build/perfbuild/perftot0/perf/lib/libpf/pfProcess.C":7160, 0x3a34c6d0]
   36 ::pfDraw(0x6403c53f, 0x7, 0xc000003, 0x640c6020, 0x6403c540, 0x288, 0x22, 0x6403c540) ["/build/perfbuild/perftot0/perf/lib/libpf/pfProcess.C":7212, 0x3a34c8b8]
   37 ::cbdraw(pfChannel*,void*)(0x6403c53f, 0x7, 0xc000003, 0x640c6020, 0x6403c540, 0x288, 0x22, 0x6403c540) ["/build/perfbuild/perftot0/perf/lib/libpf/pfChannel.C":73, 0x3a2edf6c]
   38 ::doDraw(pfChannel*,pfPipe*,int*)(0x64088150, 0x3, 0x7fff2820, 0x640c6020, 0x6403c540, 0x288, 0x22, 0x6403c540) ["/build/perfbuild/perftot0/perf/lib/libpf/pfProcess.C":7068, 0x3a34c43c]
More (n if no)?y
   39 ::appCullDraw(int)(0x0, 0x0, 0xc000003, 0x640c6020, 0x6403c540, 0x0, 0x22, 0x6403c540) ["/build/perfbuild/perftot0/perf/lib/libpf/pfProcess.C":4669, 0x3a347930]
   40 ::pfFrame(0x6403c53f, 0x1, 0x0, 0x0, 0x6403c540, 0x0, 0x0, 0x0) ["/build/perfbuild/perftot0/perf/lib/libpf/pfProcess.C":5149, 0x3a348f3c]
   41 ::main(argc = 2, argv = 0x7fff2f34) ["/export/disk2/projects/vr2/projects/vess/usr/bkline/vess/test/pfSimple.c++":135, 0x100032ec]
   42 __start() ["/xlv55/kudzu-apr12/work/irix/lib/libc/libc_n32_M3/csu/crt1text.s":177, 0x10002b58]

--"J"

"I'm a castaway stranded in a desolate land,
 I can see the footprints in the virtual sand."
        --Neil Peart


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Jul 05 2001 - 13:09:41 PDT

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