-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
wip: constexpr vec (constructors & operators) when using simd #1313
base: master
Are you sure you want to change the base?
Conversation
Todo:
|
I did a small amount of testing, (though only with aligned highp vec4), so far things are seeming to work OK~~, except:~~
|
… passed to memcpy
9dad7df
to
d5f8676
Compare
5716d8e
to
7144171
Compare
…other misc changes
also add custom simd swizzling functions that are available by default
New feature added: swizzling functions (enabled by default) Tho you have to specify at least two swizzle members, max N swizzle members for vec of length N, and you can’t have duplicate members (you can’t swizzle vec1’s because that’d be silly). Example: |
09a78a2
to
43dd62e
Compare
43dd62e
to
05ce19a
Compare
also fix clang warnings and allow swizzling with duplicate components
ca88a1a
to
c273819
Compare
glm only utilizes simd intrinsics for aarch64 and x86_64, but other platforms will now benefit from the arch-agnostic simd constructors and arithmetic operators used in the c++20 vec implementation
2cfafd5
to
3a63220
Compare
only support this capability on clang for now, because gcc is not able to handle my creativity (issue w/ gcc segfaulting)
also fix an issue preventing compile time evaluation for one of the ctors
Major improvements to this PR:
|
when we're having simd enabled, both our c++20 vec implementation & the original implementations put the x,y,z,w components in (an) anonymous struct(s). This then means that you can no longer access the x,y,z,w components during compile-time evaluation, since accessing members of an anonymous struct *at all* during compile time evaluation causes a compile error. we fix that by instead using operator[], which accesses elementArr -- which actually *is* able to be done at compile-time.
also make operator&& and operator|| constexpr
Yes this is creating a whole new vec implementation, because trying to add
std::is_constant_evaluated()
while also making both constexpr and simd work well, and also maintain backwards compatibility would be too complicated to incorporate into the pre-existing vec classes.oh also this is only compatible with gcc and clang, because it makes use of gcc’s vector extension for simd in vec’s comstructors (for when
std::is_constant_evaluated() = false
)This is because it allows me to write one simd construction function that works for all vec lengths
(and I will be adding support for use w/ packed vecs soon)support for use/ packed vecs & conversion between packed and aligned vecs works now
I don't intend this separate vec implementation to make the pre-existing vec implementations deprecated, this is just the most straightforward way to make constexpr work well w/ simd, without making the entire codebase unreadable