2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2011 Dolphin Emulator Project
|
2015-05-18 01:08:10 +02:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 05:09:55 +02:00
|
|
|
// Refer to the license.txt file included.
|
2011-01-31 02:28:32 +01:00
|
|
|
|
2014-02-10 19:54:46 +01:00
|
|
|
#pragma once
|
2011-01-31 02:28:32 +01:00
|
|
|
|
2016-02-16 03:29:24 +01:00
|
|
|
#include <memory>
|
2011-01-31 02:28:32 +01:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2016-01-17 22:54:31 +01:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-02-17 11:18:15 +01:00
|
|
|
#include "VideoCommon/PerfQueryBase.h"
|
2011-01-31 02:28:32 +01:00
|
|
|
|
2016-06-24 10:43:46 +02:00
|
|
|
namespace MMIO
|
|
|
|
{
|
|
|
|
class Mapping;
|
|
|
|
}
|
2016-01-17 22:54:31 +01:00
|
|
|
class PointerWrap;
|
2011-03-16 23:48:17 +01:00
|
|
|
|
2017-01-23 09:27:13 +01:00
|
|
|
enum class FieldType
|
2011-01-31 02:28:32 +01:00
|
|
|
{
|
2017-01-23 09:27:13 +01:00
|
|
|
Odd,
|
|
|
|
Even,
|
2011-01-31 02:28:32 +01:00
|
|
|
};
|
|
|
|
|
2017-01-23 08:51:46 +01:00
|
|
|
enum class EFBAccessType
|
2011-01-31 02:28:32 +01:00
|
|
|
{
|
2017-01-23 08:51:46 +01:00
|
|
|
PeekZ,
|
|
|
|
PokeZ,
|
|
|
|
PeekColor,
|
|
|
|
PokeColor
|
2011-01-31 02:28:32 +01:00
|
|
|
};
|
|
|
|
|
2016-01-12 09:35:24 +01:00
|
|
|
class VideoBackendBase
|
2011-01-31 02:28:32 +01:00
|
|
|
{
|
|
|
|
public:
|
2016-06-24 10:43:46 +02:00
|
|
|
virtual ~VideoBackendBase() {}
|
2018-10-03 15:03:13 +02:00
|
|
|
virtual bool Initialize(void* display_handle, void* window_handle) = 0;
|
2016-06-24 10:43:46 +02:00
|
|
|
virtual void Shutdown() = 0;
|
2011-01-31 02:28:32 +01:00
|
|
|
|
2016-06-24 10:43:46 +02:00
|
|
|
virtual std::string GetName() const = 0;
|
|
|
|
virtual std::string GetDisplayName() const { return GetName(); }
|
2016-01-13 21:38:11 +01:00
|
|
|
virtual void InitBackendInfo() = 0;
|
2011-01-31 02:28:32 +01:00
|
|
|
|
2016-06-24 10:43:46 +02:00
|
|
|
void Video_ExitLoop();
|
2017-09-14 06:46:30 +02:00
|
|
|
|
2018-05-20 22:20:21 +02:00
|
|
|
void Video_BeginField(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u64 ticks);
|
2011-01-31 02:28:32 +01:00
|
|
|
|
2018-05-20 22:20:21 +02:00
|
|
|
u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 data);
|
2016-06-24 10:43:46 +02:00
|
|
|
u32 Video_GetQueryResult(PerfQueryType type);
|
|
|
|
u16 Video_GetBoundingBox(int index);
|
2011-01-31 02:28:32 +01:00
|
|
|
|
2016-06-24 10:43:46 +02:00
|
|
|
static void PopulateList();
|
|
|
|
static void ClearList();
|
|
|
|
static void ActivateBackend(const std::string& name);
|
2011-12-31 05:16:12 +01:00
|
|
|
|
2018-09-28 06:22:18 +02:00
|
|
|
// Fills the backend_info fields with the capabilities of the selected backend/device.
|
|
|
|
// Called by the UI thread when the graphics config is opened.
|
|
|
|
static void PopulateBackendInfo();
|
|
|
|
|
2016-06-24 10:43:46 +02:00
|
|
|
// the implementation needs not do synchronization logic, because calls to it are surrounded by
|
|
|
|
// PauseAndLock now
|
|
|
|
void DoState(PointerWrap& p);
|
2013-09-22 18:09:39 +02:00
|
|
|
|
2016-06-24 10:43:46 +02:00
|
|
|
void CheckInvalidState();
|
2014-09-06 23:26:40 +02:00
|
|
|
|
2016-01-02 21:01:12 +01:00
|
|
|
protected:
|
2016-06-24 10:43:46 +02:00
|
|
|
void InitializeShared();
|
2016-01-13 21:14:20 +01:00
|
|
|
void ShutdownShared();
|
2016-01-12 09:35:24 +01:00
|
|
|
|
2016-06-24 10:43:46 +02:00
|
|
|
bool m_initialized = false;
|
|
|
|
bool m_invalid = false;
|
2011-01-31 02:28:32 +01:00
|
|
|
};
|
|
|
|
|
2016-02-16 03:29:24 +01:00
|
|
|
extern std::vector<std::unique_ptr<VideoBackendBase>> g_available_video_backends;
|
2016-01-12 09:35:24 +01:00
|
|
|
extern VideoBackendBase* g_video_backend;
|