Duckstation/src/duckstation-regtest/regtest_host_display.h

71 lines
2.8 KiB
C
Raw Normal View History

2021-07-23 14:02:09 +00:00
#pragma once
#include "core/host_display.h"
#include <string>
class RegTestHostDisplay final : public HostDisplay
{
public:
RegTestHostDisplay();
~RegTestHostDisplay();
void DumpFrame(const std::string& filename);
RenderAPI GetRenderAPI() const override;
void* GetRenderDevice() const override;
void* GetRenderContext() const override;
bool HasRenderDevice() const override;
bool HasRenderSurface() const override;
bool CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device,
bool threaded_presentation) override;
bool InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device,
bool threaded_presentation) override;
void DestroyRenderDevice() override;
bool MakeRenderContextCurrent() override;
bool DoneRenderContextCurrent() override;
bool ChangeRenderWindow(const WindowInfo& wi) override;
void ResizeRenderWindow(s32 new_window_width, s32 new_window_height) override;
bool SupportsFullscreen() const override;
bool IsFullscreen() override;
bool SetFullscreen(bool fullscreen, u32 width, u32 height, float refresh_rate) override;
void DestroyRenderSurface() override;
bool SetPostProcessingChain(const std::string_view& config) override;
bool CreateResources() override;
void DestroyResources() override;
AdapterAndModeList GetAdapterAndModeList() override;
bool CreateImGuiContext() override;
void DestroyImGuiContext() override;
bool UpdateImGuiFontTexture() override;
std::unique_ptr<HostDisplayTexture> CreateTexture(u32 width, u32 height, u32 layers, u32 levels, u32 samples,
HostDisplayPixelFormat format, const void* data, u32 data_stride,
bool dynamic = false) override;
void UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height, const void* data,
u32 data_stride) override;
bool DownloadTexture(const void* texture_handle, HostDisplayPixelFormat texture_format, u32 x, u32 y, u32 width,
u32 height, void* out_data, u32 out_data_stride) override;
void SetVSync(bool enabled) override;
bool Render() override;
bool RenderScreenshot(u32 width, u32 height, std::vector<u32>* out_pixels, u32* out_stride,
HostDisplayPixelFormat* out_format) override;
bool SupportsDisplayPixelFormat(HostDisplayPixelFormat format) const override;
bool BeginSetDisplayPixels(HostDisplayPixelFormat format, u32 width, u32 height, void** out_buffer,
u32* out_pitch) override;
void EndSetDisplayPixels() override;
private:
std::vector<u32> m_frame_buffer;
HostDisplayPixelFormat m_frame_buffer_format = HostDisplayPixelFormat::Unknown;
u32 m_frame_buffer_pitch = 0;
};