CmGpuResource.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmResource.h"
  4. namespace CamelotFramework
  5. {
  6. class CM_EXPORT GpuResource : public Resource
  7. {
  8. public:
  9. /**
  10. * @brief Updates a part of the current resource with the provided data. Specific resource
  11. * implementations provide a way to retrieve a subresource index.
  12. *
  13. * @note Call only from core thread.
  14. */
  15. virtual void writeSubresource(UINT32 subresourceIdx, const GpuResourceData& data, bool discardEntireBuffer) = 0;
  16. /**
  17. * @brief Reads a part of the current resource into the provided "data" parameter.
  18. * Data buffer needs to be pre-allocated. Specific resource implementations
  19. * provide a way to retrieve a subresource index and a way to allocate
  20. * the GpuResourceData buffer.
  21. *
  22. * @note Call only from core thread.
  23. */
  24. virtual void readSubresource(UINT32 subresourceIdx, GpuResourceData& data) = 0;
  25. /************************************************************************/
  26. /* SERIALIZATION */
  27. /************************************************************************/
  28. public:
  29. friend class GpuResourceRTTI;
  30. static RTTITypeBase* getRTTIStatic();
  31. virtual RTTITypeBase* getRTTI() const;
  32. };
  33. }