CmGpuParamBlock.h 857 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmCommonEnums.h"
  4. #include "CmCoreObject.h"
  5. namespace CamelotFramework
  6. {
  7. class CM_EXPORT GpuParamBlock
  8. {
  9. public:
  10. GpuParamBlock(UINT32 size);
  11. GpuParamBlock(GpuParamBlock* otherBlock);
  12. virtual ~GpuParamBlock();
  13. void write(UINT32 offset, const void* data, UINT32 size);
  14. void zeroOut(UINT32 offset, UINT32 size);
  15. /**
  16. * @brief Uploads the current data to the specified buffer, and marks the block a non-dirty.
  17. * Should only be called from the core thread.
  18. */
  19. void uploadToBuffer(GpuParamBlockBufferPtr buffer);
  20. UINT32 getSize() const { return mSize; }
  21. UINT8* getData() const { return mData; }
  22. bool isDirty() const { return mDirty; }
  23. void setDirty() { mDirty = true; }
  24. protected:
  25. UINT8* mData;
  26. UINT32 mSize;
  27. bool mDirty;
  28. };
  29. }