Add option for IPU-only rendering

This commit is contained in:
jndean
2023-12-10 19:35:19 +00:00
parent 1d1d252753
commit 67eb78e08d
10 changed files with 39 additions and 32 deletions
+1 -2
View File
@@ -7,7 +7,6 @@ IPU_OBJ = $(addprefix build/ipu_obj/, \
ipu_vertices.gp \
ipu_transfer.gp \
ipu_malloc.gp \
ipu_texturetiles.gp \
i_video.gp \
g_game.gp \
g_game_codelets.gp \
@@ -58,7 +57,7 @@ build/cpu_obj/%.o: src/%.cpp #src/*.h
gcc-7 src/$*.cpp $(CPU_FLAGS) -c -o $@
build/ipu_rt.gp: $(IPU_OBJ)
popc $^ $(IPU_FLAGS) -o $@
popc $^ src/ipu/ipu_texturetiles.gp $(IPU_FLAGS) -o $@
build/ipu_obj/%.gp: src/ipu/%.c src/ipu/*.h
popc $< $(IPU_FLAGS) -o $@
+8 -3
View File
@@ -4,7 +4,7 @@
A WIP to run Doom 1993 in 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
I use Ubuntu20 and Poplar SDK 3.3, but recent versions of either should be fine.
I use Ubuntu20 and Poplar SDK 3.3, but recent versions of either will probably work 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).
@@ -26,8 +26,13 @@ make -j4
# Download the doom shareware resource pack (contains the free levels)
wget https://distro.ibiblio.org/slitaz/sources/packages/d/doom1.wad
# Run the game. It will start a demo - press any key to bring up the main menu.
./build/doom -iwad doom1.wad -width 320 -nosound -nomouse
# Run the game - it will start a demo, press any key bring up the menu.
# Uses the CPU to overdraw the components that are not yet ported to IPU
./build/doom -iwad doom1.wad -width 320 -nosound
# Run the game without the CPU adding the bits missing from the IPU port,
# so you can see IPUDoom in its raw ipu-only glory
./build/doom -iwad doom1.wad -width 320 -nosound -ipuonly
```
+2 -1
View File
@@ -443,6 +443,7 @@ boolean D_InitNetGame(net_connect_data_t *connect_data)
net_addr_t *addr = NULL;
int i;
// Call D_QuitNetGame on exit:
I_AtExit(D_QuitNetGame, true);
@@ -458,7 +459,7 @@ boolean D_InitNetGame(net_connect_data_t *connect_data)
if (M_CheckParm("-server") > 0
|| M_CheckParm("-privateserver") > 0)
{
printf("JOSEF SAYS: I do not support multiplayer :)\n");
printf("JOSEF SAYS: I have disabled multiplayer :)\n");
exit(0); // But if you remove this return statement it might just work :)
NET_SV_Init();
NET_SV_AddModule(&net_loop_server_module);
+15 -2
View File
@@ -215,8 +215,12 @@ void D_Display(void) {
redrawsbar = true;
if (inhelpscreensstate && !inhelpscreens)
redrawsbar = true; // just put away the help screen
ST_Drawer(viewheight == SCREENHEIGHT, redrawsbar);
// (void) redrawsbar; // JOSEF: for disabling ST_Drawer
if (!renderIPUonly) { // JOSEF
ST_Drawer(viewheight == SCREENHEIGHT, redrawsbar);
} else {
memset(&I_VideoBuffer[SCREENWIDTH * (SCREENHEIGHT - 32)], 0, SCREENWIDTH * 32);
}
fullscreen = viewheight == SCREENHEIGHT;
break;
@@ -913,6 +917,15 @@ void D_DoomMain(void) {
devparm = M_CheckParm("-devparm");
I_DisplayFPSDots(devparm);
//!
// @JOSEF
//
// Only use the IPU for rendering, disable CPU overdraw of missing elements
//
renderIPUonly = M_CheckParm("-ipuonly");
//!
// @category net
+4 -2
View File
@@ -976,8 +976,10 @@ void I_GraphicsCheckCommandLine(void)
// Disable the mouse.
//
nomouse = M_CheckParm("-nomouse") > 0;
// JOSEF: Disable mouse input
// nomouse = M_CheckParm("-nomouse") > 0;
nomouse = 1;
//!
// @category video
// @arg <x>
-16
View File
@@ -1,16 +0,0 @@
GARPHOBJS = AM_map.gp # m_fixed.gp
all: ipu_rt.gp
ipu_rt.gp: $(GARPHOBJS) ipu_vertices.gp
popc $(GARPHOBJS) ipu_vertices.gp -o $@
ipu_vertices.gp: ipu_vertices.cpp
popc -Os $^ -o $@
%.gp: %.c
popc -Os $^ -o $@
clean:
rm $(GARPHOBJS) ipu_vertices.gp
Binary file not shown.
-3
View File
@@ -90,9 +90,6 @@ R_RenderPlayerView_Vertex : public poplar::SupervisorVertex {
(R_RenderPlayerView_MiscValues_t*) &miscValues[0]
);
// For visualisation of progress
memset(I_VideoBuffer, 0, IPUCOLSPERRENDERTILE * SCREENHEIGHT);
R_RenderPlayerView(&players[displayplayer]);
IPU_R_RenderTileDone();
return;
+6 -3
View File
@@ -106,6 +106,8 @@ lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
// bumped light from gun blasts
int extralight;
int renderIPUonly; // JOSEF
void (*colfunc)(void);
void (*basecolfunc)(void);
void (*fuzzcolfunc)(void);
@@ -750,11 +752,12 @@ void R_RenderPlayerView(player_t *player) {
// R_DrawPlanes();
// Check for new console commands.
NetUpdate();
// NetUpdate();
// R_DrawMasked();
IPU_R_RenderPlayerView();
if (!renderIPUonly) R_DrawMasked();
// Check for new console commands.
NetUpdate();
IPU_R_RenderPlayerView();
}
+3
View File
@@ -77,6 +77,9 @@ extern lighttable_t *fixedcolormap;
// 0 = high, 1 = low
extern int detailshift;
extern int renderIPUonly; // JOSEF
//
// Function pointers to switch refresh/drawing functions.
// Used to select shadow mode etc.