-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add Clang Vector Extension and swich to xyzw quat #2025
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your contribution! While it looks very interesting and promising, I am not sure which changes are really required and which may just be considered drive-by (i.e. the change to C23).
Would now be a good time to start compiling with |
4614b5a
to
68ce564
Compare
I think you should move the feature check to the build system like this: Lines 68 to 77 in e832180
|
I think we still have too few float calculations. |
Could you please apply something like this (untested) and see if it works for you? --- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,6 +75,16 @@ check_c_source_compiles("
"
HAVE__DIV64
)
+check_c_source_compiles("
+ typedef float vec __attribute__((ext_vector_type(4)));
+ int main()
+ {
+ vec a = (vec){0, 1, 2, 3};
+ return 0;
+ }
+ "
+ HAVE_EXT_VECTOR_TYPE
+)
option(CMAKE_FIND_PACKAGE_PREFER_CONFIG
"Lookup package config files before using find modules" ON)
--- a/src/m_vector.h
+++ b/src/m_vector.h
@@ -20,9 +20,10 @@
#include <math.h>
+#include "config.h"
#include "doomtype.h"
-#if defined(__has_attribute) && defined(__clang__) && __has_attribute(ext_vector_type)
+#if defined(HAVE_EXT_VECTOR_TYPE)
typedef float vec __attribute__((ext_vector_type(3)));
#else
typedef struct
@@ -33,7 +34,7 @@ typedef struct
} vec;
#endif
-#if defined(__has_attribute) && defined(__clang__) && __has_attribute(ext_vector_type)
+#if defined(HAVE_EXT_VECTOR_TYPE)
typedef float quat __attribute__((ext_vector_type(4)));
#else
typedef struct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I don't care that much about the .gitignore changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks! |
* Add Clang Vector Extension and switch to xyzw quat * Formatting --------- Co-authored-by: Jon Daniel <[email protected]> Co-authored-by: ceski <[email protected]>
TODO
DONE