diff options
| author | OatmealDome <julian@oatmealdome.me> | 2025-01-24 18:31:42 -0500 |
|---|---|---|
| committer | OatmealDome <julian@oatmealdome.me> | 2025-01-24 18:31:42 -0500 |
| commit | bffaec9c5e6b68187a86288cf3db6e88e4bea2ce (patch) | |
| tree | 0be7c08f5bc3e145caf6417f0166f9b764d27af1 /Source/Core/VideoCommon/VertexLoaderBase.cpp | |
| parent | d0b7c96fdb7ea50d55bb3cf581e5820d7b27b7e1 (diff) | |
VertexLoaderBase: Allow the vertex loader type to be set via config
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoaderBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexLoaderBase.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/Source/Core/VideoCommon/VertexLoaderBase.cpp b/Source/Core/VideoCommon/VertexLoaderBase.cpp index a3597b53e5..36b6a2a67f 100644 --- a/Source/Core/VideoCommon/VertexLoaderBase.cpp +++ b/Source/Core/VideoCommon/VertexLoaderBase.cpp @@ -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 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 (!native_loader) + { + return std::make_unique<VertexLoader>(vtx_desc, vtx_attr); + } + + 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; } |
