bufferContextChain.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Filename: bufferContextChain.h
  2. // Created by: drose (16Mar06)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. #ifndef BUFFERCONTEXTCHAIN_H
  15. #define BUFFERCONTEXTCHAIN_H
  16. #include "pandabase.h"
  17. #include "linkedListNode.h"
  18. class BufferContext;
  19. ////////////////////////////////////////////////////////////////////
  20. // Class : BufferContextChain
  21. // Description : This class maintains a linked list of BufferContexts
  22. // that might be allocated on the graphics card in some
  23. // context. There is a different BufferContextChain for
  24. // resident textures, active textures, evicted textures,
  25. // etc.
  26. //
  27. // The primary purpose of this class is to facilitate
  28. // PStats reporting of graphics memory usage.
  29. ////////////////////////////////////////////////////////////////////
  30. class EXPCL_PANDA_GOBJ BufferContextChain : private LinkedListNode {
  31. public:
  32. INLINE BufferContextChain();
  33. INLINE ~BufferContextChain();
  34. INLINE size_t get_total_size() const;
  35. INLINE int get_count() const;
  36. BufferContext *get_first();
  37. void take_from(BufferContextChain &other);
  38. void write(ostream &out, int indent_level) const;
  39. private:
  40. INLINE void adjust_bytes(int delta);
  41. size_t _total_size;
  42. int _count;
  43. friend class BufferContext;
  44. };
  45. #include "bufferContextChain.I"
  46. #endif