// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
#pragma once
#if GRAPHICS_API_DIRECTX12
#include "Engine/Graphics/GPUTimerQuery.h"
#include "GPUDeviceDX12.h"
///
/// GPU timer query object for DirectX 12 backend.
///
class GPUTimerQueryDX12 : public GPUResourceDX12
{
private:
bool _hasResult = false;
bool _endCalled = false;
float _timeDelta = 0.0f;
uint64 _gpuFrequency = 0;
QueryHeapDX12::ElementHandle _begin;
QueryHeapDX12::ElementHandle _end;
public:
///
/// Initializes a new instance of the class.
///
/// The graphics device.
GPUTimerQueryDX12(GPUDeviceDX12* device);
public:
// [GPUTimerQuery]
void Begin() override;
void End() override;
bool HasResult() override;
float GetResult() override;
protected:
// [GPUResourceDX12]
void OnReleaseGPU() override;
};
#endif