Hogwarts Legacy crashes when preparing shaders because, during shaders compilation and game preparation, your computer runs out of video memory (VRAM). And as a result, the game crashes abruptly and you are unable to play the game.