2
0

BsGLGpuBuffer.cpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "BsGLGpuBuffer.h"
  4. #include "BsDebug.h"
  5. #include "BsRenderStats.h"
  6. namespace BansheeEngine
  7. {
  8. GLGpuBufferCore::GLGpuBufferCore(UINT32 elementCount, UINT32 elementSize, GpuBufferType type, GpuBufferUsage usage, bool randomGpuWrite, bool useCounter)
  9. : GpuBufferCore(elementCount, elementSize, type, usage, randomGpuWrite, useCounter)
  10. {
  11. }
  12. GLGpuBufferCore::~GLGpuBufferCore()
  13. {
  14. BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_GpuBuffer);
  15. clearBufferViews();
  16. }
  17. void GLGpuBufferCore::initialize()
  18. {
  19. 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.");
  20. BS_INC_RENDER_STAT_CAT(ResCreated, RenderStatObject_GpuBuffer);
  21. GpuBufferCore::initialize();
  22. }
  23. void* GLGpuBufferCore::lock(UINT32 offset, UINT32 length, GpuLockOptions options)
  24. {
  25. #if BS_PROFILING_ENABLED
  26. if (options == GBL_READ_ONLY || options == GBL_READ_WRITE)
  27. {
  28. BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_GpuBuffer);
  29. }
  30. if (options == GBL_READ_WRITE || options == GBL_WRITE_ONLY || options == GBL_WRITE_ONLY_DISCARD || options == GBL_WRITE_ONLY_NO_OVERWRITE)
  31. {
  32. BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_GpuBuffer);
  33. }
  34. #endif
  35. return nullptr;
  36. }
  37. void GLGpuBufferCore::unlock()
  38. {
  39. }
  40. void GLGpuBufferCore::readData(UINT32 offset, UINT32 length, void* pDest)
  41. {
  42. BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_GpuBuffer);
  43. }
  44. void GLGpuBufferCore::writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags)
  45. {
  46. BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_GpuBuffer);
  47. }
  48. void GLGpuBufferCore::copyData(GpuBufferCore& srcBuffer, UINT32 srcOffset,
  49. UINT32 dstOffset, UINT32 length, bool discardWholeBuffer)
  50. {
  51. }
  52. GpuBufferView* GLGpuBufferCore::createView()
  53. {
  54. return nullptr;
  55. }
  56. void GLGpuBufferCore::destroyView(GpuBufferView* view)
  57. {
  58. }
  59. }