1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "BsGLPrerequisites.h"
6#include "RenderAPI/BsOcclusionQuery.h"
7
8namespace bs { namespace ct
9{
10 /** @addtogroup GL
11 * @{
12 */
13
14 /** OpenGL implementation of an occlusion query. */
15 class GLOcclusionQuery : public OcclusionQuery
16 {
17 public:
18 GLOcclusionQuery(bool binary, UINT32 deviceIdx);
19 ~GLOcclusionQuery();
20
21 /** @copydoc OcclusionQuery::begin */
22 void begin(const SPtr<CommandBuffer>& cb = nullptr) override;
23
24 /** @copydoc OcclusionQuery::end */
25 void end(const SPtr<CommandBuffer>& cb = nullptr) override;
26
27 /** @copydoc OcclusionQuery::isReady */
28 bool isReady() const override;
29
30 /** @copydoc OcclusionQuery::getNumSamples */
31 UINT32 getNumSamples() override;
32
33 private:
34 friend class QueryManager;
35
36 /** Processes query results and saves them for later use. To be called when query has completed. */
37 void finalize();
38
39 private:
40 GLuint mQueryObj = 0;
41 bool mFinalized = false;
42 bool mEndIssued = false;
43
44 UINT32 mNumSamples = 0;
45 };
46
47 /** @} */
48}}