hazelnut/agent/CollabVMFbcAgent/capture.hpp

61 lines
1.5 KiB
C++
Raw Normal View History

#include <memory>
2024-11-23 21:30:39 -05:00
#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
2024-11-23 21:30:39 -05:00
struct DiffInformation {
u8* pDiffMap;
u32 diffmapWidth;
u32 diffMapHeight;
};
2024-11-23 21:30:39 -05:00
/// Interface used for framebuffer capture independence.
class IFramebufferCapture {
2024-11-23 21:30:39 -05:00
public:
virtual ~IFramebufferCapture() = default;
virtual bool Initialize() = 0;
/// Performs the capture.
virtual DisplayCaptureResult CaptureFrame() = 0;
/// Get framebuffer information.
virtual FramebufferInformation GetFramebufferInformation() = 0;
2024-11-23 21:30:39 -05:00
/// Gets the tile difference block information.
virtual DiffInformation GetDiffInformation() = 0;
};
2024-11-23 21:30:39 -05:00
enum class DisplayCaptureInterface : u32 {
Invalid,
NVFBC, // NVFBC capture
// FIXME: DXGI support
};
/// Returns a guess for the best capture interface.
2024-11-23 21:30:39 -05:00
/// 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();
2024-11-23 21:30:39 -05:00
/// 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