BsD3D11VertexBuffer.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #pragma once
  2. #include "BsD3D11Prerequisites.h"
  3. #include "BsVertexBuffer.h"
  4. #include "BsD3D11HardwareBuffer.h"
  5. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief DirectX 11 implementation of a vertex buffer.
  9. */
  10. class BS_D3D11_EXPORT D3D11VertexBufferCore : public VertexBufferCore
  11. {
  12. public:
  13. D3D11VertexBufferCore(D3D11Device& device, UINT32 vertexSize, UINT32 numVertices,
  14. GpuBufferUsage usage, bool streamOut);
  15. ~D3D11VertexBufferCore();
  16. /**
  17. * @copydoc VertexBufferCore::readData
  18. */
  19. void readData(UINT32 offset, UINT32 length, void* pDest) override;
  20. /**
  21. * @copydoc VertexBufferCore::writeData
  22. */
  23. void writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags = BufferWriteType::Normal) override;
  24. /**
  25. * @copydoc VertexBufferCore::copyData
  26. */
  27. void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, bool discardWholeBuffer = false) override;
  28. /**
  29. * @brief Get the D3D-specific index buffer
  30. */
  31. ID3D11Buffer* getD3DVertexBuffer() const { return mBuffer->getD3DBuffer(); }
  32. protected:
  33. /**
  34. * @copydoc VertexBufferCore::lockImpl
  35. */
  36. void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options) override;
  37. /**
  38. * @copydoc VertexBufferCore::unlockImpl
  39. */
  40. void unlockImpl(void) override;
  41. /**
  42. * @copydoc VertexBufferCore::initialize
  43. */
  44. void initialize() override;
  45. D3D11HardwareBuffer* mBuffer;
  46. D3D11Device& mDevice;
  47. bool mStreamOut;
  48. };
  49. }