CmGpuBufferView.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmCommonEnums.h"
  4. namespace CamelotFramework
  5. {
  6. struct CM_EXPORT GPU_BUFFER_DESC
  7. {
  8. UINT32 firstElement;
  9. UINT32 elementWidth;
  10. UINT32 numElements;
  11. bool useCounter;
  12. GpuViewUsage usage;
  13. };
  14. class CM_EXPORT GpuBufferView
  15. {
  16. public:
  17. class HashFunction
  18. {
  19. public:
  20. size_t operator()(const GPU_BUFFER_DESC& key) const;
  21. };
  22. class EqualFunction
  23. {
  24. public:
  25. bool operator()(const GPU_BUFFER_DESC& a, const GPU_BUFFER_DESC& b) const;
  26. };
  27. GpuBufferView();
  28. virtual ~GpuBufferView();
  29. virtual void initialize(GpuBufferPtr buffer, GPU_BUFFER_DESC& desc);
  30. const GPU_BUFFER_DESC& getDesc() const { return mDesc; }
  31. GpuBufferPtr getBuffer() const { return mBuffer; }
  32. UINT32 getFirstElement() const { return mDesc.firstElement; }
  33. UINT32 getElementWidth() const { return mDesc.elementWidth; }
  34. UINT32 getNumElements() const { return mDesc.numElements; }
  35. bool getUseCounter() const { return mDesc.useCounter; }
  36. GpuViewUsage getUsage() const { return mDesc.usage; }
  37. protected:
  38. GPU_BUFFER_DESC mDesc;
  39. GpuBufferPtr mBuffer;
  40. };
  41. }