BsD3D11IndexBuffer.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. /**
  10. * @brief DirectX 11 implementation of an index buffer.
  11. */
  12. class BS_D3D11_EXPORT D3D11IndexBufferCore : public IndexBufferCore
  13. {
  14. public:
  15. D3D11IndexBufferCore(D3D11Device& device, IndexType idxType, UINT32 numIndexes, GpuBufferUsage usage);
  16. ~D3D11IndexBufferCore();
  17. /**
  18. * @copydoc IndexBufferCore::readData
  19. */
  20. void readData(UINT32 offset, UINT32 length, void* pDest) override;
  21. /**
  22. * @copydoc IndexBufferCore::writeData
  23. */
  24. void writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags = BufferWriteType::Normal) override;
  25. /**
  26. * @copydoc IndexBufferCore::copyData
  27. */
  28. void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length, bool discardWholeBuffer = false) override;
  29. /**
  30. * @brief Gets the internal DX11 index buffer object.
  31. */
  32. ID3D11Buffer* getD3DIndexBuffer() const { return mBuffer->getD3DBuffer(); }
  33. protected:
  34. /**
  35. * @copydoc IndexBufferCore::lockImpl
  36. */
  37. void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options) override;
  38. /**
  39. * @copydoc IndexBufferCore::unlockImpl
  40. */
  41. void unlockImpl() override;
  42. /**
  43. * @copydoc IndexBufferCore::initialize
  44. */
  45. void initialize() override;
  46. D3D11HardwareBuffer* mBuffer;
  47. D3D11Device& mDevice;
  48. };
  49. }