cinera_handmade.network/cmuratori/hero/code/code337.hmml

32 lines
2.9 KiB
Plaintext
Raw Permalink Normal View History

[video output=day337 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Convenient SIMD for Particles" vod_platform=youtube id=ucZLbYLTmd0 annotator=Miblo]
[0:09][Recap and set the stage for the day]
[2:13][Run the game and note that entities may now have a particle system attached to them]
[3:36][Look in the art pack for some particle art]
[5:07][handmade_particles.cpp: Move in the existing particle system code from handmade_world_mode.cpp]
[7:31][Blackboard: Particle Efficiency]
[12:25][Blackboard: Texture Atlases]
[13:22][Blackboard: Texture Arrays]
[16:24][Determine to use a texture atlas for the particle system]
[18:13][handmade_particles.h: Change the data in the particle_system struct to use SIMD registers, with a few words on vectorising]
[22:28][handmade_particles.cpp: Introduce PlayAround() and rework it to operate on our SIMD data]
[29:03][handmade_particles.cpp: Introduce MMSetExpr() and continue implementing PlayAround()]
[32:22][Note that we can't do the Lagrangian grid four-wide without upping the minimum system requirements to AVX-512]
[34:51][handmade_particles.cpp: Forego the grid for now and continue implementing PlayAround()]
[36:55][handmade_particles.cpp: Introduce operator+() and operator*() to operate on __m128 registers for PlayAround() to use]
[44:05][handmade_particles.h: Introduce particle_v3 struct in order to simplify the operations in PlayAround()]
[49:49][handmade_particles.h: Introduce particle_v4 struct]
[51:48][handmade_particles.h and *.cpp: Introduce particle struct and GetParticle() for PlayAround() to use]
[57:48][handmade_particles.h: Introduce v3_4x and versions of operator+=(), operator*() and operator+() to operate on and return those]
[1:05:10][Q&A][:speech]
[1:05:52][@mmozeiko][On MSVC it is possible to create non-member inline operator += for __m128. It is done in same way as you did for v2/v3/v4 types. But for gcc / clang you cannot do += for __m128, because they already have it builtin operator]
[1:06:33][handmade_particles.h: Tweak &operator+=()]
[1:07:30][@soysaucethekid][Instead of doing the particle_v3 struct, could you accomplish the same thing with macros and some pointer math?]
[1:08:26][@phort99][How much of your time would you say you spend refactoring as compared to writing new code?]
[1:11:38][@a_pulsing_mage][Have you changed the way the particles look? If so, please show them]
[1:12:53][@macielda][Do you often write code using SIMD without a non-SIMD implementation of the same operation?]
[1:14:10][@phort99][If JAI releases before the end of this project and is good enough, would you ever consider rewriting the project in JAI, or is the project too big and the gains too small?]
[1:15:48][@macielda][Is it hard to debug SIMD in Linux? Have you tried it?]
[1:17:04][@longboolean][It would be cool to see a stream or two of a good programmer (you) going through the motions of learning JAI]
[1:18:34][Closing gambit][:speech]
[/video]