BsRenderTarget.cpp 1.8 KB

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