mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
VertexLoaderBase: Allow the vertex loader type to be set via config
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
#include "VideoCommon/VertexLoader_Normal.h"
|
||||
#include "VideoCommon/VertexLoader_Position.h"
|
||||
#include "VideoCommon/VertexLoader_TextCoord.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
#ifdef _M_X86_64
|
||||
#include "VideoCommon/VertexLoaderX64.h"
|
||||
@ -238,29 +239,37 @@ u32 VertexLoaderBase::GetVertexComponents(const TVtxDesc& vtx_desc, const VAT& v
|
||||
std::unique_ptr<VertexLoaderBase> VertexLoaderBase::CreateVertexLoader(const TVtxDesc& vtx_desc,
|
||||
const VAT& vtx_attr)
|
||||
{
|
||||
std::unique_ptr<VertexLoaderBase> loader = nullptr;
|
||||
const VertexLoaderType loader_type = g_ActiveConfig.vertex_loader_type;
|
||||
|
||||
// #define COMPARE_VERTEXLOADERS
|
||||
if (loader_type == VertexLoaderType::Software)
|
||||
{
|
||||
return std::make_unique<VertexLoader>(vtx_desc, vtx_attr);
|
||||
}
|
||||
|
||||
std::unique_ptr<VertexLoaderBase> native_loader = nullptr;
|
||||
|
||||
#if defined(_M_X86_64)
|
||||
loader = std::make_unique<VertexLoaderX64>(vtx_desc, vtx_attr);
|
||||
native_loader = std::make_unique<VertexLoaderX64>(vtx_desc, vtx_attr);
|
||||
#elif defined(_M_ARM_64)
|
||||
loader = std::make_unique<VertexLoaderARM64>(vtx_desc, vtx_attr);
|
||||
native_loader = std::make_unique<VertexLoaderARM64>(vtx_desc, vtx_attr);
|
||||
#endif
|
||||
|
||||
// Use the software loader as a fallback
|
||||
// (not currently applicable, as both VertexLoaderX64 and VertexLoaderARM64
|
||||
// are always usable, but if a loader that only works on some CPUs is created
|
||||
// then this fallback would be used)
|
||||
if (!loader)
|
||||
loader = std::make_unique<VertexLoader>(vtx_desc, vtx_attr);
|
||||
if (!native_loader)
|
||||
{
|
||||
return std::make_unique<VertexLoader>(vtx_desc, vtx_attr);
|
||||
}
|
||||
|
||||
#if defined(COMPARE_VERTEXLOADERS)
|
||||
return std::make_unique<VertexLoaderTester>(
|
||||
std::make_unique<VertexLoader>(vtx_desc, vtx_attr), // the software one
|
||||
std::move(loader), // the new one to compare
|
||||
vtx_desc, vtx_attr);
|
||||
#else
|
||||
return loader;
|
||||
#endif
|
||||
if (loader_type == VertexLoaderType::Compare)
|
||||
{
|
||||
return std::make_unique<VertexLoaderTester>(
|
||||
std::make_unique<VertexLoader>(vtx_desc, vtx_attr), // the software one
|
||||
std::move(native_loader), // the new one to compare
|
||||
vtx_desc, vtx_attr);
|
||||
}
|
||||
|
||||
return native_loader;
|
||||
}
|
||||
|
Reference in New Issue
Block a user