From e08b851c79ae9a7fc0a2066e49110dc7fb426bce Mon Sep 17 00:00:00 2001 From: Peter Fors Date: Mon, 28 Apr 2025 22:19:43 +0200 Subject: reverted rewrite of ppu, optimized what functions should be forced inline, gained ~2.5% performance --- base/base.c | 125 ------------------------------------------------------------ 1 file changed, 125 deletions(-) delete mode 100644 base/base.c (limited to 'base/base.c') diff --git a/base/base.c b/base/base.c deleted file mode 100644 index c17ab47..0000000 --- a/base/base.c +++ /dev/null @@ -1,125 +0,0 @@ -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 - #define WIN32_LEAN_AND_MEAN - #define NOMINMAX - #undef NOCRYPT - #include - #include -#elif defined(__linux__) - #include - // #include - // #include -#endif - -#include "settings.h" -#ifdef PROFILER -#define STB_SPRINTF_IMPLEMENTATION -#define STB_SPRINTF_NOFLOAT -#define STB_SPRINTF_STATIC -#include "stb_sprintf.h" -#define DEBUG_PRINT(format, ...) do { \ - char buf[512]; \ - int len = stbsp_snprintf(buf, sizeof(buf), format, ##__VA_ARGS__); \ - write(STDOUT_FILENO, buf, len); \ -} while(0) -#else -#define DEBUG_PRINT(...) -#endif - -#include "opengl_loader.c" - -#include "incbin.h" -#include "ugg.h" -#include "state.c" -#include "common.h" - - -#include "opengl.c" -#include "render.c" -#include - -#ifdef PROFILER -#include "overlay.c" -#endif -#include "audio.c" -#include "callbacks.c" - -/* [=]===^=[ main ]=================================================================^===[=] */ -int main(int argc, char **argv) { - state.toggle_crt_emulation = true; - mkfw_init(320*5, 240*5); - mkfw_set_swapinterval(0); - mkfw_set_window_min_size_and_aspect(320*3, 240*3, 320, 240); - mkfw_set_key_callback(key_callback); - mkfw_set_mouse_move_delta_callback(mouse_move_callback); - mkfw_set_mouse_button_callback(mouse_button_callback); - mkfw_set_framebuffer_size_callback(framebuffer_callback); - opengl_setup(vertex_shader_start, fragment_shader_start); - change_resolution(SCREEN_WIDTH, SCREEN_HEIGHT); - framebuffer_callback(SCREEN_WIDTH*3, SCREEN_HEIGHT*3); -#ifdef PROFILER - overlay_init(); -#endif - init_callback(); - audio_initialize(); - - set_decay(30); - - bool running = true; - uint64_t next_update = mkfw_gettime() + FRAMETIME; - while(running && !mkfw_should_close()) { - mkfw_pump_messages(); - if(key_pressed(MKS_KEY_ESCAPE)) { running = false; } - -#ifdef PROFILER - reset_profiling_data(); -#endif - render_callback(); -// #ifndef PERF_TEST - apply_phosphor_decay(); -// #endif - update_keyboard_state(); - update_modifier_state(); - update_mouse_state(); - state.frame_number++; - -#ifndef PERF_TEST - render_frame(); -#ifdef PROFILER - debug_render(); -#endif - - uint64_t now = mkfw_gettime(); - int64_t remaining = next_update - now; - if(remaining > 0) { - if(remaining > SLEEP_MARGIN_NS) { - mkfw_sleep(remaining - SLEEP_MARGIN_NS); - } - while(mkfw_gettime() < next_update) { /**/ } - } else { - next_update = now; - } - next_update += FRAMETIME; - - mkfw_swap_buffers(); -#endif - } - shutdown_callback(); -#ifdef PROFILER - overlay_shutdown(); -#endif - audio_shutdown(); - mkfw_cleanup(); - return 0; -} -- cgit v1.2.3