2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2011 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 21:09:55 -06:00
|
|
|
// Refer to the license.txt file included.
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2016-02-15 19:29:24 -07:00
|
|
|
#include <memory>
|
2011-01-30 18:28:32 -07:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2016-01-17 14:54:31 -07:00
|
|
|
#include "Common/CommonTypes.h"
|
2018-10-03 07:03:22 -06:00
|
|
|
#include "Common/WindowSystemInfo.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "VideoCommon/PerfQueryBase.h"
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
namespace MMIO
|
|
|
|
{
|
|
|
|
class Mapping;
|
|
|
|
}
|
2016-01-17 14:54:31 -07:00
|
|
|
class PointerWrap;
|
2011-03-16 16:48:17 -06:00
|
|
|
|
2017-01-23 01:27:13 -07:00
|
|
|
enum class FieldType
|
2011-01-30 18:28:32 -07:00
|
|
|
{
|
2017-01-23 01:27:13 -07:00
|
|
|
Odd,
|
|
|
|
Even,
|
2011-01-30 18:28:32 -07:00
|
|
|
};
|
|
|
|
|
2017-01-23 00:51:46 -07:00
|
|
|
enum class EFBAccessType
|
2011-01-30 18:28:32 -07:00
|
|
|
{
|
2017-01-23 00:51:46 -07:00
|
|
|
PeekZ,
|
|
|
|
PokeZ,
|
|
|
|
PeekColor,
|
|
|
|
PokeColor
|
2011-01-30 18:28:32 -07:00
|
|
|
};
|
|
|
|
|
2016-01-12 01:35:24 -07:00
|
|
|
class VideoBackendBase
|
2011-01-30 18:28:32 -07:00
|
|
|
{
|
|
|
|
public:
|
2016-06-24 02:43:46 -06:00
|
|
|
virtual ~VideoBackendBase() {}
|
2018-10-03 07:03:22 -06:00
|
|
|
virtual bool Initialize(const WindowSystemInfo& wsi) = 0;
|
2016-06-24 02:43:46 -06:00
|
|
|
virtual void Shutdown() = 0;
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
virtual std::string GetName() const = 0;
|
|
|
|
virtual std::string GetDisplayName() const { return GetName(); }
|
2016-01-13 13:38:11 -07:00
|
|
|
virtual void InitBackendInfo() = 0;
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2018-11-07 06:10:51 -07:00
|
|
|
// Prepares a native window for rendering. This is called on the main thread, or the
|
|
|
|
// thread which owns the window.
|
|
|
|
virtual void PrepareWindow(const WindowSystemInfo& wsi) {}
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
void Video_ExitLoop();
|
2017-09-13 22:46:30 -06:00
|
|
|
|
2018-05-20 14:20:21 -06:00
|
|
|
void Video_BeginField(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u64 ticks);
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2018-05-20 14:20:21 -06:00
|
|
|
u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 data);
|
2016-06-24 02:43:46 -06:00
|
|
|
u32 Video_GetQueryResult(PerfQueryType type);
|
|
|
|
u16 Video_GetBoundingBox(int index);
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
static void PopulateList();
|
|
|
|
static void ClearList();
|
|
|
|
static void ActivateBackend(const std::string& name);
|
2011-12-30 21:16:12 -07:00
|
|
|
|
2018-09-27 22:22:18 -06: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();
|
|
|
|
|
2019-06-29 02:35:12 -06:00
|
|
|
// Wrapper function which pushes the event to the GPU thread.
|
2016-06-24 02:43:46 -06:00
|
|
|
void DoState(PointerWrap& p);
|
2013-09-22 10:09:39 -06:00
|
|
|
|
2016-01-02 13:01:12 -07:00
|
|
|
protected:
|
2016-06-24 02:43:46 -06:00
|
|
|
void InitializeShared();
|
2016-01-13 13:14:20 -07:00
|
|
|
void ShutdownShared();
|
2016-01-12 01:35:24 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
bool m_initialized = false;
|
2011-01-30 18:28:32 -07:00
|
|
|
};
|
|
|
|
|
2016-02-15 19:29:24 -07:00
|
|
|
extern std::vector<std::unique_ptr<VideoBackendBase>> g_available_video_backends;
|
2016-01-12 01:35:24 -07:00
|
|
|
extern VideoBackendBase* g_video_backend;
|