Ptex
|
#include <PtexCache.h>
Public Member Functions | |
PtexCachedReader (bool premultiply, PtexInputHandler *inputHandler, PtexErrorHandler *errorHandler, PtexReaderCache *cache) | |
~PtexCachedReader () | |
void | ref () |
int32_t | unref () |
virtual void | release () |
Release resources held by this pointer (pointer becomes invalid). More... | |
bool | tryPrune (size_t &memUsedChange) |
bool | tryPurge (size_t &memUsedChange) |
size_t | getMemUsedChange () |
size_t | getOpensChange () |
size_t | getBlockReadsChange () |
Public Member Functions inherited from PtexReader | |
PtexReader (bool premultiply, PtexInputHandler *inputHandler, PtexErrorHandler *errorHandler) | |
virtual | ~PtexReader () |
bool | needToOpen () const |
bool | open (const char *path, Ptex::String &error) |
void | prune () |
void | purge () |
void | setPendingPurge () |
bool | pendingPurge () const |
bool | tryClose () |
bool | ok () const |
bool | isOpen () |
void | invalidate () |
void | increaseMemUsed (size_t amount) |
void | logOpen () |
void | logBlockRead () |
virtual const char * | path () |
Path that file was opened with. More... | |
virtual Info | getInfo () |
virtual Ptex::MeshType | meshType () |
Type of mesh for which texture data is defined. More... | |
virtual Ptex::DataType | dataType () |
Type of data stored in file. More... | |
virtual Ptex::BorderMode | uBorderMode () |
Mode for filtering texture access beyond mesh border. More... | |
virtual Ptex::BorderMode | vBorderMode () |
Mode for filtering texture access beyond mesh border. More... | |
virtual Ptex::EdgeFilterMode | edgeFilterMode () |
Mode for filtering textures across edges. More... | |
virtual int | alphaChannel () |
Index of alpha channel (if any). More... | |
virtual int | numChannels () |
Number of channels stored in file. More... | |
virtual int | numFaces () |
Number of faces stored in file. More... | |
virtual bool | hasEdits () |
True if the file has edit blocks. More... | |
virtual bool | hasMipMaps () |
True if the file has mipmaps. More... | |
virtual PtexMetaData * | getMetaData () |
Access meta data. More... | |
virtual const Ptex::FaceInfo & | getFaceInfo (int faceid) |
Access resolution and adjacency information about a face. More... | |
virtual void | getData (int faceid, void *buffer, int stride) |
Access texture data for a face at highest-resolution. More... | |
virtual void | getData (int faceid, void *buffer, int stride, Res res) |
virtual PtexFaceData * | getData (int faceid) |
Access texture data for a face at highest-resolution as stored on disk. More... | |
virtual PtexFaceData * | getData (int faceid, Res res) |
virtual void | getPixel (int faceid, int u, int v, float *result, int firstchan, int nchannels) |
Access a single texel from the highest resolution texture . More... | |
virtual void | getPixel (int faceid, int u, int v, float *result, int firstchan, int nchannels, Ptex::Res res) |
Access a single texel for a face at a particular resolution. More... | |
DataType | datatype () const |
int | nchannels () const |
int | pixelsize () const |
const Header & | header () const |
const ExtHeader & | extheader () const |
const LevelInfo & | levelinfo (int level) const |
Public Member Functions inherited from PtexTexture | |
virtual void | getData (int faceid, void *buffer, int stride, Ptex::Res res)=0 |
Access texture data for a face at a specific resolution. More... | |
virtual PtexFaceData * | getData (int faceid, Ptex::Res res)=0 |
Access texture data for a face at a specific resolution as stored on disk. More... | |
Private Member Functions | |
bool | trylock () |
void | unlock () |
Private Attributes | |
PtexReaderCache * | _cache |
volatile int32_t | _refCount |
size_t | _memUsedAccountedFor |
size_t | _opensAccountedFor |
size_t | _blockReadsAccountedFor |
PtexLruItem | _openFilesItem |
PtexLruItem | _activeFilesItem |
Friends | |
class | PtexReaderCache |
Additional Inherited Members | |
Static Public Member Functions inherited from PtexTexture | |
static PtexTexture * | open (const char *path, Ptex::String &error, bool premultiply=0) |
Open a ptex file for reading. More... | |
Protected Types inherited from PtexReader | |
typedef PtexHashMap< ReductionKey, FaceData * > | ReductionMap |
Protected Member Functions inherited from PtexReader | |
void | setError (const char *error) |
FilePos | tell () |
void | seek (FilePos pos) |
void | closeFP () |
bool | reopenFP () |
bool | readBlock (void *data, int size, bool reportError=true) |
bool | readZipBlock (void *data, int zipsize, int unzipsize) |
Level * | getLevel (int levelid) |
uint8_t * | getConstData () |
FaceData * | getFace (int levelid, Level *level, int faceid, Res res) |
void | readFaceInfo () |
void | readLevelInfo () |
void | readConstData () |
void | readLevel (int levelid, Level *&level) |
void | readFace (int levelid, Level *level, int faceid, Res res) |
void | readFaceData (FilePos pos, FaceDataHeader fdh, Res res, int levelid, FaceData *&face) |
void | readMetaData () |
void | readMetaDataBlock (MetaData *metadata, FilePos pos, int zipsize, int memsize, size_t &metaDataMemUsed) |
void | readLargeMetaDataHeaders (MetaData *metadata, FilePos pos, int zipsize, int memsize, size_t &metaDataMemUsed) |
void | readEditData () |
void | readEditFaceData () |
void | readEditMetaData () |
FaceData * | errorData (bool deleteOnRelease=false) |
void | computeOffsets (FilePos pos, int noffsets, const FaceDataHeader *fdh, FilePos *offsets) |
Protected Member Functions inherited from PtexTexture | |
virtual | ~PtexTexture () |
Destructor not for public use. Use release() instead. More... | |
Protected Attributes inherited from PtexReader | |
Mutex | readlock |
DefaultInputHandler | _defaultIo |
PtexInputHandler * | _io |
PtexErrorHandler * | _err |
bool | _premultiply |
bool | _ok |
bool | _needToOpen |
bool | _pendingPurge |
PtexInputHandler::Handle | _fp |
FilePos | _pos |
std::string | _path |
Header | _header |
ExtHeader | _extheader |
FilePos | _faceinfopos |
FilePos | _constdatapos |
FilePos | _levelinfopos |
FilePos | _leveldatapos |
FilePos | _metadatapos |
FilePos | _lmdheaderpos |
FilePos | _lmddatapos |
FilePos | _editdatapos |
int | _pixelsize |
uint8_t * | _constdata |
MetaData * | _metadata |
bool | _hasEdits |
std::vector< FaceInfo > | _faceinfo |
std::vector< uint32_t > | _rfaceids |
std::vector< LevelInfo > | _levelinfo |
std::vector< FilePos > | _levelpos |
std::vector< Level * > | _levels |
std::vector< MetaEdit > | _metaedits |
std::vector< FaceEdit > | _faceedits |
ReductionMap | _reductions |
std::vector< char > | _errorPixel |
z_stream_s | _zstream |
size_t | _baseMemUsed |
volatile size_t | _memUsed |
volatile size_t | _opens |
volatile size_t | _blockReads |
Definition at line 108 of file PtexCache.h.
|
inline |
Definition at line 130 of file PtexCache.h.
|
inline |
Definition at line 136 of file PtexCache.h.
|
inline |
Definition at line 187 of file PtexCache.h.
References PtexReader::_blockReads, and _blockReadsAccountedFor.
Referenced by PtexReaderCache::processMru().
|
inline |
Definition at line 173 of file PtexCache.h.
References PtexReader::_memUsed, and _memUsedAccountedFor.
Referenced by PtexReaderCache::processMru(), tryPrune(), and tryPurge().
|
inline |
Definition at line 180 of file PtexCache.h.
References PtexReader::_opens, and _opensAccountedFor.
Referenced by PtexReaderCache::processMru().
|
inline |
Definition at line 138 of file PtexCache.h.
References _refCount, and AtomicCompareAndSwap().
Referenced by PtexReaderCache::get(), and PtexReaderCache::purge().
|
virtual |
Release resources held by this pointer (pointer becomes invalid).
Reimplemented from PtexReader.
Definition at line 83 of file PtexCache.cpp.
References _cache, PtexReaderCache::logRecentlyUsed(), and unref().
|
inlineprivate |
Definition at line 119 of file PtexCache.h.
References _refCount, and AtomicCompareAndSwap().
Referenced by tryPrune(), and tryPurge().
|
inline |
Definition at line 152 of file PtexCache.h.
References getMemUsedChange(), PtexReader::prune(), trylock(), and unlock().
Referenced by PtexReaderCache::pruneData().
|
inline |
Definition at line 162 of file PtexCache.h.
References getMemUsedChange(), PtexReader::purge(), PtexReader::setPendingPurge(), trylock(), and unlock().
Referenced by PtexReaderCache::Purger::operator()(), and PtexReaderCache::purge().
|
inlineprivate |
Definition at line 124 of file PtexCache.h.
References _refCount, and AtomicStore().
Referenced by tryPrune(), and tryPurge().
|
inline |
Definition at line 146 of file PtexCache.h.
References _refCount, and AtomicDecrement().
Referenced by PtexReaderCache::get(), PtexReaderCache::purge(), and release().
|
friend |
Definition at line 117 of file PtexCache.h.
|
private |
Definition at line 116 of file PtexCache.h.
|
private |
Definition at line 114 of file PtexCache.h.
Referenced by getBlockReadsChange().
|
private |
Definition at line 110 of file PtexCache.h.
Referenced by release().
|
private |
Definition at line 112 of file PtexCache.h.
Referenced by getMemUsedChange().
|
private |
Definition at line 115 of file PtexCache.h.
|
private |
Definition at line 113 of file PtexCache.h.
Referenced by getOpensChange().
|
private |