PetorSFZ
petorsfz.bsky.social
PetorSFZ
@petorsfz.bsky.social
Game dev, GPUs, voxels, low-level stuff.

Voxel game dev at night, AAA game dev during the day. I will never discuss my day job here, my opinions are my own, etc.

Mastodon: https://mastodon.gamedev.place/@PetorSFZ
Website: skipifzero.com
I think the "safe" version of your original example would be:

Vec myVec;
int index = 2;
float v;
memcpy(&v, ((const char*)&myVec) + index * sizeof(float), sizeof(float))
return v;

But like, no on wants to write code like that...
November 16, 2024 at 7:32 AM
I think it's probably fixed if you add "-fno-strict-aliasing".

Personally, I think it's too dangerous to build C++ with strict aliasing on. Too much code that potentially breaks. The workarounds to make said code defined behavior is usually quite obnoxious.
November 16, 2024 at 7:26 AM
Other notable things include a custom voxel editor, controlled entirely by gamepad. I wrote it mainly because I got annoyed with limitations of MagickaVoxel and having to use keyboard+mouse all the time.
October 23, 2024 at 7:33 PM
The voxel project is written mostly from scratch. C++, D3D12. All rendering is done through raytracing in compute shaders, the only rasterization is the UI.

I'm using a custom immediate mode UI lib and gpu library which I have written myself:
github.com/PetorSFZ/sfz...
GitHub - PetorSFZ/sfz_tech: skipifzero technologies, core libraries, game engines, graphics apis, etc
skipifzero technologies, core libraries, game engines, graphics apis, etc - PetorSFZ/sfz_tech
github.com
October 23, 2024 at 7:32 PM