Open ghost opened 11 years ago
I am quite sure that an issue here is with SSE 16 byte alignment. I was able to reproduce the issue and building with SSE disabled solved it. Specifically the restart is caused by function 'uint8_t raytrace(vec3 pos, vec3 dir, hit* info)' in src/reference.c:
int x = (int) pos.x;
int y = (int) pos.y;
int z = (int) pos.z;
GCC generates SSE instructions here which trash all registers.
Here is the patch to Makefile:
diff --git a/Makefile b/Makefile
index 9c47644..e708464 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,7 @@ CFLAGS:=-std=c99 -MMD
CFLAGS+=-m32
CFLAGS+=-g -ggdb
CFLAGS+=-O3 -ffast-math
+CFLAGS+=-mno-sse
CFLAGS+=-ffreestanding -nostdlib -nostdinc -fno-builtin -nostartfiles -nodefaultlibs -fno-exceptions -fno-stack-protector -static -fno-pic
LDFLAGS=-m elf_i386
This might just explain why the raytracing function doesn't work on my laptop at all. Nice find!
Could you add it to the prebuilt ISO? I don't have a Linux machine, so I don't think I can build it...
Unfortunately I don't have a Linux machine available right now either.
I'm gonna try it with Cygwin, I will get back to you when I am done. (If it even works)
When I press Enter to start playing, it loops back to the menu.