BsGLGpuBuffer.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #include "BsGLGpuBuffer.h"
  2. #include "BsDebug.h"
  3. #include "BsRenderStats.h"
  4. namespace BansheeEngine
  5. {
  6. GLGpuBuffer::GLGpuBuffer(UINT32 elementCount, UINT32 elementSize, GpuBufferType type, GpuBufferUsage usage, bool randomGpuWrite, bool useCounter)
  7. : GpuBuffer(elementCount, elementSize, type, usage, randomGpuWrite, useCounter)
  8. {
  9. }
  10. GLGpuBuffer::~GLGpuBuffer()
  11. {
  12. }
  13. void GLGpuBuffer::initialize_internal()
  14. {
  15. LOGWRN("Generic buffers are not supported in OpenGL. Creating a dummy buffer. All operations on it will either be no-op or return a nullptr.");
  16. BS_INC_RENDER_STAT_CAT(ResCreated, RenderStatObject_GpuBuffer);
  17. GpuBuffer::initialize_internal();
  18. }
  19. void GLGpuBuffer::destroy_internal()
  20. {
  21. BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_GpuBuffer);
  22. GpuBuffer::destroy_internal();
  23. }
  24. void* GLGpuBuffer::lock(UINT32 offset, UINT32 length, GpuLockOptions options)
  25. {
  26. #if BS_PROFILING_ENABLED
  27. if (options == GBL_READ_ONLY || options == GBL_READ_WRITE)
  28. {
  29. BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_GpuBuffer);
  30. }
  31. if (options == GBL_READ_WRITE || options == GBL_WRITE_ONLY || options == GBL_WRITE_ONLY_DISCARD || options == GBL_WRITE_ONLY_NO_OVERWRITE)
  32. {
  33. BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_GpuBuffer);
  34. }
  35. #endif
  36. return nullptr;
  37. }
  38. void GLGpuBuffer::unlock()
  39. {
  40. }
  41. void GLGpuBuffer::readData(UINT32 offset, UINT32 length, void* pDest)
  42. {
  43. BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_GpuBuffer);
  44. }
  45. void GLGpuBuffer::writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags)
  46. {
  47. BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_GpuBuffer);
  48. }
  49. void GLGpuBuffer::copyData(GpuBuffer& srcBuffer, UINT32 srcOffset,
  50. UINT32 dstOffset, UINT32 length, bool discardWholeBuffer)
  51. {
  52. }
  53. GpuBufferView* GLGpuBuffer::createView()
  54. {
  55. return nullptr;
  56. }
  57. void GLGpuBuffer::destroyView(GpuBufferView* view)
  58. {
  59. }
  60. }