VideoCommon: Make API_TYPE an enum class

Allows for forward declarations in most places, which prevents dumping
unrelated VideoCommon.h contents directly into headers.
This commit is contained in:
Lioncash
2016-07-21 19:04:57 -04:00
parent 66b11c5198
commit 14e0b48ae4
28 changed files with 130 additions and 175 deletions

View File

@ -7,8 +7,6 @@
// This backend tries not to do anything in the backend,
// but everything in VideoCommon.
#include "Core/Host.h"
#include "VideoBackends/Null/FramebufferManager.h"
#include "VideoBackends/Null/PerfQuery.h"
#include "VideoBackends/Null/Render.h"
@ -17,24 +15,15 @@
#include "VideoBackends/Null/VertexManager.h"
#include "VideoBackends/Null/VideoBackend.h"
#include "VideoCommon/BPStructs.h"
#include "VideoCommon/CommandProcessor.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/IndexGenerator.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/OpcodeDecoding.h"
#include "VideoCommon/PixelEngine.h"
#include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/VertexLoaderManager.h"
#include "VideoCommon/VertexShaderManager.h"
#include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoCommon.h"
#include "VideoCommon/VideoConfig.h"
namespace Null
{
void VideoBackend::InitBackendInfo()
{
g_Config.backend_info.APIType = API_NONE;
g_Config.backend_info.api_type = APIType::Nothing;
g_Config.backend_info.bSupportsExclusiveFullscreen = true;
g_Config.backend_info.bSupportsDualSourceBlend = true;
g_Config.backend_info.bSupportsEarlyZ = true;

View File

@ -6,6 +6,7 @@
#include "VideoCommon/Debugger.h"
#include "VideoCommon/Statistics.h"
#include "VideoCommon/VideoCommon.h"
namespace Null
{
@ -34,7 +35,7 @@ void ShaderCache<Uid>::Clear()
template <typename Uid>
bool ShaderCache<Uid>::SetShader(DSTALPHA_MODE dst_alpha_mode, u32 primitive_type)
{
Uid uid = GetUid(dst_alpha_mode, primitive_type, API_OPENGL);
Uid uid = GetUid(dst_alpha_mode, primitive_type, APIType::OpenGL);
// Check if the shader is already set
if (m_last_entry)
@ -59,7 +60,7 @@ bool ShaderCache<Uid>::SetShader(DSTALPHA_MODE dst_alpha_mode, u32 primitive_typ
}
// Need to compile a new shader
ShaderCode code = GenerateCode(dst_alpha_mode, API_OPENGL, uid);
ShaderCode code = GenerateCode(dst_alpha_mode, APIType::OpenGL, uid);
m_shaders.emplace(uid, code.GetBuffer());
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);

View File

@ -25,8 +25,8 @@ public:
bool SetShader(DSTALPHA_MODE dst_alpha_mode, u32 primitive_type);
protected:
virtual Uid GetUid(DSTALPHA_MODE dst_alpha_mode, u32 primitive_type, API_TYPE api_type) = 0;
virtual ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, API_TYPE api_type, Uid uid) = 0;
virtual Uid GetUid(DSTALPHA_MODE dst_alpha_mode, u32 primitive_type, APIType api_type) = 0;
virtual ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, APIType api_type, Uid uid) = 0;
private:
std::map<Uid, std::string> m_shaders;
@ -41,11 +41,11 @@ public:
protected:
VertexShaderUid GetUid(DSTALPHA_MODE dst_alpha_mode, u32 primitive_type,
API_TYPE api_type) override
APIType api_type) override
{
return GetVertexShaderUid();
}
ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, API_TYPE api_type,
ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, APIType api_type,
VertexShaderUid uid) override
{
return GenerateVertexShaderCode(api_type, uid.GetUidData());
@ -59,11 +59,11 @@ public:
protected:
GeometryShaderUid GetUid(DSTALPHA_MODE dst_alpha_mode, u32 primitive_type,
API_TYPE api_type) override
APIType api_type) override
{
return GetGeometryShaderUid(primitive_type);
}
ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, API_TYPE api_type,
ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, APIType api_type,
GeometryShaderUid uid) override
{
return GenerateGeometryShaderCode(api_type, uid.GetUidData());
@ -76,12 +76,11 @@ public:
static std::unique_ptr<PixelShaderCache> s_instance;
protected:
PixelShaderUid GetUid(DSTALPHA_MODE dst_alpha_mode, u32 primitive_type,
API_TYPE api_type) override
PixelShaderUid GetUid(DSTALPHA_MODE dst_alpha_mode, u32 primitive_type, APIType api_type) override
{
return GetPixelShaderUid(dst_alpha_mode);
}
ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, API_TYPE api_type,
ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, APIType api_type,
PixelShaderUid uid) override
{
return GeneratePixelShaderCode(dst_alpha_mode, api_type, uid.GetUidData());