mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-16 17:01:53 +00:00
[qfcc] Add failing test for vector constant init
Raw 'x y z' style vector constants that look like ints (no fractional parts) used to initialize vector globals/constants don't get converted to float vectors, resulting in nans for negative values and denormals for positive values. This tends to make game physics... interesting.
This commit is contained in:
parent
f323401c10
commit
ce64baa92d
2 changed files with 28 additions and 0 deletions
|
@ -64,6 +64,7 @@ test_progs_dat=\
|
|||
tools/qfcc/test/unaryminus.dat \
|
||||
tools/qfcc/test/vecaddr.dat \
|
||||
tools/qfcc/test/vecexpr.dat \
|
||||
tools/qfcc/test/vecconst.dat \
|
||||
tools/qfcc/test/vecinit.dat \
|
||||
tools/qfcc/test/voidfor.dat \
|
||||
tools/qfcc/test/while.dat \
|
||||
|
@ -720,6 +721,16 @@ tools/qfcc/test/vecexpr.run: $(qfcc_test_run_deps)
|
|||
include $(vecexpr_dep) # am--include-marker
|
||||
r_depfiles_remade += $(vecexpr_dep)
|
||||
|
||||
tools_qfcc_test_vecconst_dat_SOURCES=tools/qfcc/test/vecconst.r
|
||||
vecconst_obj=$(tools_qfcc_test_vecconst_dat_SOURCES:.r=.o)
|
||||
vecconst_dep=$(call qcautodep,$(tools_qfcc_test_vecconst_dat_SOURCES))
|
||||
tools/qfcc/test/vecconst.dat$(EXEEXT): $(vecconst_obj) $(QFCC_DEP)
|
||||
$(V_QFCCLD)$(QLINK) -o $@ $(vecconst_obj)
|
||||
tools/qfcc/test/vecconst.run: $(qfcc_test_run_deps)
|
||||
@$(top_srcdir)/tools/qfcc/test/build-run $@
|
||||
include $(vecconst_dep) # am--include-marker
|
||||
r_depfiles_remade += $(vecconst_dep)
|
||||
|
||||
tools_qfcc_test_vecinit_dat_SOURCES=tools/qfcc/test/vecinit.r
|
||||
vecinit_obj=$(tools_qfcc_test_vecinit_dat_SOURCES:.r=.o)
|
||||
vecinit_dep=$(call qcautodep,$(tools_qfcc_test_vecinit_dat_SOURCES))
|
||||
|
|
17
tools/qfcc/test/vecconst.r
Normal file
17
tools/qfcc/test/vecconst.r
Normal file
|
@ -0,0 +1,17 @@
|
|||
vector mins = '-16 -16 -24';
|
||||
vector maxs = '16 16 32';
|
||||
|
||||
int
|
||||
check (vector v, float x, float y, float z)
|
||||
{
|
||||
return v.x != x || v.y != y || v.z != z;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int ret = 0;
|
||||
ret |= check (mins, -16, -16, -24);
|
||||
ret |= check (maxs, 16, 16, 32);
|
||||
return ret;
|
||||
}
|
Loading…
Reference in a new issue