Comments (14)
Sorry, forgot to mention that this is with v1.5.0
from handmademath.
Enable __vectorcall
https://msdn.microsoft.com/en-us/library/dn375768.aspx.
from handmademath.
Hey, ill look into getting this fixed. @coastwise I see all your commits passing everything as const ref's instead due to us having to keep C compatibility we can't do that. If i remember correctly this only happens when you compile in MSVC using a x86 configuration ?
from handmademath.
Thanks! That is the configuration I'm using yes. I'm calling cl directly.
I guess I saw the operator overloads and didn't realize they were in a #ifdef __cplusplus block. I obviously won't make a pull request with it, but the const refs have unblocked me from developing on windows for now.
Cheers,
Patrick
from handmademath.
If you compiled with x64 it wouldn't be an issue, but i understand that isn't the real solution here
from handmademath.
@coastwise Hey spent some time tonight trying to reproduce this in Visual Studio 2017, and i couldn't. Can you provide me a with repro file?
from handmademath.
Hey, I've added a build script and minimum source file to reproduce the errors I'm having.
Try running visualstudio_build.bat in the tests folder
https://github.com/coastwise/Handmade-Math/tree/visualstudio
from handmademath.
Thanks!
from handmademath.
Weird seems that i can't reproduce this on VS2017. All i did was is change the VcVarsall path in the bat file you supplied fork you supplied. Ill check later if one of my other PCs has a earlier version of VS installed
from handmademath.
I can repro on VS2015 community:
If I compile the tests/hmm_test.c (and add HandemadeMath.c), and use a "win32" target (32 bit), I get this error. If I create a x64 target and compile I do not see this error.
I think this should either be documented, a more clear static assertion should be thrown, or the ifdefs should automatically do whatever they need to do to fix this.
from handmademath.
Ohhhhhhh, i never use x86 mode this could actually be a problem! Let me see if i can reproduce ill get back to you ASAP
from handmademath.
So an update on the investigation. I compiled HandmadeMath.h in x86 mode with C and CPP and got no errors. This might be caused be a default Visual Studio parameter.
S:\Handmade-Math>cl main.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26726 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
main.cpp
Microsoft (R) Incremental Linker Version 14.15.26726.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
S:\Handmade-Math>cl main.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26726 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
main.c
Microsoft (R) Incremental Linker Version 14.15.26726.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
from handmademath.
main.cpp
and main.c
aren't in the repo, so I don't know what files you are compiling.
If you just include the HandmadeMath.h
header and don't actually pass parameters to the affected functions then you won't get these alignment errors. You also won't actually be using any of the functions, so that's not super useful. Hence why I'm trying to compile the test suite :)
On the plus side, I do not see this repro in VS 2017 in x86 mode. I only see the problem on VS 2015.
I tried with cl.exe, roughly as you described, with test suite instead, and here's the output -
VS 2015:
λ cl hmm_test.c HandmadeMath.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
hmm_test.c
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(757): error C2719: 'Left': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(757): error C2719: 'Right': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(794): error C2719: 'Left': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(794): error C2719: 'Right': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(852): error C2719: 'Left': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(852): error C2719: 'Right': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(868): error C2719: 'Left': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(927): error C2719: 'Left': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(927): error C2719: 'Right': formal parameter with requested alignment of 16 won't be aligned
... lots more of these ...
VS 2017:
λ cl hmm_test.c HandmadeMath.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26726 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
hmm_test.c
HandmadeMath.c
Generating Code...
Microsoft (R) Incremental Linker Version 14.15.26726.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:hmm_test.exe
hmm_test.obj
HandmadeMath.obj
With the VS 2017 compile, I also get 100% of tests passing when I run hmm_test.exe
.
from handmademath.
Seems ill have to get VS2015 installed and get back to you. I LOVE when compiler updates change things haha.
from handmademath.
Related Issues (20)
- Ship a set of basic math functions as an easy CRT alternative HOT 2
- Support unary minus operator on vectors HOT 2
- Fully inline Handmade Math HOT 2
- CI is not working HOT 2
- Divide by zero when calling HMM_Slerp with two identity quaternions HOT 3
- Unnecessary Square Root HOT 4
- Rotate point by quaterion HOT 1
- Where's the function to inverse a matrix? HOT 2
- Request - document fundamental choices made in handmade math HOT 2
- Remove HMM_PREFIX HOT 1
- Make naming more consistent and concise HOT 1
- HMM 2.0 Design HOT 1
- Use _Generic in C? HOT 3
- Unroll our loops HOT 2
- Consistent results in calculations HOT 8
- Convert HandmadeMath to double HOT 1
- Vector to matrix multiply arguments have the wrong order HOT 1
- `HMM_LinearCombineV4M4` has incorrect name and naming of arguments HOT 2
- Audit use of pass-by-reference in C++ functions / operator overloads HOT 6
- Provide ASin, ATan, ATan2 functions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handmademath.