From 8481fd05ccbe52b5d61825c51bf1c0645be9069c Mon Sep 17 00:00:00 2001 From: Colton Pawielski Date: Sat, 4 Mar 2023 16:10:34 -0600 Subject: [PATCH 1/4] Add dcbuild & pcbuild folders to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index aeef46b..fdf6f9c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ dc-build.sh build/* builddir/* version.[c|h] +pcbuild/* +dcbuild/* \ No newline at end of file From ac6914398c1492243308b902fa6237dbc78857a2 Mon Sep 17 00:00:00 2001 From: Colton Pawielski Date: Sat, 4 Mar 2023 16:11:11 -0600 Subject: [PATCH 2/4] Fix .elf extension on C example executables --- toolchains/Dreamcast.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchains/Dreamcast.cmake b/toolchains/Dreamcast.cmake index fa5110c..a35b73c 100644 --- a/toolchains/Dreamcast.cmake +++ b/toolchains/Dreamcast.cmake @@ -49,7 +49,7 @@ ENDIF() add_link_options(-L$ENV{KOS_BASE}/lib/dreamcast) link_libraries(-Wl,--start-group -lstdc++ -lkallisti -lc -lgcc -Wl,--end-group m) -SET(CMAKE_EXECUTABLE_SUFFIX ".elf") +SET(CMAKE_EXECUTABLE_SUFFIX_C ".elf") SET(CMAKE_EXECUTABLE_SUFFIX_CXX ".elf") ADD_DEFINITIONS( From 5bb2691b91c7458b971863ade27444b70e8a5745 Mon Sep 17 00:00:00 2001 From: Colton Pawielski Date: Sat, 4 Mar 2023 16:13:44 -0600 Subject: [PATCH 3/4] Change CMakeLists.txt to add -mfsrra and -mfsca only if supported by compiler GCC4.7 does not support these flags and cause a failure to build --- CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d54ba2..a9d9982 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,16 @@ if(NOT PLATFORM_DREAMCAST) set(FIND_LIBRARY_USE_LIB32_PATHS true) set(FIND_LIBRARY_USE_LIB64_PATHS false) else() - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfsrra -ffp-contract=fast -mfsca -ffast-math") + include(CheckCCompilerFlag) + check_c_compiler_flag("-mfsrra" COMPILER_HAS_FSRRA) + check_c_compiler_flag("-mfsca" COMPILER_HAS_FSCA) + if(COMPILER_HAS_FSRRA) + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfsrra") + endif() + if(COMPILER_HAS_FSCA) + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfsca") + endif() + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffp-contract=fast -ffast-math") endif() set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -fexpensive-optimizations") From e27c276daa300ecc3c8d86774b8fc0d51d6f1bca Mon Sep 17 00:00:00 2001 From: falco Date: Thu, 16 Feb 2023 17:09:15 -0500 Subject: [PATCH 4/4] Fixed poly/tri/quadmarks to build with GCC12 "start" is a reserved symbol within KOS, per crt1.s. Not sure why the old toolchains let us use this symbol name elsewhere, but the new GCC12 toolchain rightfully complains about duplicate symbols. - Renamed "start" timestamp to "begin." --- samples/polymark/main.c | 8 ++++---- samples/quadmark/main.c | 8 ++++---- samples/trimark/main.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/samples/polymark/main.c b/samples/polymark/main.c index 60d396b..2a58c45 100644 --- a/samples/polymark/main.c +++ b/samples/polymark/main.c @@ -100,7 +100,7 @@ void do_frame() { glKosSwapBuffers(); } -time_t start; +time_t begin; void switch_tests(int ppf) { printf("Beginning new test: %d polys per frame (%d per second at 60fps)\n", ppf * 3, ppf * 3 * 60); @@ -113,8 +113,8 @@ void check_switch() { now = time(NULL); - if(now >= (start + 5)) { - start = time(NULL); + if(now >= (begin + 5)) { + begin = time(NULL); printf(" Average Frame Rate: ~%f fps (%d pps)\n", avgfps, (int)(polycnt * avgfps * 2)); switch(phase) { @@ -165,7 +165,7 @@ int main(int argc, char **argv) { /* Start off with something obscene */ switch_tests(200000 / 60); - start = time(NULL); + begin = time(NULL); for(;;) { if(check_start()) diff --git a/samples/quadmark/main.c b/samples/quadmark/main.c index 847c9f6..4da3046 100644 --- a/samples/quadmark/main.c +++ b/samples/quadmark/main.c @@ -112,7 +112,7 @@ void do_frame() { glKosSwapBuffers(); } -time_t start; +time_t begin; void switch_tests(int ppf) { printf("Beginning new test: %d polys per frame (%d per second at 60fps)\n", ppf * 2, ppf * 2 * 60); @@ -125,8 +125,8 @@ void check_switch() { now = time(NULL); - if(now >= (start + 5)) { - start = time(NULL); + if(now >= (begin + 5)) { + begin = time(NULL); printf(" Average Frame Rate: ~%f fps (%d pps)\n", avgfps, (int)(polycnt * avgfps * 2)); switch(phase) { @@ -184,7 +184,7 @@ int main(int argc, char **argv) { /* Start off with something obscene */ switch_tests(200000 / 60); - start = time(NULL); + begin = time(NULL); uint32_t iterations = 2000; diff --git a/samples/trimark/main.c b/samples/trimark/main.c index 3bd2004..2b542cb 100644 --- a/samples/trimark/main.c +++ b/samples/trimark/main.c @@ -93,7 +93,7 @@ void do_frame() { glKosSwapBuffers(); } -time_t start; +time_t begin; void switch_tests(int ppf) { printf("Beginning new test: %d polys per frame (%d per second at 60fps)\n", ppf * 2, ppf * 2 * 60); @@ -106,8 +106,8 @@ void check_switch() { now = time(NULL); - if(now >= (start + 5)) { - start = time(NULL); + if(now >= (begin + 5)) { + begin = time(NULL); printf(" Average Frame Rate: ~%f fps (%d pps)\n", avgfps, (int)(polycnt * avgfps * 2)); switch(phase) { @@ -155,7 +155,7 @@ int main(int argc, char **argv) { /* Start off with something obscene */ switch_tests(220000 / 60); - start = time(NULL); + begin = time(NULL); for(;;) { if(check_start())