BsD3D11IndexBuffer.h 1.4 KB

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