BsD3D11VertexBuffer.h 1.8 KB

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