4 ms·
I haven't done a lot of shader programming, just modified stuff occasionally. But one thing I miss in C++ compared to shaders is all the vector sizzling, like
by mabster 1y ago
I haven't done a lot of shader programming, just modified stuff occasionally.
But one thing I miss in C++ compared to shaders is all the vector sizzling, like v.yxyx. I couldn't really see how they handle vectors but might have missed it.
- pjmlp 1y agoThere are libraries for that, like GLM.
- mabster 1y agoUnfortunately GLM doesn't use SIMD instructions. I really wanted something that's compatible with shaders and fast so we can quickly swap between CPU and GPU because it was time consuming to port the code. I've been down this road before. If you aren't doing SIMD it's pretty easy to implement but relies on UB that works on all the compilers I tried (C++ properties would make this better and portable). I got something working with SIMD that unfortunately doesn't compile correctly on Clang!
- Cieric 1y agoBut GLM does have support for SIMD [1] or do you mean that it doesn't support specific instructions under SIMD? [1] https://glm.g-truc.net/0.9.1/api/a00285.html https://glm.g-truc.net/0.9.1/api/a00285.html
- mabster 1y agoTotally missed that, thanks! I don't know the library very well, but as far as I can tell they don't support .xyxy style sizzling with the SIMD Vec4 type. They're using the same "proxy object" method I was doing for their sizzling which I'm pretty sure won't work with SIMD types but would love to be proven wrong! I haven't deep dived into the library as I'm no longer doing this kind of code.