#pragma once #include "DXBuffer.h" #ifdef WIN32 struct ID3D11Buffer; struct D3D11_BUFFER_DESC; struct ID3D11ShaderResourceView; struct ID3D11Device; struct ID3D11DeviceContext; #endif namespace Framework { #ifdef WIN32 //! A buffer with data in graphics memory class DX11Buffer : public DXBuffer { protected: D3D11_BUFFER_DESC* description; ID3D11Buffer* buffer; ID3D11Device* device; ID3D11DeviceContext* context; Critical& deviceLock; public: //! Constructor //! eSize: The length of an element in bytes DLLEXPORT DX11Buffer(int eSize, ID3D11Device* device, ID3D11DeviceContext* context, int bindFlags, Critical& deviceLock); //! Destructor DLLEXPORT virtual ~DX11Buffer(); //! Copies the data into the buffer if it has changed DLLEXPORT virtual void copyToGPU(__int64 byteCount = -1) override; //! Returns the buffer DLLEXPORT ID3D11Buffer* zBuffer() const; }; //! A buffer of indices from the vertex buffer, where every three //! form a triangle that is drawn class DX11StructuredBuffer : public DX11Buffer { private: ID3D11ShaderResourceView* view; public: //! Constructor //! eSize: The length of an element in bytes DLLEXPORT DX11StructuredBuffer(int eSize, ID3D11Device* device, ID3D11DeviceContext* context, Critical& deviceLock); //! Destructor DLLEXPORT virtual ~DX11StructuredBuffer(); //! Copies the data into the buffer if it has changed DLLEXPORT void copyToGPU(__int64 byteCount = -1) override; //! Returns the used shader resource view DLLEXPORT operator ID3D11ShaderResourceView*() const; }; #endif } // namespace Framework