Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: tracks VB allocations (and compressed/uncompressed vertex memory usage)
  4. //
  5. //===========================================================================//
  6. #ifndef IVBALLOCTRACKER_H
  7. #define IVBALLOCTRACKER_H
  8. #include "materialsystem/imaterialsystem.h"
  9. // By default, only enable this alloc tracking for a debug shaderapidx*.dll
  10. // (it uses about 0.25MB to track ~7000 allocations)
  11. #if defined(_DEBUG)
  12. #define ENABLE_VB_ALLOC_TRACKER 1
  13. #else
  14. #define ENABLE_VB_ALLOC_TRACKER 0
  15. #endif
  16. // This interface is actually exported by the shader API DLL.
  17. #define VB_ALLOC_TRACKER_INTERFACE_VERSION "VBAllocTracker001"
  18. // Interface to the VB mem alloc tracker
  19. abstract_class IVBAllocTracker
  20. {
  21. public:
  22. // This should be called wherever VertexBuffers are allocated
  23. virtual void CountVB( void * buffer, bool isDynamic, int bufferSize, int vertexSize, VertexFormat_t fmt ) = 0;
  24. // This should be called wherever VertexBuffers are freed
  25. virtual void UnCountVB( void * buffer ) = 0;
  26. // Track mesh allocations (set this before an allocation, clear it after)
  27. virtual bool TrackMeshAllocations( const char * allocatorName ) = 0;
  28. };
  29. #endif // IVBALLOCTRACKER_H