buffer_filler.h 518 B

123456789101112131415161718192021222324
  1. #ifndef __BUFFER_FILLER_H__
  2. #define __BUFFER_FILLER_H__
  3. #include <d3d11.h>
  4. #include <vector>
  5. class BufferFiller {
  6. public:
  7. bool Fill(ID3D11Device* device, D3D11_TEXTURE2D_DESC desc, int maxCnt = 3);
  8. bool Reset();
  9. ID3D11Texture2D* GetCopy() { return _buffers[_copyIdx]; }
  10. ID3D11Texture2D* GetMap() { return _buffers[_mapIdx]; }
  11. void Clear();
  12. ~BufferFiller()
  13. {
  14. Clear();
  15. }
  16. private:
  17. int _mapIdx = 0;
  18. int _copyIdx = 0;
  19. std::vector<ID3D11Texture2D*> _buffers;
  20. };
  21. #endif