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

Map BSP problems #147

Closed
ghost opened this issue Jun 8, 2016 · 11 comments
Closed

Map BSP problems #147

ghost opened this issue Jun 8, 2016 · 11 comments

Comments

@ghost
Copy link

ghost commented Jun 8, 2016

I've started making maps for Doom 3, using DarkRadiant. I compile them using the 'dmap' command from Doom 3.

The problem is some geometry is rendered wrongly in-game. Here's a thread I created on the idTech4 forum, that demonstrates the problem.

The interesting thing is that these glitches aren't there when the map is compiled in stock Doom 3.

Please take a look at this testmap.

@DanielGibson
Copy link
Member

yeah, dmap hasn't been tested much yet, as far as I remember..
I wonder if this also happens in 32bit builds of dhewm3 (might be a 64bit issue)?

@ghost
Copy link
Author

ghost commented Jun 9, 2016

I can compile a 32-bit build later today and try with that.

@DanielGibson
Copy link
Member

so have you tried 32bit builds yet?

@ghost
Copy link
Author

ghost commented Jul 27, 2016

Hello,

Sorry about the lateness! Been busy with things.
Unfortunately no, I haven't had the chance to try yet. I've got a laptop running 32-bit Linux which I meant to test it with, but it's at my parent's place which I haven't managed to visit yet in the meantime.

@DanielGibson
Copy link
Member

any update on this?

@DanielGibson
Copy link
Member

I can't reproduce the problem with latest dhewm3 (from git) on XUbuntu 18.04 x86_64 (GCC 7.5 and clang 6.0).

@DanielGibson
Copy link
Member

Also works with XUbuntu 20.04 (GCC 9.3 and 10.2) so I guess this issue has been fixed accidentally.

@DanielGibson
Copy link
Member

Turns out I can reproduce it after all, but only if ONATIVE is enabled in CMake - this would've been relevant information.

RobertBeckebans/RBDOOM-3-BFG#436 discusses the issue, which is caused by a GCC compiler bug (at least I think it's a bug).

@DanielGibson DanielGibson reopened this May 30, 2021
DanielGibson added a commit that referenced this issue May 31, 2021
Only happend if `ONATIVE` was enabled (or some other flag was set
that enables the FMA extension), the root cause was that the cross
product didn't return 0 when it should, but a small value < 0.
Caused some faces to be missing in maps compiled with dmap.
RobertBeckebans/RBDOOM-3-BFG#436 (comment)
has lots of explanation.

I think this is a compiler bug, this commit works around it.

fixes #147
@DanielGibson
Copy link
Member

GCC bugreport for this: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100839

@BielBdeLuna
Copy link
Contributor

is -ffp-contract=off the solution?

@DanielGibson
Copy link
Member

I don't know, maybe.
TBH all this doesn't make sense to me and I hope that the guy who answered there was mistaken and GCC doesn't really believe that breaking the language standard in normal optimization modes is acceptable.

I'll wait a bit, hoping that someone else chimes in in the GCC bugreport to clear this up. For now my workaround should work for all GCC versions including their current development version.

DanielGibson added a commit that referenced this issue May 31, 2021
according to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100839
the real compiler flag enabling this bullshit isn't
-fexpensive-optimizations but -ffp-contract=fast which for some(*)
reason is default in optimized builds.
I think it's best to disabled that optimization globally in case it
also breaks other code (I really don't want to spend several days to
hunt such an idiot bug again). I really doubt it makes any measurable
performance difference.
As https://twitter.com/stephentyrone/status/1399424911328874499 says
that clang might also enable this in the future (though to =on instead
of =fast which should be a bit saner but would still break our code),
just set this option for all GCC-ish compilers incl. clang.

(*) the reason of course is that GCC developers don't develop GCC for
    their users but to win idiotic SPEC benchmarks
rorgoroth pushed a commit to rorgoroth/dhewm3 that referenced this issue Apr 8, 2023
Only happend if `ONATIVE` was enabled (or some other flag was set
that enables the FMA extension), the root cause was that the cross
product didn't return 0 when it should, but a small value < 0.
Caused some faces to be missing in maps compiled with dmap.
RobertBeckebans/RBDOOM-3-BFG#436 (comment)
has lots of explanation.

I think this is a compiler bug, this commit works around it.

fixes dhewm#147
rorgoroth pushed a commit to rorgoroth/dhewm3 that referenced this issue Apr 8, 2023
according to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100839
the real compiler flag enabling this bullshit isn't
-fexpensive-optimizations but -ffp-contract=fast which for some(*)
reason is default in optimized builds.
I think it's best to disabled that optimization globally in case it
also breaks other code (I really don't want to spend several days to
hunt such an idiot bug again). I really doubt it makes any measurable
performance difference.
As https://twitter.com/stephentyrone/status/1399424911328874499 says
that clang might also enable this in the future (though to =on instead
of =fast which should be a bit saner but would still break our code),
just set this option for all GCC-ish compilers incl. clang.

(*) the reason of course is that GCC developers don't develop GCC for
    their users but to win idiotic SPEC benchmarks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants