BsGLGpuBuffer.cpp 2.2 KB

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