#pragma once #include "Critical.h" #include "OperatingSystem.h" #include "ReferenceCounter.h" namespace Framework { class DX12CopyCommandQueue; class DX12DirectCommandQueue; //! An interface between main memory and graphics memory class DXBuffer : public virtual ReferenceCounter { protected: void* data; bool changed; int len; int elLen; public: //! Constructor //! \param bind The usage of the buffer. Example: //! D3D11_BIND_INDEX_BUFFER, D3D11_BIND_VERTEX_BUFFER. \param eLen //! Length of a single element in bytes DLLEXPORT DXBuffer(int eLen); //! Destructor DLLEXPORT virtual ~DXBuffer(); //! Sets the changed flag so that the data is copied again on the //! next call of 'copy' DLLEXPORT void setChanged(); //! Changes the length of the buffer on the next call of 'copy' //! \param len The length in bytes DLLEXPORT void setLength(int len); //! Sets what will be copied on the next call of 'copy' //! \param data A pointer to the data DLLEXPORT void setData(void* data); //! Copies the data into the buffer if it has changed DLLEXPORT virtual void copyToGPU(int byteCount = -1) = 0; //! Returns the length of an element in bytes DLLEXPORT int getElementLength() const; //! Returns the number of elements in the buffer DLLEXPORT int getElementCount() const; }; } // namespace Framework