[info-performer] getUserData() routines on pfImageTiles/pfImageCaches

Date view Thread view Subject view Author view

From: Patrick J Melody - CONTRACTOR (melody++at++cmf.nrl.navy.mil)
Date: 02/28/2005 15:00:51


I'm having problems with pfImageTiles/pfImageCaches and the
pfObject::getUserData routines.

i have a class called Loader whose objects are created at runtime based
on user input. Loaders know all about what files/sockets/algorithms are
needed to load/compute a cliptexture tile's texels.

i want to have a custom cliptexture tile reader function that looks like
this:

extern "C" int CliptextureTileReaderCallback(pfImageTile* itile, int nTexels)
{
     int level, s, t, dummy;
     itile->getImageCache()->getImageSize(&level, NULL, NULL);
     itile->getTileIndex(&s, &t, &dummy);

     Loader* l = /* figure this out by inspecting itile somehow */;
     bool success = l->loadTileBuffer(level, s, t,
                                      itile->getMem(),
                                      nTexels*itile->getFileImageTexelSize());
     return success*nTexels;
}

My initial idea was to say:

void attachLoaderToCliptex(pfClipTexture* cliptex, Loader* loader)
{
     int slot = pfObject::getNamedUserDataSlot("MyLoaderSlot");
     for (int i = 0; i < cliptex->getNumClippedLevels(); i++)
         cliptex->getLevel(i)->setUserData(slot, loader);
}

then in CliptextureTileReaderCallback() say:

     int slot = pfObject::getNamedUserDataSlot("MyLoaderSlot");
     Loader* l = (Loader*)itile->getImageCache()->getUserData(slot);

this fails even in single process single pipe mode. some printf's reveal
that the pfImageCaches that the incoming pfImageTiles belong to are not
the same caches that i attached the user data to. is there an
explanation for this, or some kind of work around? eventually i need
to have multiple cliptextures that are combined using multipass or
programmable shaders. (this whole technique is also part of a way
to work around the fact that cliptextures cannot be deleted: if all
my cliptexes are in a canonical format, i can effectively load new ones
by attaching new Loader objects to the imagecaches and doing a
pfuReallyInvalidateCliptexture(), but i haven't gotten to that point
yet.)

- patrick melody


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Feb 28 2005 - 15:01:18 PST