BsD3D9Resource.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsD3D9Prerequisites.h"
  5. namespace BansheeEngine
  6. {
  7. /** @addtogroup D3D9
  8. * @{
  9. */
  10. /** Provides an interface for dealing with DX9 resources. Primarily notifying the resources of any changed states. */
  11. class BS_D3D9_EXPORT D3D9Resource
  12. {
  13. public:
  14. D3D9Resource();
  15. virtual ~D3D9Resource();
  16. /** Called immediately after the Direct3D device has been created. */
  17. virtual void notifyOnDeviceCreate(IDirect3DDevice9* d3d9Device) {}
  18. /** Called before the Direct3D device is going to be destroyed. */
  19. virtual void notifyOnDeviceDestroy(IDirect3DDevice9* d3d9Device) {}
  20. /** Called immediately after the Direct3D device has entered a lost state. */
  21. virtual void notifyOnDeviceLost(IDirect3DDevice9* d3d9Device) {}
  22. /** Called immediately after the Direct3D device has been reset. */
  23. virtual void notifyOnDeviceReset(IDirect3DDevice9* d3d9Device) {}
  24. /**
  25. * Called when device state is changing. Access to any device should be locked. Relevant for multi thread
  26. * application.
  27. */
  28. static void lockDeviceAccess();
  29. /**
  30. * Called when device state change completed. Access to any device is allowed. Relevant for multi thread
  31. * application.
  32. */
  33. static void unlockDeviceAccess();
  34. protected:
  35. static Mutex msDeviceAccessMutex;
  36. };
  37. /** @} */
  38. }