2
0

BsRenderTarget.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #include "BsRenderTarget.h"
  2. #include "BsViewport.h"
  3. #include "BsException.h"
  4. #include "BsRenderAPI.h"
  5. #include "BsCoreThread.h"
  6. #include "BsFrameAlloc.h"
  7. namespace BansheeEngine
  8. {
  9. RenderTargetCore::RenderTargetCore()
  10. {
  11. }
  12. void RenderTargetCore::setPriority(INT32 priority)
  13. {
  14. RenderTargetProperties& props = const_cast<RenderTargetProperties&>(getProperties());
  15. props.mPriority = priority;
  16. }
  17. const RenderTargetProperties& RenderTargetCore::getProperties() const
  18. {
  19. return getPropertiesInternal();
  20. }
  21. void RenderTargetCore::getCustomAttribute(const String& name, void* pData) const
  22. {
  23. BS_EXCEPT(InvalidParametersException, "Attribute not found.");
  24. }
  25. RenderTarget::RenderTarget()
  26. {
  27. // We never sync from sim to core, so mark it clean to avoid overwriting core thread changes
  28. markCoreClean();
  29. }
  30. void RenderTarget::setPriority(CoreAccessor& accessor, INT32 priority)
  31. {
  32. std::function<void(SPtr<RenderTargetCore>, INT32)> windowedFunc =
  33. [](SPtr<RenderTargetCore> renderTarget, INT32 priority)
  34. {
  35. renderTarget->setPriority(priority);
  36. };
  37. accessor.queueCommand(std::bind(windowedFunc, getCore(), priority));
  38. }
  39. SPtr<RenderTargetCore> RenderTarget::getCore() const
  40. {
  41. return std::static_pointer_cast<RenderTargetCore>(mCoreSpecific);
  42. }
  43. const RenderTargetProperties& RenderTarget::getProperties() const
  44. {
  45. THROW_IF_CORE_THREAD;
  46. return getPropertiesInternal();
  47. }
  48. void RenderTarget::getCustomAttribute(const String& name, void* pData) const
  49. {
  50. BS_EXCEPT(InvalidParametersException, "Attribute not found.");
  51. }
  52. }