Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu Loop #4

Open
ghost opened this issue Jun 19, 2013 · 5 comments
Open

Menu Loop #4

ghost opened this issue Jun 19, 2013 · 5 comments

Comments

@ghost
Copy link

ghost commented Jun 19, 2013

When I press Enter to start playing, it loops back to the menu.

@asido
Copy link

asido commented Jul 1, 2013

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

@Overv
Copy link
Owner

Overv commented Jul 1, 2013

This might just explain why the raytracing function doesn't work on my laptop at all. Nice find!

@KoolenDasheppi
Copy link

Could you add it to the prebuilt ISO? I don't have a Linux machine, so I don't think I can build it...

@Overv
Copy link
Owner

Overv commented Mar 14, 2016

Unfortunately I don't have a Linux machine available right now either.

@KoolenDasheppi
Copy link

I'm gonna try it with Cygwin, I will get back to you when I am done. (If it even works)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants