61 lines
No EOL
1.5 KiB
C++
61 lines
No EOL
1.5 KiB
C++
#include <memory>
|
|
|
|
#include "Utils.hpp"
|
|
|
|
namespace hazelnut {
|
|
|
|
enum class DisplayCaptureResult {
|
|
Ok,
|
|
OkButResized, // OK, but grab the buffer information again. It's different due to a resize
|
|
Fail, // epic fail
|
|
};
|
|
|
|
// Framebuffer information
|
|
struct FramebufferInformation {
|
|
u32* pFramebuffer;
|
|
u32 width;
|
|
u32 height;
|
|
};
|
|
|
|
// Difference tile information
|
|
struct DiffInformation {
|
|
u8* pDiffMap;
|
|
u32 diffmapWidth;
|
|
u32 diffMapHeight;
|
|
};
|
|
|
|
/// Interface used for framebuffer capture independence.
|
|
class IFramebufferCapture {
|
|
public:
|
|
virtual ~IFramebufferCapture() = default;
|
|
|
|
virtual bool Initialize() = 0;
|
|
|
|
/// Performs the capture.
|
|
virtual DisplayCaptureResult CaptureFrame() = 0;
|
|
|
|
/// Get framebuffer information.
|
|
virtual FramebufferInformation GetFramebufferInformation() = 0;
|
|
|
|
/// Gets the tile difference block information.
|
|
virtual DiffInformation GetDiffInformation() = 0;
|
|
};
|
|
|
|
enum class DisplayCaptureInterface : u32 {
|
|
Invalid,
|
|
NVFBC, // NVFBC capture
|
|
// FIXME: DXGI support
|
|
};
|
|
|
|
/// Returns a guess for the best capture interface.
|
|
/// On a NVIDIA GPU on Windows < 8.1, we prefer NVFBC.
|
|
/// Otherwise, we should prefer DXGI.
|
|
///
|
|
/// If no API works Invalid is returned.
|
|
DisplayCaptureInterface GuessBestCaptureInterface();
|
|
|
|
/// Creates a instance of the framebuffer capture interface for a particular interface.
|
|
/// Returns a null pointer on failure to create.
|
|
std::unique_ptr<IFramebufferCapture> CreateFramebufferCapture(DisplayCaptureInterface type);
|
|
|
|
} // namespace hazelnut
|