BsD3D11IndexBuffer.h 1.6 KB

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