pfCycleBuffer addition crashes application

New Message Reply Date view Thread view Subject view Author view

Brian Furtaw (brian++at++sgi.com)
Thu, 5 Sep 1996 16:02:52 -0400


I took some working code and added a pfCycleBuffer to remove cracking in the
surface I am generating. Now when I run the program I get a coredump everytime.
I am using Performer-2.0 on IRIX-6.2 does anyone have suggestions as to why
this might be happening.

Exhibit A: The code, first line is where I add the CycleBuffer last line of
code is where it coredumps. This is code to setup an indexed pfGeoSet of QUADS.

  // setup a CycleBuffer to time the swap between APP and DRAW phases
    pfCycleBuffer *coords = new(pfGetSharedArena())
pfCycleBuffer(sizeof(pfVec3) * nxg * nyg);
    ushort *vertexlist = (ushort*) new(4 * nxg * nyg * sizeof(ushort))
pfMemory;

    pfVec3 *oceanCoords = seagrid.vector = (pfVec3 *) coords->getCurData();
    seagrid.vertexlist = vertexlist;
    // XXXX Call Mike's VOA init routine
    vOcean_init();

    int yidx=0;
    voa_update_physics();
    coords->changed();
    uint vlidx = 0;
   pfVec4 *colors = (pfVec4*) new(8*sizeof(pfVec4)) pfMemory;
    colors[0].set(1.0f, 0.0f, 0.0f, 1.0f);
    colors[1].set(0.0f, 1.0f, 0.0f, 1.0f);
    colors[2].set(0.0f, 0.0f, 1.0f, 1.0f);
    colors[3].set(1.0f, 0.0f, 1.0f, 1.0f);
    colors[4].set(1.0f, 1.0f, 0.0f, 1.0f);
    colors[5].set(1.0f, 1.0f, 1.0f, 1.0f);
    colors[6].set(0.0f, 0.0f, 0.0f, 1.0f);
    colors[7].set(0.0f, 1.0f, 1.0f, 1.0f);

    ushort *colorlist = (ushort*) new(4*numOfPrims*sizeof(ushort)) pfMemory;
    for (int clist_idx =0; clist_idx < 4*numOfPrims; clist_idx++)
       colorlist[clist_idx] = 5; //clist_idx % 8;

    pfVec2 *texcoords = (pfVec2*) new(numOfVertices*sizeof(pfVec2)) pfMemory;
    vlidx = 0;
    for ( yidx=0; yidx < voHeight; yidx++) {
       for( int xidx=0; xidx < voWidth; xidx++) {
            texcoords[vlidx++].set((float)xidx/15.0f, (float)yidx/15.0f);
       }
    }

    ushort *texlist = (ushort*) new(4*numOfPrims*sizeof(ushort)) pfMemory;
    vlidx = 0;
    for ( yidx=0; yidx < (voHeight - 1); yidx++) {
       for( int xidx=0; xidx < (voWidth - 1); xidx++) {
            texlist[vlidx++] = (yidx * voHeight) + xidx;
            texlist[vlidx++] = (yidx * voHeight) + xidx + 1;
            texlist[vlidx++] = ((yidx + 1) * voHeight) + xidx + 1;
            texlist[vlidx++] = ((yidx + 1) * voHeight) + xidx ;
       }
    }
    pfVec3 *norms = (pfVec3 *) new(sizeof(pfVec3)*numOfPrims) pfMemory;
    ushort *n_ilist = (ushort *) new(sizeof(ushort)*numOfPrims) pfMemory;
    computeNormals(oceanCoords, vertexlist, norms,n_ilist, numOfPrims);

    pfMaterial *mtl = new pfMaterial;
    mtl->setColor(PFMTL_SPECULAR, 0.0f, 0.6f, 0.6f);
    mtl->setColorMode(PFMTL_FRONT, PFMTL_CMODE_AD);
    gstate->setAttr(PFSTATE_FRONTMTL, (void *)mtl);

    pfGeoSet *gset = new pfGeoSet;
    gset->setAttr(PFGS_COORD3, PFGS_PER_VERTEX, coords, vertexlist);
    gset->setAttr(PFGS_TEXCOORD2, PFGS_PER_VERTEX, texcoords, texlist);
    gset->setAttr(PFGS_COLOR4, PFGS_PER_VERTEX, colors, colorlist);
    gset->setAttr(PFGS_NORMAL3, PFGS_PER_PRIM, norms, n_ilist);
    gset->setPrimType(PFGS_QUADS);
    gset->setNumPrims(numOfPrims);
    gset->setGState(gstate);
    /*pfPrint(gset, 1, NULL);*/
    // set up scene graph
    pfGeode *geode1 = new pfGeode;
perfly.C:429 HERE==> geode1->setName("virtOcean");

Exhibit B: The stack trace,
cvd> where
> 0 _pfHashTable::enter(<stripped>) ["pfLists.C":233, 0x5e9437e4]
   1 pfNode::nb_setName(<stripped>) ["pfNode.C":347, 0x5e8f9088]
   2 initSceneGraph(scene = 0x1808ff80) ["perfly.C":429, 0x00413f4c]
   3 InitScene() ["generic.C":349, 0x00409928]
   4 main(argc = 19, argv = 0x7fff2ec4) ["main.C":111, 0x0041a4c4]
   5 __istart(<stripped>) ["crt1tinit.s":13, 0x00407d90]

Could someone explain what the pfHashTable is?

Brian

-- 
o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o

Brian Furtaw (brian++at++sgi.com) RSE Graphics/Communications Office: (301) 572-3293 Silver Spring, MD Fax: (301) 572-3280 ======================================================================= 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:30 PDT

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