// Copyright (c) 2012-2020 Wojciech Figat. All rights reserved.
#pragma once
#include "Engine/Graphics/GPUTimerQuery.h"
#include "GPUResourceOGL.h"
#if GRAPHICS_API_OPENGL
///
/// GPU timer query object for OpenGL
///
class GPUTimerQueryOGL : public GPUResourceOGL
{
private:
bool _finalized = false;
bool _endCalled = false;
float _timeDelta = 0.0f;
GLuint _startQuery;
GLuint _endQuery;
public:
///
/// Initializes a new instance of the class.
///
/// The graphics device.
GPUTimerQueryOGL(GPUDeviceOGL* device);
///
/// Finalizes an instance of the class.
///
~GPUTimerQueryOGL();
public:
// [GPUResourceOGL]
void ReleaseGPU() final override;
// [GPUTimerQuery]
void Begin() override;
void End() override;
bool HasResult() override;
float GetResult() override;
};
#endif