From a771a9247f16de9db0dba44a6c5e2f8bcedc6604 Mon Sep 17 00:00:00 2001 From: William Hjelm Date: Fri, 23 Sep 2022 14:26:57 +0200 Subject: [PATCH 1/2] Add _countof when not compiling with MSVS --- src/ffx-fsr2-api/ffx_fsr2.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ffx-fsr2-api/ffx_fsr2.cpp b/src/ffx-fsr2-api/ffx_fsr2.cpp index ebd69d5..e08bbcd 100644 --- a/src/ffx-fsr2-api/ffx_fsr2.cpp +++ b/src/ffx-fsr2-api/ffx_fsr2.cpp @@ -32,6 +32,14 @@ #include "ffx_fsr2_maximum_bias.h" +#ifndef _MSC_VER +template < typename T, size_t N > +size_t _countof(T(&arr)[N]) +{ + return std::extent< T[N] >::value; +} +#endif + #ifdef __clang__ #pragma clang diagnostic ignored "-Wunused-variable" #endif From 5036de9caaede65c514f1b5e20364a373d1abdf7 Mon Sep 17 00:00:00 2001 From: William Hjelm Date: Fri, 23 Sep 2022 14:28:41 +0200 Subject: [PATCH 2/2] Include stdlib.h first This is to fix an issue with Clang not finding typedef size_t in files that includes this header --- src/ffx-fsr2-api/ffx_assert.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ffx-fsr2-api/ffx_assert.cpp b/src/ffx-fsr2-api/ffx_assert.cpp index 7705490..7e8ea2b 100644 --- a/src/ffx-fsr2-api/ffx_assert.cpp +++ b/src/ffx-fsr2-api/ffx_assert.cpp @@ -19,8 +19,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#include "ffx_assert.h" #include // for malloc() +#include "ffx_assert.h" #ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN