BsGLGpuBuffer.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #include "BsGLGpuBuffer.h"
  2. #include "BsDebug.h"
  3. #include "BsRenderStats.h"
  4. namespace BansheeEngine
  5. {
  6. GLGpuBufferCore::GLGpuBufferCore(UINT32 elementCount, UINT32 elementSize, GpuBufferType type, GpuBufferUsage usage, bool randomGpuWrite, bool useCounter)
  7. : GpuBufferCore(elementCount, elementSize, type, usage, randomGpuWrite, useCounter)
  8. {
  9. }
  10. GLGpuBufferCore::~GLGpuBufferCore()
  11. {
  12. }
  13. void GLGpuBufferCore::initialize()
  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. GpuBufferCore::initialize();
  18. }
  19. void GLGpuBufferCore::destroy()
  20. {
  21. BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_GpuBuffer);
  22. GpuBufferCore::destroy();
  23. }
  24. void* GLGpuBufferCore::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 GLGpuBufferCore::unlock()
  39. {
  40. }
  41. void GLGpuBufferCore::readData(UINT32 offset, UINT32 length, void* pDest)
  42. {
  43. BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_GpuBuffer);
  44. }
  45. void GLGpuBufferCore::writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags)
  46. {
  47. BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_GpuBuffer);
  48. }
  49. void GLGpuBufferCore::copyData(GpuBufferCore& srcBuffer, UINT32 srcOffset,
  50. UINT32 dstOffset, UINT32 length, bool discardWholeBuffer)
  51. {
  52. }
  53. GpuBufferView* GLGpuBufferCore::createView()
  54. {
  55. return nullptr;
  56. }
  57. void GLGpuBufferCore::destroyView(GpuBufferView* view)
  58. {
  59. }
  60. }