Index: binaries/data/mods/public/gui/credits/texts/programming.json =================================================================== --- binaries/data/mods/public/gui/credits/texts/programming.json +++ binaries/data/mods/public/gui/credits/texts/programming.json @@ -207,6 +207,7 @@ { "nick": "Raj", "name": "Raj Sharma" }, { "nick": "ramtzok1", "name": "Ram" }, { "nick": "rapidelectron", "name": "Christian Weihsbach" }, + { "nick": "r-a-sattarov", "name": "Ramil Sattarov" }, { "nick": "RedFox", "name": "Jorma Rebane" }, { "nick": "RefinedCode" }, { "nick": "Riemer" }, Index: build/premake/premake5.lua =================================================================== --- build/premake/premake5.lua +++ build/premake/premake5.lua @@ -84,6 +84,8 @@ arch = "arm" elseif string.find(machine, "aarch64") == 1 then arch = "aarch64" + elseif string.find(machine, "e2k") == 1 then + arch = "e2k" else print("WARNING: Cannot determine architecture from GCC, assuming x86") end @@ -861,6 +863,8 @@ table.insert(source_dirs, "lib/sysdep/arch/arm"); elseif arch == "aarch64" then table.insert(source_dirs, "lib/sysdep/arch/aarch64"); + elseif arch == "e2k" then + table.insert(source_dirs, "lib/sysdep/arch/e2k"); end -- OS-specific Index: source/graphics/Color.cpp =================================================================== --- source/graphics/Color.cpp +++ source/graphics/Color.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -26,9 +26,23 @@ #if HAVE_SSE # include + +#if ARCH_X86_X64 # include "lib/sysdep/arch/x86_x64/x86_x64.h" #endif +namespace +{ +#if ARCH_X86_X64 + static bool g_EnableSSE = x86_x64::Cap(x86_x64::CAP_SSE); +#elif ARCH_E2K + static bool g_EnableSSE = true; +#else + static bool g_EnableSSE = false; +#endif +} // namespace +#endif // if HAVE_SSE + static SColor4ub fallback_ConvertRGBColorTo4ub(const RGBColor& src) { SColor4ub result; @@ -78,7 +92,7 @@ void ColorActivateFastImpl() { #if HAVE_SSE - if (x86_x64::Cap(x86_x64::CAP_SSE)) + if (g_EnableSSE) { ConvertRGBColorTo4ub = sse_ConvertRGBColorTo4ub; return; Index: source/lib/byte_order.h =================================================================== --- source/lib/byte_order.h +++ source/lib/byte_order.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -33,7 +33,7 @@ #ifndef BYTE_ORDER # define LITTLE_ENDIAN 0x4321 # define BIG_ENDIAN 0x1234 -# if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || ARCH_AARCH64 || ARCH_MIPS || defined(__LITTLE_ENDIAN__) +# if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || ARCH_AARCH64 || ARCH_MIPS || ARCH_E2K || defined(__LITTLE_ENDIAN__) # define BYTE_ORDER LITTLE_ENDIAN # else # define BYTE_ORDER BIG_ENDIAN Index: source/lib/sysdep/arch.h =================================================================== --- source/lib/sysdep/arch.h +++ source/lib/sysdep/arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -70,9 +70,15 @@ #else # define ARCH_MIPS 0 #endif +// .. E2K (MCST Elbrus 2000) +#if defined(__e2k__) +# define ARCH_E2K 1 +#else +# define ARCH_E2K 0 +#endif // ensure exactly one architecture has been detected -#if (ARCH_IA32+ARCH_IA64+ARCH_AMD64+ARCH_ALPHA+ARCH_ARM+ARCH_AARCH64+ARCH_MIPS) != 1 +#if (ARCH_IA32+ARCH_IA64+ARCH_AMD64+ARCH_ALPHA+ARCH_ARM+ARCH_AARCH64+ARCH_MIPS+ARCH_E2K) != 1 # error "architecture not correctly detected (either none or multiple ARCH_* defined)" #endif Index: source/lib/sysdep/arch/e2k/e2k.cpp =================================================================== --- source/lib/sysdep/arch/e2k/e2k.cpp +++ source/lib/sysdep/arch/e2k/e2k.cpp @@ -0,0 +1,50 @@ +/* Copyright (C) 2020 Wildfire Games. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * Routines specific to E2K (MCST Elbrus 2000). + */ + +#include "precompiled.h" + +#include "lib/sysdep/cpu.h" + +intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment) +{ + return __sync_fetch_and_add(location, increment); +} + +bool cpu_CAS(volatile intptr_t* location, intptr_t expected, intptr_t newValue) +{ + return __sync_bool_compare_and_swap(location, expected, newValue); +} + +bool cpu_CAS64(volatile i64* location, i64 expected, i64 newValue) +{ + return __sync_bool_compare_and_swap(location, expected, newValue); +} + +const char* cpu_IdentifierString() +{ + const char* cpuID = __builtin_cpu_name(); + return cpuID; +} Index: source/lib/sysdep/compiler.h =================================================================== --- source/lib/sysdep/compiler.h +++ source/lib/sysdep/compiler.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2019 Wildfire Games. +/* Copyright (c) 2020 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -43,11 +43,19 @@ # define ICC_VERSION 0 #endif // .. LCC (VC-compatible) -#if defined(__LCC__) +// LCC-Win32 and MCST lcc compilers define same identifier (__LCC__). +// Have been added check of MCST Elbrus 2000 (e2k) architecture. +#if defined(__LCC__) && !defined(__e2k__) # define LCC_VERSION __LCC__ #else # define LCC_VERSION 0 #endif +// .. MCST LCC (eLbrus C Compiler) +#if defined(__LCC__) && defined(__e2k__) +# define MCST_LCC_VERSION (__LCC__*100 + __LCC_MINOR__) +#else +# define MCST_LCC_VERSION 0 +#endif // .. GCC #ifdef __GNUC__ # define GCC_VERSION (__GNUC__*100 + __GNUC_MINOR__) Index: source/ps/GameSetup/HWDetect.cpp =================================================================== --- source/ps/GameSetup/HWDetect.cpp +++ source/ps/GameSetup/HWDetect.cpp @@ -181,6 +181,7 @@ scriptInterface.SetProperty(settings, "arch_amd64", ARCH_AMD64); scriptInterface.SetProperty(settings, "arch_arm", ARCH_ARM); scriptInterface.SetProperty(settings, "arch_aarch64", ARCH_AARCH64); + scriptInterface.SetProperty(settings, "arch_e2k", ARCH_E2K); #ifdef NDEBUG scriptInterface.SetProperty(settings, "build_debug", 0); Index: source/renderer/ModelRenderer.cpp =================================================================== --- source/renderer/ModelRenderer.cpp +++ source/renderer/ModelRenderer.cpp @@ -41,23 +41,29 @@ #include "renderer/TimeManager.h" #include "renderer/WaterManager.h" -#if ARCH_X86_X64 -# include "lib/sysdep/arch/x86_x64/x86_x64.h" -#endif - /////////////////////////////////////////////////////////////////////////////////////////////// // ModelRenderer implementation -#if ARCH_X86_X64 +#if HAVE_SSE static bool g_EnableSSE = false; #endif void ModelRenderer::Init() { +#if HAVE_SSE + +#if ARCH_X86_X64 +# include "lib/sysdep/arch/x86_x64/x86_x64.h" +#endif + #if ARCH_X86_X64 - if (x86_x64::Cap(x86_x64::CAP_SSE)) - g_EnableSSE = true; + static bool g_EnableSSE = x86_x64::Cap(x86_x64::CAP_SSE); +#elif ARCH_E2K + static bool g_EnableSSE = true; +#else + static bool g_EnableSSE = false; #endif +#endif // if HAVE_SSE } // Helper function to copy object-space position and normal vectors into arrays.