BsD3D9OcclusionQuery.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #include "BsD3D9Resource.h"
  6. #include "BsOcclusionQuery.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup D3D9
  10. * @{
  11. */
  12. /** @copydoc OcclusionQuery */
  13. class BS_D3D9_EXPORT D3D9OcclusionQuery : public OcclusionQuery, public D3D9Resource
  14. {
  15. public:
  16. D3D9OcclusionQuery(bool binary);
  17. ~D3D9OcclusionQuery();
  18. /** @copydoc OcclusionQuery::begin */
  19. void begin() override;
  20. /** @copydoc OcclusionQuery::end */
  21. void end() override;
  22. /** @copydoc OcclusionQuery::isReady */
  23. bool isReady() const override;
  24. /** @copydoc OcclusionQuery::getNumSamples */
  25. UINT32 getNumSamples() override;
  26. /** @copydoc D3D9Resource::notifyOnDeviceCreate */
  27. void notifyOnDeviceCreate(IDirect3DDevice9* d3d9Device) override;
  28. /** @copydoc D3D9Resource::notifyOnDeviceDestroy */
  29. void notifyOnDeviceDestroy(IDirect3DDevice9* d3d9Device) override;
  30. /** @copydoc D3D9Resource::notifyOnDeviceLost */
  31. void notifyOnDeviceLost(IDirect3DDevice9* d3d9Device) override;
  32. /** @copydoc D3D9Resource::notifyOnDeviceReset */
  33. void notifyOnDeviceReset(IDirect3DDevice9* d3d9Device) override;
  34. private:
  35. friend class QueryManager;
  36. /** Creates the internal DX9 query. */
  37. void createQuery();
  38. /** Releases the internal DX9 query. */
  39. void releaseQuery();
  40. /** Resolves query results after it is ready. */
  41. void finalize();
  42. private:
  43. IDirect3DDevice9* mDevice;
  44. IDirect3DQuery9* mQuery;
  45. bool mQueryIssued;
  46. bool mFinalized;
  47. UINT32 mNumSamples;
  48. };
  49. /** @} */
  50. }