CmGpuResource.h 1.4 KB

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