| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #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;
- __int64 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(__int64 len);
- //! Sets what will be copied on the next call of 'copy'
- //! \param data A pointer to the data
- DLLEXPORT void setData(void* data, bool shureChanged);
- //! Copies the data into the buffer if it has changed
- DLLEXPORT virtual void copyToGPU(__int64 byteCount = -1) = 0;
- //! Returns the length of an element in bytes
- DLLEXPORT int getElementLength() const;
- //! Returns the number of elements in the buffer
- DLLEXPORT __int64 getElementCount() const;
- };
- } // namespace Framework
|