2
0

BsGLGpuBuffer.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. BS_INC_RENDER_STAT_CAT(ResDestroyed, RenderStatObject_GpuBuffer);
  13. clearBufferViews();
  14. }
  15. void GLGpuBufferCore::initialize()
  16. {
  17. 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.");
  18. BS_INC_RENDER_STAT_CAT(ResCreated, RenderStatObject_GpuBuffer);
  19. GpuBufferCore::initialize();
  20. }
  21. void* GLGpuBufferCore::lock(UINT32 offset, UINT32 length, GpuLockOptions options)
  22. {
  23. #if BS_PROFILING_ENABLED
  24. if (options == GBL_READ_ONLY || options == GBL_READ_WRITE)
  25. {
  26. BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_GpuBuffer);
  27. }
  28. if (options == GBL_READ_WRITE || options == GBL_WRITE_ONLY || options == GBL_WRITE_ONLY_DISCARD || options == GBL_WRITE_ONLY_NO_OVERWRITE)
  29. {
  30. BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_GpuBuffer);
  31. }
  32. #endif
  33. return nullptr;
  34. }
  35. void GLGpuBufferCore::unlock()
  36. {
  37. }
  38. void GLGpuBufferCore::readData(UINT32 offset, UINT32 length, void* pDest)
  39. {
  40. BS_INC_RENDER_STAT_CAT(ResRead, RenderStatObject_GpuBuffer);
  41. }
  42. void GLGpuBufferCore::writeData(UINT32 offset, UINT32 length, const void* pSource, BufferWriteType writeFlags)
  43. {
  44. BS_INC_RENDER_STAT_CAT(ResWrite, RenderStatObject_GpuBuffer);
  45. }
  46. void GLGpuBufferCore::copyData(GpuBufferCore& srcBuffer, UINT32 srcOffset,
  47. UINT32 dstOffset, UINT32 length, bool discardWholeBuffer)
  48. {
  49. }
  50. GpuBufferView* GLGpuBufferCore::createView()
  51. {
  52. return nullptr;
  53. }
  54. void GLGpuBufferCore::destroyView(GpuBufferView* view)
  55. {
  56. }
  57. }