BsD3D11IndexBuffer.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 "BsIndexBuffer.h"
  6. #include "BsD3D11HardwareBuffer.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup D3D11
  10. * @{
  11. */
  12. /** DirectX 11 implementation of an index buffer. */
  13. class BS_D3D11_EXPORT D3D11IndexBufferCore : public IndexBufferCore
  14. {
  15. public:
  16. D3D11IndexBufferCore(D3D11Device& device, IndexType idxType, UINT32 numIndices, GpuBufferUsage usage);
  17. ~D3D11IndexBufferCore();
  18. /** @copydoc IndexBufferCore::readData */
  19. void readData(UINT32 offset, UINT32 length, void* dest) override;
  20. /** @copydoc IndexBufferCore::writeData */
  21. void writeData(UINT32 offset, UINT32 length, const void* source,
  22. BufferWriteType writeFlags = BufferWriteType::Normal) override;
  23. /** @copydoc IndexBufferCore::copyData */
  24. void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length,
  25. bool discardWholeBuffer = false) override;
  26. /** Gets the internal DX11 index buffer object. */
  27. ID3D11Buffer* getD3DIndexBuffer() const { return mBuffer->getD3DBuffer(); }
  28. protected:
  29. /** @copydoc IndexBufferCore::lockImpl */
  30. void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options) override;
  31. /** @copydoc IndexBufferCore::unlockImpl */
  32. void unlockImpl() override;
  33. /** @copydoc IndexBufferCore::initialize */
  34. void initialize() override;
  35. D3D11HardwareBuffer* mBuffer;
  36. D3D11Device& mDevice;
  37. };
  38. /** @} */
  39. }