2023-03-23 16:37:52 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
2023-02-22 10:16:42 +01:00
|
|
|
* Copyright 2023 Blender Foundation. */
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2023-03-23 16:37:52 +01:00
|
|
|
|
|
|
|
|
#include "renderdoc_app.h"
|
|
|
|
|
|
|
|
|
|
namespace renderdoc::api {
|
|
|
|
|
class Renderdoc {
|
|
|
|
|
private:
|
|
|
|
|
enum class State {
|
|
|
|
|
/**
|
|
|
|
|
* Initial state of the API indicating that the API hasn't checked if it can find renderdoc.
|
|
|
|
|
*/
|
|
|
|
|
UNINITIALIZED,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* API has looked for renderdoc, but couldn't find it. This indicates that renderdoc isn't
|
|
|
|
|
* available on the platform, or wasn't registered correctly.
|
|
|
|
|
*/
|
|
|
|
|
NOT_FOUND,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* API has loaded the symbols of renderdoc.
|
|
|
|
|
*/
|
|
|
|
|
LOADED,
|
|
|
|
|
};
|
|
|
|
|
State state_ = State::UNINITIALIZED;
|
|
|
|
|
RENDERDOC_API_1_6_0 *renderdoc_api_ = nullptr;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
bool start_frame_capture(RENDERDOC_DevicePointer device_handle,
|
|
|
|
|
RENDERDOC_WindowHandle window_handle);
|
|
|
|
|
void end_frame_capture(RENDERDOC_DevicePointer device_handle,
|
|
|
|
|
RENDERDOC_WindowHandle window_handle);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
/**
|
|
|
|
|
* Check if renderdoc has been loaded.
|
2023-02-22 10:16:42 +01:00
|
|
|
*
|
2023-03-23 16:37:52 +01:00
|
|
|
* When not loaded it tries to load the API, but only tries to do it once.
|
|
|
|
|
*/
|
|
|
|
|
bool check_loaded();
|
|
|
|
|
void load();
|
|
|
|
|
};
|
|
|
|
|
} // namespace renderdoc::api
|