DX12Buffer.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include <d3d12.h>
  3. #include "DXBuffer.h"
  4. namespace Framework
  5. {
  6. class DX12CommandQueue;
  7. //! A buffer with data in graphics memory
  8. class DX12Buffer : public DXBuffer
  9. {
  10. protected:
  11. D3D12_RESOURCE_DESC* description;
  12. ID3D12Resource* buffer;
  13. ID3D12Device5* zDevice;
  14. DX12CommandQueue* queue;
  15. public:
  16. //! Constructor
  17. //! eSize: The length of an element in bytes
  18. DLLEXPORT DX12Buffer(int eSize,
  19. ID3D12Device5* zDevice,
  20. DX12CommandQueue* queue,
  21. int bindFlags);
  22. //! Destructor
  23. DLLEXPORT virtual ~DX12Buffer();
  24. //! Copies the data into the buffer if it has changed
  25. DLLEXPORT virtual void copyToGPU(__int64 byteCount = -1) override;
  26. DLLEXPORT void createBufferWithoutData(D3D12_RESOURCE_STATES states,
  27. D3D12_HEAP_TYPE heapType = D3D12_HEAP_TYPE_DEFAULT);
  28. //! Returns the buffer
  29. DLLEXPORT ID3D12Resource* zBuffer() const;
  30. };
  31. } // namespace Framework