How to convert from XYZ or sRGB to ACEScg/AP1 I'm confused about how to properly convert from sRGB or XYZ color space to ACEScg. Specifically whether I have to account for differences in white point explicitly.

The aces github page gives the following matrix to convert from XYZ to AP1:

 1.6410233797, -0.3248032942, -0.2364246952,
-0.6636628587,  1.6153315917,  0.0167563477,
 0.0117218943, -0.0082844420,  0.9883948585


FGED2 gives the following matrix to convert from XYZ to sRGB with white point D65:

 3.240970, -1.537383, -0.498611,
-0.969244,  1.875968,  0.041555,
 0.055630, -0.203977,  1.056972 


And this shadertoy gives the following matrix to convert from sRGB to AP1:

0.613097, 0.339523, 0.047379,
0.070194, 0.916354, 0.013452,
0.020616, 0.109570, 0.869815


So I figured if I combine the XYZ->sRGB and sRGB->AP1 matrices it should be the same result as XYZ->AP1. However there is a small, but noticeable difference:

 1.66058,    -0.315295,  -0.24151,
-0.659926,    1.60839,    0.017298,
 0.00900358, -0.00356713, 0.913644


I assume the difference comes from the way the white point is handled? My question is, which is "correct". I have use cases for both XYZ->AP1 and sRGB->AP1, but now I'm irritated that my matrices don't allow me to round-trip.
The discrepancy comes from chromatic adaptation, which is included in the matrix from shadertoy. If you combine XYZ->AP1 with D65->D60 from the aces page you end up with the same matrix that I got by chaining XYZ->sRGB and sRGB->AP1 (with chromatic adaptation) together.