From 4a60f62a99a0972c81671e779abaac8e0ae53ec3 Mon Sep 17 00:00:00 2001 From: jndean Date: Thu, 7 Dec 2023 17:14:22 +0000 Subject: [PATCH] Adjust memory config to fit E1M2. Spruce up README. --- README.md | 22 ++++++++++++++-------- src/d_main.c | 5 +++-- src/ipu/ipu_interface.h | 2 +- src/ipu/ipu_malloc.c | 4 ++-- src/ipu/p_setup.c | 2 ++ src/m_menu.c | 12 ++++++------ 6 files changed, 28 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index dc65fdd..852ff75 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,36 @@ ![IPUDOOM](README_imgs/IPUDOOM.png) -A WIP to fit Doom 1993 into the SRAM (~L1 cache) of the Graphcore MkII IPU (an AI accelerator chip which was definitely not designed to play video games). This is a hobby project, not a Graphcore product. +A WIP to run Doom 1993 into the SRAM (~L1 cache) of the Graphcore MkII IPU (an AI accelerator chip which was definitely not designed to play video games). This is a hobby project, not a Graphcore product. -### Build and Run +## Build and Run +I use Ubuntu20 and Poplar SDK 3.3, but recent versions of either should be fine. Due to the use of mutable global state and a custom exchange compiler, IPUDOOM requires a real IPU and will not run on the IPUModel (CPU simulating an IPU). +Make sure you have X11 fowarding over SSH working (use `ssh -X
` and have a local X server, e.g. Quartz on Mac, Xming on Windows). If your connection is fast enough, you should be able to get > 30 fps. ```bash # Install dependencies sudo apt update sudo apt-get install -y libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev g++-7 + # Activate your poplar SDK source ~/path/to/poplar/build_release/activate.sh + # Clone and build git clone git@github.com:jndean/IPUDOOM.git cd IPUDOOM -make -# Download shareware resource pack +make -j4 + +# Download the doom shareware resource pack (contains the free levels) wget https://distro.ibiblio.org/slitaz/sources/packages/d/doom1.wad -# Run + +# To play the game, run. Press any key to bring up the menu. ./build/doom -iwad doom1.wad -width 320 -nosound -nomouse ``` -### Progress Log: -Started with vanilla Doom running on the CPU, began offloading subsystems to the IPU (just Tile 0 at first): +## Progress Log: +Started with Chocolate Doom running on the CPU, began offloading subsystems to the IPU (just Tile 0 at first): - [x] Create IPU hooks for key methods like G_Ticker and G_Responder so IPU can step game time and respond to keypresses in real time. IPU uses callbacks on the host to load and unpack all level geometry from disk whenever the player starts a new level. @@ -50,7 +56,7 @@ Started with vanilla Doom running on the CPU, began offloading subsystems to the ![Gameplay with visplanes and skybox visible](README_imgs/VisplanesSkybox_noCPU.gif) -- [x] Extend the JIT-patching texture exchange to support span textures and zlighting, so IPU can texture and shade floors + ceilings. +- [x] Extend the JIT-patching texture exchange to support span textures and zlighting, so IPU can texture and shade floors + ceilings. (The flashing in the gif below comes from gunfire, though enemies and weapons are not yet rendered). ![Gameplay with textured and shaded floors and ceilings](README_imgs/TexturedFlats_noCPU.gif) diff --git a/src/d_main.c b/src/d_main.c index ede67f1..1db9cc9 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -208,14 +208,15 @@ void D_Display(void) { if (automapactive) AM_Drawer(); - // IPU_AM_Drawer(); // JOSEF. Disabled while I split render tiles + // IPU_AM_Drawer(); // JOSEF. TMP Disabled while I split render tiles if (wipe || (viewheight != SCREENHEIGHT && fullscreen)) redrawsbar = true; if (inhelpscreensstate && !inhelpscreens) redrawsbar = true; // just put away the help screen - ST_Drawer(viewheight == SCREENHEIGHT, redrawsbar); + ST_Drawer(viewheight == SCREENHEIGHT, redrawsbar); + // (void) redrawsbar; // JOSEF: for disabling ST_Drawer fullscreen = viewheight == SCREENHEIGHT; break; diff --git a/src/ipu/ipu_interface.h b/src/ipu/ipu_interface.h index 8b7f2a3..b58e5c0 100644 --- a/src/ipu/ipu_interface.h +++ b/src/ipu/ipu_interface.h @@ -13,7 +13,7 @@ extern "C" { #include "tables.h" -#define IPUMAXLUMPBYTES (32000) +#define IPUMAXLUMPBYTES (40000) #define IPUMISCVALUESSIZE (116) #define IPUMAXEVENTSPERTIC (5) #define IPUAMMARKBUFSIZE (544) diff --git a/src/ipu/ipu_malloc.c b/src/ipu/ipu_malloc.c index 5b2fee4..65b003c 100644 --- a/src/ipu/ipu_malloc.c +++ b/src/ipu/ipu_malloc.c @@ -9,9 +9,9 @@ // #define IPUMALLOC_DEBUGPRINT 0 __attribute__ ((aligned (4))) -static unsigned char IPUMALLOC_STATIC_pool[10000]; +static unsigned char IPUMALLOC_STATIC_pool[8000]; __attribute__ ((aligned (4))) -static unsigned char IPUMALLOC_LEVEL_pool[200000]; +static unsigned char IPUMALLOC_LEVEL_pool[250000]; __attribute__ ((aligned (4))) static unsigned char IPUMALLOC_TMP_pool[512]; // This is a category I made up, for fleeting allocations diff --git a/src/ipu/p_setup.c b/src/ipu/p_setup.c index 416f5fa..fc4e603 100644 --- a/src/ipu/p_setup.c +++ b/src/ipu/p_setup.c @@ -417,6 +417,8 @@ void P_LoadLineDefs(const unsigned char *buf) { else ld->backsector = 0; } + + } // diff --git a/src/m_menu.c b/src/m_menu.c index 96baf4b..ef2146f 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1243,19 +1243,19 @@ boolean M_Responder(event_t *ev) { if (key == key_menu_decscreen) // Screen size down { // JOSEF: Unsupported on IPU - // if (automapactive || chat_on) - // return false; + if (automapactive || chat_on) + return false; // M_SizeDisplay(0); // S_StartSound(NULL, sfx_stnmov); - return true; + // return true; } else if (key == key_menu_incscreen) // Screen size up { // JOSEF: Unsupported on IPU - // if (automapactive || chat_on) - // return false; + if (automapactive || chat_on) + return false; // M_SizeDisplay(1); // S_StartSound(NULL, sfx_stnmov); - return true; + // return true; } else if (key == key_menu_help) // Help key { M_StartControlPanel();