On Sat, 16 Oct 2021 17:43:35 +0100 Edd Barrett <[email protected]> wrote:
> On Sat, Oct 16, 2021 at 10:16:48AM -0600, [email protected] wrote: > > http://build-failures.rhaalovely.net/powerpc/2021-09-28/games/odamex.log > > > <command line>:1:9: error: macro name must be an identifier > > #define -faltivec 1 > > Can you try this? Edd, your diff pointed at the correct place in client/CMakeLists.txt. I have a diff below, is my diff ok? odamex uses OpenGL and macppc has trouble with OpenGL. What works for me is to run "GALLIUM_DRIVER=softpipe odamex" on a macppc G4 without radeondrm. Then the frame rate is too slow (press an arrow key, wait 5 seconds), so I can only try the first few menus. Also, the title screen (from doomdata) is tinted blue. My G4 cpu has altivec; I tried those menus with both the GENERIC kernel and a no-ALTIVEC kernel. In client/CMakeLists.txt, remove -faltivec and pass -maltivec to just one file. This alone unbreaks the build on powerpc and powerpc64, but the powerpc package would never call the -maltivec file (because clang doesn't define __ALTIVEC__ in other files). Add 2 more patches to change __ALTIVEC__ to __powerpc__; my intent is to restore the SDL_HasAltivec() check and call the -maltivec file if and only if the powerpc cpu has altivec. My powerpc64 isn't running X, so I didn't try to play my powerpc64 package. clang for powerpc64 defaults to enabling -maltivec. --George Index: patches/patch-client_CMakeLists_txt =================================================================== RCS file: /cvs/ports/games/odamex/patches/patch-client_CMakeLists_txt,v retrieving revision 1.3 diff -u -p -r1.3 patch-client_CMakeLists_txt --- patches/patch-client_CMakeLists_txt 29 Aug 2021 22:09:09 -0000 1.3 +++ patches/patch-client_CMakeLists_txt 17 Oct 2021 21:26:10 -0000 @@ -1,9 +1,12 @@ $OpenBSD: patch-client_CMakeLists_txt,v 1.3 2021/08/29 22:09:09 sthen Exp $ +To fix powerpc* altivec, add -maltivec only in r_drawt_altivec.cpp, +and allow r_draw.cpp to detect altivec at runtime. + Index: client/CMakeLists.txt --- client/CMakeLists.txt.orig +++ client/CMakeLists.txt -@@ -163,7 +163,7 @@ if(TARGET SDL2::SDL2 OR TARGET SDL::SDL) +@@ -163,13 +163,14 @@ if(TARGET SDL2::SDL2 OR TARGET SDL::SDL) elseif(ODAMEX_TARGET_ARCH STREQUAL "i386") if(NOT MSVC) # Pentium M has SSE2. @@ -12,7 +15,15 @@ Index: client/CMakeLists.txt else() target_compile_definitions(odamex PRIVATE /arch:SSE2) endif() -@@ -220,7 +220,7 @@ if(TARGET SDL2::SDL2 OR TARGET SDL::SDL) + message(STATUS "Default SIMD flags set to SSE2") + elseif(ODAMEX_TARGET_ARCH MATCHES "ppc") +- target_compile_definitions(odamex PRIVATE -faltivec) ++ set_source_files_properties(src/r_drawt_altivec.cpp ++ PROPERTIES COMPILE_OPTIONS -maltivec) + message(STATUS "Default SIMD flags set to AltiVec") + endif() + else() +@@ -220,7 +221,7 @@ if(TARGET SDL2::SDL2 OR TARGET SDL::SDL) endif() if(UNIX AND NOT APPLE) Index: patches/patch-client_src_r_draw_cpp =================================================================== RCS file: patches/patch-client_src_r_draw_cpp diff -N patches/patch-client_src_r_draw_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-client_src_r_draw_cpp 17 Oct 2021 21:26:10 -0000 @@ -0,0 +1,26 @@ +$OpenBSD$ + +To fix powerpc* altivec, add -maltivec only in r_drawt_altivec.cpp, +and allow r_draw.cpp to detect altivec at runtime. + +Index: client/src/r_draw.cpp +--- client/src/r_draw.cpp.orig ++++ client/src/r_draw.cpp +@@ -1511,7 +1511,7 @@ static bool detect_optimizations() + if (SDL_HasSSE2()) + optimizations_available.push_back(OPTIMIZE_SSE2); + #endif +- #ifdef __ALTIVEC__ ++ #ifdef __powerpc__ + if (SDL_HasAltiVec()) + optimizations_available.push_back(OPTIMIZE_ALTIVEC); + #endif +@@ -1609,7 +1609,7 @@ void R_InitVectorizedDrawers() + r_dimpatchD = r_dimpatchD_MMX; + } + #endif +- #ifdef __ALTIVEC__ ++ #ifdef __powerpc__ + else if (optimize_kind == OPTIMIZE_ALTIVEC) + { + R_DrawSpanD = R_DrawSpanD_c; // TODO Index: patches/patch-common_r_draw_h =================================================================== RCS file: patches/patch-common_r_draw_h diff -N patches/patch-common_r_draw_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-common_r_draw_h 17 Oct 2021 21:26:10 -0000 @@ -0,0 +1,17 @@ +$OpenBSD$ + +To fix powerpc* altivec, add -maltivec only in r_drawt_altivec.cpp, +and allow r_draw.cpp to detect altivec at runtime. + +Index: common/r_draw.h +--- common/r_draw.h.orig ++++ common/r_draw.h +@@ -174,7 +174,7 @@ void R_DrawSlopeSpanD_MMX(void); + void r_dimpatchD_MMX(IWindowSurface*, argb_t color, int alpha, int x1, int y1, int w, int h); + #endif + +-#ifdef __ALTIVEC__ ++#ifdef __powerpc__ + void R_DrawSpanD_ALTIVEC(void); + void R_DrawSlopeSpanD_ALTIVEC(void); + void r_dimpatchD_ALTIVEC(IWindowSurface*, argb_t color, int alpha, int x1, int y1, int w, int h);
