From 72cdf0b04c13c1a20f8557d4aa0e62d530aa3789 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 9 Nov 2019 15:45:32 +0100 Subject: [PATCH] =?UTF-8?q?Replace=20gsl::span=E2=80=99s=20implementation?= =?UTF-8?q?=20with=20tcbrindle=E2=80=99s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This implementation optimises correctly on all relevant compilers, unlike GSL’s which gave extremely slow code on any compiler other than MSVC. Supersedes #6948. --- Utilities/GSL.h | 10 ---------- rpcs3/Emu/RSX/Common/BufferUtils.h | 4 +++- rpcs3/Emu/RSX/Common/ProgramStateCache.h | 6 ++++-- rpcs3/Emu/RSX/Common/TextureUtils.h | 4 +++- rpcs3/Emu/RSX/Common/surface_store.h | 4 +++- rpcs3/Emu/RSX/RSXThread.cpp | 4 +++- rpcs3/rpcs3qt/rsx_debugger.h | 2 -- 7 files changed, 16 insertions(+), 18 deletions(-) delete mode 100644 Utilities/GSL.h diff --git a/Utilities/GSL.h b/Utilities/GSL.h deleted file mode 100644 index 1ca9d77f92..0000000000 --- a/Utilities/GSL.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#define GSL_THROW_ON_CONTRACT_VIOLATION - -#pragma push_macro("new") -#undef new -#include -#pragma pop_macro("new") -#undef Expects -#undef Ensures diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.h b/rpcs3/Emu/RSX/Common/BufferUtils.h index 689b2e9f62..85ffd9df3b 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.h +++ b/rpcs3/Emu/RSX/Common/BufferUtils.h @@ -2,7 +2,9 @@ #include -#include "Utilities/GSL.h" +#define TCB_SPAN_NAMESPACE_NAME gsl +#include + #include "../gcm_enums.h" /** diff --git a/rpcs3/Emu/RSX/Common/ProgramStateCache.h b/rpcs3/Emu/RSX/Common/ProgramStateCache.h index 63decff4eb..fc0b8a0809 100644 --- a/rpcs3/Emu/RSX/Common/ProgramStateCache.h +++ b/rpcs3/Emu/RSX/Common/ProgramStateCache.h @@ -3,7 +3,9 @@ #include "Emu/RSX/RSXFragmentProgram.h" #include "Emu/RSX/RSXVertexProgram.h" -#include "Utilities/GSL.h" +#define TCB_SPAN_NAMESPACE_NAME gsl +#include + #include "Utilities/hash.h" #include "Utilities/mutex.h" #include "Utilities/Log.h" @@ -520,7 +522,7 @@ public: return 0; } - void fill_fragment_constants_buffer(gsl::span dst_buffer, const RSXFragmentProgram &fragment_program, bool sanitize = false) const + void fill_fragment_constants_buffer(gsl::span dst_buffer, const RSXFragmentProgram &fragment_program, bool sanitize = false) const { const auto I = m_fragment_shader_cache.find(fragment_program); if (I == m_fragment_shader_cache.end()) diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.h b/rpcs3/Emu/RSX/Common/TextureUtils.h index b72fd493dc..e6b146b4a0 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.h +++ b/rpcs3/Emu/RSX/Common/TextureUtils.h @@ -3,7 +3,9 @@ #include "../RSXTexture.h" #include -#include "Utilities/GSL.h" + +#define TCB_SPAN_NAMESPACE_NAME gsl +#include namespace rsx { diff --git a/rpcs3/Emu/RSX/Common/surface_store.h b/rpcs3/Emu/RSX/Common/surface_store.h index 12b0391982..5e580dcd04 100644 --- a/rpcs3/Emu/RSX/Common/surface_store.h +++ b/rpcs3/Emu/RSX/Common/surface_store.h @@ -1,6 +1,8 @@ #pragma once -#include "Utilities/GSL.h" +#define TCB_SPAN_NAMESPACE_NAME gsl +#include + #include "Emu/Memory/vm.h" #include "surface_utils.h" #include "../GCM.h" diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 0c2565afaa..52fa1fe41f 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -15,7 +15,9 @@ #include "Emu/Cell/lv2/sys_event.h" #include "Emu/Cell/Modules/cellGcmSys.h" -#include "Utilities/GSL.h" +#define TCB_SPAN_NAMESPACE_NAME gsl +#include + #include "Utilities/StrUtil.h" #include diff --git a/rpcs3/rpcs3qt/rsx_debugger.h b/rpcs3/rpcs3qt/rsx_debugger.h index 71f22005c2..3e50f70725 100644 --- a/rpcs3/rpcs3qt/rsx_debugger.h +++ b/rpcs3/rpcs3qt/rsx_debugger.h @@ -8,8 +8,6 @@ #include "Emu/RSX/GSRender.h" #include "Emu/RSX/GCM.h" -#include "Utilities/GSL.h" - #include "memory_viewer_panel.h" #include "table_item_delegate.h" #include "gui_settings.h"