Panda3D
|
00001 // Filename: bufferContextChain.h 00002 // Created by: drose (16Mar06) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef BUFFERCONTEXTCHAIN_H 00016 #define BUFFERCONTEXTCHAIN_H 00017 00018 #include "pandabase.h" 00019 #include "linkedListNode.h" 00020 00021 class BufferContext; 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Class : BufferContextChain 00025 // Description : This class maintains a linked list of BufferContexts 00026 // that might be allocated on the graphics card in some 00027 // context. There is a different BufferContextChain for 00028 // resident textures, active textures, evicted textures, 00029 // etc. 00030 // 00031 // The primary purpose of this class is to facilitate 00032 // PStats reporting of graphics memory usage. 00033 //////////////////////////////////////////////////////////////////// 00034 class EXPCL_PANDA_GOBJ BufferContextChain : private LinkedListNode { 00035 public: 00036 INLINE BufferContextChain(); 00037 INLINE ~BufferContextChain(); 00038 00039 INLINE size_t get_total_size() const; 00040 INLINE int get_count() const; 00041 00042 BufferContext *get_first(); 00043 00044 void take_from(BufferContextChain &other); 00045 00046 void write(ostream &out, int indent_level) const; 00047 00048 private: 00049 INLINE void adjust_bytes(int delta); 00050 size_t _total_size; 00051 int _count; 00052 00053 friend class BufferContext; 00054 }; 00055 00056 #include "bufferContextChain.I" 00057 00058 #endif 00059