| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <memory> |
| 7 |
#include <optional> |
| 8 |
#include <string> |
| 9 |
#include <vector> |
| 10 |
|
| 11 |
#include "Common/CommonTypes.h" |
| 12 |
#include "Common/WindowSystemInfo.h" |
| 13 |
#include "VideoCommon/PerfQueryBase.h" |
| 14 |
|
| 15 |
namespace MMIO |
| 16 |
{ |
| 17 |
class Mapping; |
| 18 |
} |
| 19 |
class PointerWrap; |
| 20 |
|
| 21 |
class AbstractGfx; |
| 22 |
class BoundingBox; |
| 23 |
class TextureCacheBase; |
| 24 |
class VertexManagerBase; |
| 25 |
class EFBInterfaceBase; |
| 26 |
|
| 27 |
enum class FieldType |
| 28 |
{ |
| 29 |
Odd, |
| 30 |
Even, |
| 31 |
}; |
| 32 |
|
| 33 |
class VideoBackendBase |
| 34 |
{ |
| 35 |
public: |
| 36 |
virtual ~VideoBackendBase() {} |
| 37 |
virtual bool Initialize(const WindowSystemInfo& wsi) = 0; |
| 38 |
virtual void Shutdown() = 0; |
| 39 |
|
| 40 |
virtual std::string GetConfigName() const = 0; |
| 41 |
virtual std::string GetDisplayName() const { return GetConfigName(); } |
| 42 |
virtual void InitBackendInfo(const WindowSystemInfo& wsi) = 0; |
| 43 |
virtual std::optional<std::string> GetWarningMessage() const { return {}; } |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
virtual void PrepareWindow(WindowSystemInfo& wsi) {} |
| 48 |
|
| 49 |
static std::string BadShaderFilename(const char* shader_stage, int counter); |
| 50 |
|
| 51 |
void Video_OutputXFB(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u64 ticks); |
| 52 |
|
| 53 |
u32 Video_GetQueryResult(PerfQueryType type); |
| 54 |
u16 Video_GetBoundingBox(int index); |
| 55 |
|
| 56 |
static std::string GetDefaultBackendConfigName(); |
| 57 |
static std::string GetDefaultBackendDisplayName(); |
| 58 |
static const std::vector<std::unique_ptr<VideoBackendBase>>& GetAvailableBackends(); |
| 59 |
static void ActivateBackend(const std::string& name); |
| 60 |
|
| 61 |
|
| 62 |
static void PopulateBackendInfo(const WindowSystemInfo& wsi); |
| 63 |
|
| 64 |
|
| 65 |
void DoState(PointerWrap& p); |
| 66 |
|
| 67 |
protected: |
| 68 |
|
| 69 |
bool InitializeShared(std::unique_ptr<AbstractGfx> gfx, |
| 70 |
std::unique_ptr<VertexManagerBase> vertex_manager, |
| 71 |
std::unique_ptr<PerfQueryBase> perf_query, |
| 72 |
std::unique_ptr<BoundingBox> bounding_box); |
| 73 |
|
| 74 |
|
| 75 |
bool InitializeShared(std::unique_ptr<AbstractGfx> gfx, |
| 76 |
std::unique_ptr<VertexManagerBase> vertex_manager, |
| 77 |
std::unique_ptr<PerfQueryBase> perf_query, |
| 78 |
std::unique_ptr<BoundingBox> bounding_box, |
| 79 |
std::unique_ptr<EFBInterfaceBase> efb_interface, |
| 80 |
std::unique_ptr<TextureCacheBase> texture_cache); |
| 81 |
void ShutdownShared(); |
| 82 |
|
| 83 |
bool m_initialized = false; |
| 84 |
}; |
| 85 |
|
| 86 |
extern VideoBackendBase* g_video_backend; |